add unshare for projects
This commit is contained in:
parent
2b39cc92dd
commit
0e1bca4c78
|
|
@ -5,13 +5,13 @@
|
|||
|
||||
<entry-count-widget entry-count="4"></entry-count-widget>
|
||||
<owner-widget name="Hans Muster"></owner-widget>
|
||||
|
||||
</router-link>
|
||||
<widget-footer>
|
||||
<template slot-scope="scope">
|
||||
<li class="popover-links__link"><a @click="$emit('delete', id)">Projekt löschen</a></li>
|
||||
<li class="popover-links__link"><a @click="$emit('edit', id)">Projekt bearbeiten</a></li>
|
||||
<li class="popover-links__link"><a @click="share(scope)">Projekt teilen</a></li>
|
||||
<li v-if="!final" class="popover-links__link"><a @click="share(scope)">Projekt teilen</a></li>
|
||||
<li v-if="final" class="popover-links__link"><a @click="unshare(scope)">Projekt nicht mehr teilen</a></li>
|
||||
</template>
|
||||
</widget-footer>
|
||||
</div>
|
||||
|
|
@ -23,7 +23,7 @@
|
|||
import WidgetFooter from '@/components/WidgetFooter';
|
||||
|
||||
export default {
|
||||
props: ['title', 'appearance', 'slug', 'id'],
|
||||
props: ['title', 'appearance', 'slug', 'id', 'final'],
|
||||
|
||||
components: {
|
||||
WidgetFooter,
|
||||
|
|
@ -39,8 +39,14 @@
|
|||
|
||||
methods: {
|
||||
share: function (scope) {
|
||||
this.updateShare(scope, true);
|
||||
},
|
||||
unshare: function (scope) {
|
||||
this.updateShare(scope, false);
|
||||
},
|
||||
updateShare: function (scope, state) {
|
||||
scope.hide();
|
||||
this.$emit('share', this.id);
|
||||
this.$emit('updateShare', this.id, state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,4 +5,5 @@ fragment ProjectParts on ProjectNode {
|
|||
description
|
||||
slug
|
||||
objectives
|
||||
final
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
v-for="project in projects"
|
||||
v-bind="project"
|
||||
@delete="deleteProject"
|
||||
@share="shareProject"
|
||||
@updateShare="updateShareState"
|
||||
@edit="editProject"
|
||||
:key="project.id"
|
||||
class="portfolio__project"
|
||||
|
|
@ -69,7 +69,7 @@
|
|||
editProject(id) {
|
||||
this.$router.push({name: 'edit-project', params: { id }});
|
||||
},
|
||||
shareProject(id) {
|
||||
updateShareState(id, state) {
|
||||
const project = this.projects.filter(project => project.id === id)[0];
|
||||
this.$apollo.mutate({
|
||||
mutation: UPDATE_PROJECT_MUTATION,
|
||||
|
|
@ -81,7 +81,7 @@
|
|||
description: project.description,
|
||||
appearance: project.appearance,
|
||||
objectives: project.objectives,
|
||||
final: true
|
||||
final: state
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue