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>
|
<entry-count-widget entry-count="4"></entry-count-widget>
|
||||||
<owner-widget name="Hans Muster"></owner-widget>
|
<owner-widget name="Hans Muster"></owner-widget>
|
||||||
|
|
||||||
</router-link>
|
</router-link>
|
||||||
<widget-footer>
|
<widget-footer>
|
||||||
<template slot-scope="scope">
|
<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('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="$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>
|
</template>
|
||||||
</widget-footer>
|
</widget-footer>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
import WidgetFooter from '@/components/WidgetFooter';
|
import WidgetFooter from '@/components/WidgetFooter';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: ['title', 'appearance', 'slug', 'id'],
|
props: ['title', 'appearance', 'slug', 'id', 'final'],
|
||||||
|
|
||||||
components: {
|
components: {
|
||||||
WidgetFooter,
|
WidgetFooter,
|
||||||
|
|
@ -39,8 +39,14 @@
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
share: function (scope) {
|
share: function (scope) {
|
||||||
|
this.updateShare(scope, true);
|
||||||
|
},
|
||||||
|
unshare: function (scope) {
|
||||||
|
this.updateShare(scope, false);
|
||||||
|
},
|
||||||
|
updateShare: function (scope, state) {
|
||||||
scope.hide();
|
scope.hide();
|
||||||
this.$emit('share', this.id);
|
this.$emit('updateShare', this.id, state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,4 +5,5 @@ fragment ProjectParts on ProjectNode {
|
||||||
description
|
description
|
||||||
slug
|
slug
|
||||||
objectives
|
objectives
|
||||||
|
final
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
v-for="project in projects"
|
v-for="project in projects"
|
||||||
v-bind="project"
|
v-bind="project"
|
||||||
@delete="deleteProject"
|
@delete="deleteProject"
|
||||||
@share="shareProject"
|
@updateShare="updateShareState"
|
||||||
@edit="editProject"
|
@edit="editProject"
|
||||||
:key="project.id"
|
:key="project.id"
|
||||||
class="portfolio__project"
|
class="portfolio__project"
|
||||||
|
|
@ -69,7 +69,7 @@
|
||||||
editProject(id) {
|
editProject(id) {
|
||||||
this.$router.push({name: 'edit-project', params: { id }});
|
this.$router.push({name: 'edit-project', params: { id }});
|
||||||
},
|
},
|
||||||
shareProject(id) {
|
updateShareState(id, state) {
|
||||||
const project = this.projects.filter(project => project.id === id)[0];
|
const project = this.projects.filter(project => project.id === id)[0];
|
||||||
this.$apollo.mutate({
|
this.$apollo.mutate({
|
||||||
mutation: UPDATE_PROJECT_MUTATION,
|
mutation: UPDATE_PROJECT_MUTATION,
|
||||||
|
|
@ -81,7 +81,7 @@
|
||||||
description: project.description,
|
description: project.description,
|
||||||
appearance: project.appearance,
|
appearance: project.appearance,
|
||||||
objectives: project.objectives,
|
objectives: project.objectives,
|
||||||
final: true
|
final: state
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue