From 0e1bca4c787c55ff57599a9c636b2f40bb8e0e47 Mon Sep 17 00:00:00 2001 From: Christian Cueni Date: Wed, 27 Mar 2019 14:20:21 +0100 Subject: [PATCH] add unshare for projects --- client/src/components/portfolio/ProjectWidget.vue | 14 ++++++++++---- client/src/graphql/gql/fragments/projectParts.gql | 1 + client/src/pages/portfolio.vue | 6 +++--- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/client/src/components/portfolio/ProjectWidget.vue b/client/src/components/portfolio/ProjectWidget.vue index a9317657..9e54ec83 100644 --- a/client/src/components/portfolio/ProjectWidget.vue +++ b/client/src/components/portfolio/ProjectWidget.vue @@ -5,13 +5,13 @@ - @@ -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); } } } diff --git a/client/src/graphql/gql/fragments/projectParts.gql b/client/src/graphql/gql/fragments/projectParts.gql index 04cf7c9c..c0d1a8b5 100644 --- a/client/src/graphql/gql/fragments/projectParts.gql +++ b/client/src/graphql/gql/fragments/projectParts.gql @@ -5,4 +5,5 @@ fragment ProjectParts on ProjectNode { description slug objectives + final } diff --git a/client/src/pages/portfolio.vue b/client/src/pages/portfolio.vue index b156f63a..cb5425cb 100644 --- a/client/src/pages/portfolio.vue +++ b/client/src/pages/portfolio.vue @@ -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 } } }