From 2016a9445b9537d0640c4c85574e4f01a3093c5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Sun, 19 May 2019 07:42:55 +0200 Subject: [PATCH] Rename confirm callbacks --- webapp/components/Comment.vue | 6 ++---- webapp/components/Modal.vue | 4 ++-- webapp/components/PostCard/index.vue | 2 +- webapp/mixins/Post.js | 2 +- webapp/pages/index.vue | 3 +-- webapp/pages/post/_id/_slug/index.vue | 2 +- webapp/pages/post/_id/_slug/more-info.vue | 3 +-- webapp/pages/profile/_id/_slug.vue | 6 +----- 8 files changed, 10 insertions(+), 18 deletions(-) diff --git a/webapp/components/Comment.vue b/webapp/components/Comment.vue index 1d52db082..85e38dbd8 100644 --- a/webapp/components/Comment.vue +++ b/webapp/components/Comment.vue @@ -20,7 +20,7 @@ placement="bottom-end" resource-type="comment" :resource="comment" - :callbacks="{ confirmCallback, cancelCallback: null }" + :callbacks="{ confirm: deleteCommentCallback, cancel: null }" style="float-right" :is-owner="isAuthor(author.id)" /> @@ -72,9 +72,7 @@ export default { isAuthor(id) { return this.user.id === id }, - async confirmCallback() { - console.log('"confirmCallback" was called !!! ', this.comment.id) - + async deleteCommentCallback() { try { // XXX Make custom mutation and tests in the Backend !!! var gqlMutation = gql` diff --git a/webapp/components/Modal.vue b/webapp/components/Modal.vue index dcde08e21..efb9cad0e 100644 --- a/webapp/components/Modal.vue +++ b/webapp/components/Modal.vue @@ -18,8 +18,8 @@ v-if="open === 'delete'" :id="data.resource.id" :type="data.type" - :confirm-callback="data.callbacks.confirmCallback" - :cancel-callback="!!data.callbacks.cancelCallback ? data.callbacks.cancelCallback : null" + :confirmCallback="data.callbacks.confirm" + :cancelCallback="!!data.callbacks.cancel ? data.callbacks.cancel : null" :name="name" @close="close" /> diff --git a/webapp/components/PostCard/index.vue b/webapp/components/PostCard/index.vue index f68c1c2b9..dfee29c8f 100644 --- a/webapp/components/PostCard/index.vue +++ b/webapp/components/PostCard/index.vue @@ -67,7 +67,7 @@ diff --git a/webapp/mixins/Post.js b/webapp/mixins/Post.js index ca94826b3..dde3f6ee3 100644 --- a/webapp/mixins/Post.js +++ b/webapp/mixins/Post.js @@ -2,7 +2,7 @@ import gql from 'graphql-tag' export default { methods: { - async confirmCallback() { + async deletePostCallback() { try { var gqlMutation = gql` mutation($id: ID!) { diff --git a/webapp/pages/index.vue b/webapp/pages/index.vue index dbc5a3fc2..fa5907213 100644 --- a/webapp/pages/index.vue +++ b/webapp/pages/index.vue @@ -87,11 +87,10 @@ export default { }) }, deletePost(_index, postId) { - console.log('Pages/index.vue: Post item deleted !!!') this.Post = this.Post.filter((post) => { return post.id !== postId }) - // Ideal sulution: + // Ideal solution: // this.Post.splice(index, 1) } }, diff --git a/webapp/pages/post/_id/_slug/index.vue b/webapp/pages/post/_id/_slug/index.vue index 67c314e90..0225334fa 100644 --- a/webapp/pages/post/_id/_slug/index.vue +++ b/webapp/pages/post/_id/_slug/index.vue @@ -18,7 +18,7 @@ placement="bottom-end" resource-type="contribution" :resource="post" - :callbacks="{ confirmCallback, cancelCallback: null }" + :callbacks="{ confirm: deletePostCallback, cancel: null }" :is-owner="isAuthor(post.author.id)" /> diff --git a/webapp/pages/post/_id/_slug/more-info.vue b/webapp/pages/post/_id/_slug/more-info.vue index 6e068c1b8..4fc94e274 100644 --- a/webapp/pages/post/_id/_slug/more-info.vue +++ b/webapp/pages/post/_id/_slug/more-info.vue @@ -38,8 +38,8 @@ @@ -75,7 +75,6 @@ export default { }, methods: { deletePost(index) { - console.log('Post/more-info.vue: Post item deleted !!!') this.post.relatedContributions.splice(index, 1) } }, diff --git a/webapp/pages/profile/_id/_slug.vue b/webapp/pages/profile/_id/_slug.vue index 587ced943..a034f3a61 100644 --- a/webapp/pages/profile/_id/_slug.vue +++ b/webapp/pages/profile/_id/_slug.vue @@ -25,7 +25,7 @@ placement="bottom-end" resource-type="user" :resource="user" - :callbacks="{ confirmCallback, cancelCallback: null }" + :callbacks="{ confirm: deletePostCallback, cancel: null }" :is-owner="myProfile" class="user-content-menu" /> @@ -404,9 +404,6 @@ export default { throw new Error('User not found!') } } - // activePosts(activePosts) { - // this.activePosts = activePosts || [] - // } }, methods: { uniq(items, field = 'id') { @@ -440,7 +437,6 @@ export default { }, deletePost(index) { this.user.contributions.splice(index, 1) - // this.$router.history.push('/') } }, apollo: {