From 7b9b253211eff0814eab5fdb347fba379c8178e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Fri, 7 Oct 2022 11:32:04 +0200 Subject: [PATCH 01/32] Implement post creation in a group --- .../ContributionForm/ContributionForm.vue | 13 ++++ webapp/graphql/PostMutations.js | 20 +++++-- webapp/locales/de.json | 6 ++ webapp/locales/en.json | 6 ++ webapp/pages/group/_id/_slug.vue | 5 +- webapp/pages/post/create.vue | 60 ++++++++++++++++--- 6 files changed, 94 insertions(+), 16 deletions(-) diff --git a/webapp/components/ContributionForm/ContributionForm.vue b/webapp/components/ContributionForm/ContributionForm.vue index 6eb1ebbbc..ba982e6ef 100644 --- a/webapp/components/ContributionForm/ContributionForm.vue +++ b/webapp/components/ContributionForm/ContributionForm.vue @@ -99,6 +99,10 @@ export default { type: Object, default: () => ({}), }, + groupId: { + type: String, + default: () => null, + }, }, data() { const { title, content, image, categories } = this.contribution @@ -164,6 +168,14 @@ export default { } } this.loading = true + // Wolle: console.log('variables: ', { + // title, + // content, + // categoryIds, + // id: this.contribution.id || null, + // image, + // groupId: this.groupId, + // }) this.$apollo .mutate({ mutation: this.contribution.id ? PostMutations().UpdatePost : PostMutations().CreatePost, @@ -173,6 +185,7 @@ export default { categoryIds, id: this.contribution.id || null, image, + groupId: this.groupId, }, }) .then(({ data }) => { diff --git a/webapp/graphql/PostMutations.js b/webapp/graphql/PostMutations.js index ee61efc3b..23a537e56 100644 --- a/webapp/graphql/PostMutations.js +++ b/webapp/graphql/PostMutations.js @@ -3,8 +3,20 @@ import gql from 'graphql-tag' export default () => { return { CreatePost: gql` - mutation ($title: String!, $content: String!, $categoryIds: [ID], $image: ImageInput) { - CreatePost(title: $title, content: $content, categoryIds: $categoryIds, image: $image) { + mutation ( + $title: String! + $content: String! + $categoryIds: [ID] + $image: ImageInput + $groupId: ID + ) { + CreatePost( + title: $title + content: $content + categoryIds: $categoryIds + image: $image + groupId: $groupId + ) { title slug content @@ -23,14 +35,14 @@ export default () => { $title: String! $content: String! $image: ImageInput - $categoryIds: [ID] + $categoryIds: [ID] # Wolle: $groupId: ID ) { UpdatePost( id: $id title: $title content: $content image: $image - categoryIds: $categoryIds + categoryIds: $categoryIds # Wolle: groupId: $groupId ) { id title diff --git a/webapp/locales/de.json b/webapp/locales/de.json index 6375ca48f..69a1e08b0 100644 --- a/webapp/locales/de.json +++ b/webapp/locales/de.json @@ -605,6 +605,12 @@ "submitted": "Kommentar gesendet", "updated": "Änderungen gespeichert" }, + "createNewPost": { + "forGroup": { + "title": "Für die Gruppe „{name}“" + }, + "title": "Erstelle einen neuen Beitrag" + }, "edited": "bearbeitet", "menu": { "delete": "Beitrag löschen", diff --git a/webapp/locales/en.json b/webapp/locales/en.json index aab9c6f83..01c4a1b67 100644 --- a/webapp/locales/en.json +++ b/webapp/locales/en.json @@ -605,6 +605,12 @@ "submitted": "Comment submitted!", "updated": "Changes saved!" }, + "createNewPost": { + "forGroup": { + "title": "For The Group “{name}”" + }, + "title": "Create A New Post" + }, "edited": "edited", "menu": { "delete": "Delete post", diff --git a/webapp/pages/group/_id/_slug.vue b/webapp/pages/group/_id/_slug.vue index dd8bccda6..5f4e0b885 100644 --- a/webapp/pages/group/_id/_slug.vue +++ b/webapp/pages/group/_id/_slug.vue @@ -249,10 +249,9 @@ - + - - - - -   - +
+ + {{ $t('post.createNewPost.title') }} + + {{ $t('post.createNewPost.forGroup.title', { name: group.name }) }} + + + + + + + +   + +
From fc4e67990b1499e7a6a49eb1b14c1fa0766c0977 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Fri, 7 Oct 2022 13:14:12 +0200 Subject: [PATCH 02/32] Implement visibility of posts on group profile --- webapp/pages/group/_id/_slug.vue | 97 ++++++++++++++++---------------- 1 file changed, 49 insertions(+), 48 deletions(-) diff --git a/webapp/pages/group/_id/_slug.vue b/webapp/pages/group/_id/_slug.vue index 5f4e0b885..bf54b5467 100644 --- a/webapp/pages/group/_id/_slug.vue +++ b/webapp/pages/group/_id/_slug.vue @@ -295,9 +295,9 @@ - + @@ -305,11 +305,11 @@ - - diff --git a/webapp/pages/post/_id/_slug/index.vue b/webapp/pages/post/_id/_slug/index.vue index 724704f67..0516ec510 100644 --- a/webapp/pages/post/_id/_slug/index.vue +++ b/webapp/pages/post/_id/_slug/index.vue @@ -1,107 +1,129 @@ @@ -167,6 +189,31 @@ export default { }, 50) }, computed: { + routes() { + const { slug, id } = this.$route.params + return [ + { + name: this.$t('common.post', null, 1), + path: `/post/${id}/${slug}`, + children: [ + { + name: this.$t('common.comment', null, 2), + path: `/post/${id}/${slug}#comments`, + }, + // TODO implement + /* { + name: this.$t('common.letsTalk'), + path: `/post/${id}/${slug}#lets-talk` + }, */ + // TODO implement + /* { + name: this.$t('common.versus'), + path: `/post/${id}/${slug}#versus` + } */ + ], + }, + ] + }, menuModalsData() { return postMenuModalsData( // "this.post" may not always be defined at the beginning … @@ -266,6 +313,11 @@ export default { }