diff --git a/webapp/components/Group/GroupMenu.vue b/webapp/components/Group/GroupContentMenu.vue similarity index 97% rename from webapp/components/Group/GroupMenu.vue rename to webapp/components/Group/GroupContentMenu.vue index 09f877906..e61786fe7 100644 --- a/webapp/components/Group/GroupMenu.vue +++ b/webapp/components/Group/GroupContentMenu.vue @@ -3,12 +3,11 @@ @@ -36,7 +35,7 @@ import Dropdown from '~/components/Dropdown' export default { - name: 'ContentMenu', + name: 'GroupContentMenu', components: { Dropdown, }, diff --git a/webapp/components/Group/GroupForm.vue b/webapp/components/Group/GroupForm.vue index d804c5d08..87b46091b 100644 --- a/webapp/components/Group/GroupForm.vue +++ b/webapp/components/Group/GroupForm.vue @@ -1,7 +1,5 @@ - - + + 0 - ) { - return false - } - return true + return ( + this.formData.name === '' || + this.formData.groupType === '' || + // this.formData.about === '' || // not mandatory + this.formData.description === '' || + this.formData.actionRadius === '' || + // this.formData.locationName === '' || // not mandatory + this.formData.categoryIds.length === 0 + ) }, submitDisableEdit() { - if ( - this.formData.name !== this.group.name || - this.formData.groupType !== this.group.groupType || - this.formData.about !== this.group.about || - this.formData.description !== this.group.description || - this.formData.actionRadius !== this.group.actionRadius || - this.formData.locationName !== this.group.locationName || - this.formData.categoryIds.length === 0 || - !this.sameCategories - ) { - return false - } - return true + return ( + this.formData.name === this.group.name && + this.formData.slug === this.group.slug && + // this.formData.groupType === this.group.groupType && // can not be changed for now + this.formData.about === this.group.about && + this.formData.description === this.group.description && + this.formData.actionRadius === this.group.actionRadius && + this.formData.locationName === (this.group.locationName ? this.group.locationName : '') && + this.sameCategories + ) }, sameCategories() { - const formDataCategories = this.formData.categoryIds.map((categoryIds) => categoryIds) - const groupDataCategories = this.group.categories.map((category) => category.id) - let result - let each = true + const formDataCategories = this.formData.categoryIds.map((id) => id).sort() + const groupDataCategories = this.group.categories.map((category) => category.id).sort() + let equal = true if (formDataCategories.length !== groupDataCategories.length) return false - if (JSON.stringify(formDataCategories) !== JSON.stringify(groupDataCategories)) { - formDataCategories.forEach((element) => { - result = groupDataCategories.filter((groupCategorieId) => groupCategorieId === element) - if (result.length === 0) each = false - }) - return each - } - return true + formDataCategories.forEach((id, index) => { + equal = equal && id === groupDataCategories[index] + }) + return equal }, }, methods: { @@ -311,7 +300,7 @@ export default { } - diff --git a/webapp/components/Group/GroupTeaser.vue b/webapp/components/Group/GroupTeaser.vue new file mode 100644 index 000000000..9ebbbcdce --- /dev/null +++ b/webapp/components/Group/GroupTeaser.vue @@ -0,0 +1,203 @@ + + + + {{ group.name }} + + + + + + {{ group.slug }} + + + + + + + {{ group && group.location ? group.location.name : '' }} + + + + + + + + + + + + + + + diff --git a/webapp/components/PostTeaser/PostTeaser.vue b/webapp/components/PostTeaser/PostTeaser.vue index 7e8471f9e..dc1829a4d 100644 --- a/webapp/components/PostTeaser/PostTeaser.vue +++ b/webapp/components/PostTeaser/PostTeaser.vue @@ -19,9 +19,8 @@ {{ post.title }} - + - --> - + {{ groupName }} - + + {{ groupSlug }} - + {{ group && group.location ? group.location.name : '' }} - + {{ $t('group.foundation') }} {{ group.createdAt | date('MMMM yyyy') }} - + @@ -110,7 +111,7 @@ - + {{ $t('group.role') }} @@ -121,7 +122,7 @@ - + {{ $t('group.type') }} @@ -130,7 +131,7 @@ {{ group && group.groupType ? $t('group.types.' + group.groupType) : '' }} - + {{ $t('group.actionRadius') }} @@ -143,7 +144,7 @@ - + @@ -176,7 +177,7 @@ - + @@ -230,14 +231,13 @@ - + - { + const { id: groupId, slug: groupSlug } = data.CreateGroup + responseId = groupId + responseSlug = groupSlug + }, }) this.$toast.success(this.$t('group.groupCreated')) - this.$router.history.push('/my-groups') - // Wolle: refetch groups on '/my-groups' - // seems to work of its own now, because of implementation of vue apollo queries in '/my-groups' + // this.$router.history.push('/my-groups') + this.$router.history.push({ + name: 'group-id-slug', + params: { id: responseId, slug: responseSlug }, + }) } catch (error) { this.$toast.error(error.message) } diff --git a/webapp/pages/group/edit/_id.vue b/webapp/pages/group/edit/_id.vue index 12e67cef3..39b9eff5f 100644 --- a/webapp/pages/group/edit/_id.vue +++ b/webapp/pages/group/edit/_id.vue @@ -7,7 +7,6 @@ - diff --git a/webapp/pages/group/edit/_id/index.vue b/webapp/pages/group/edit/_id/index.vue index 578b8f115..c50eaa4c4 100644 --- a/webapp/pages/group/edit/_id/index.vue +++ b/webapp/pages/group/edit/_id/index.vue @@ -25,10 +25,9 @@ export default { }, methods: { async updateGroup(value) { - const { id, name, about, description, groupType, actionRadius, locationName, categoryIds } = - value - const variables = { + const { id, + slug, name, about, description, @@ -36,13 +35,34 @@ export default { actionRadius, locationName, categoryIds, + } = value + const variables = { + id, + name, + slug, + about, + description, + groupType, + actionRadius, + locationName, + categoryIds, } + let responseId, responseSlug try { await this.$apollo.mutate({ mutation: updateGroupMutation(), variables, + update: (_store, { data }) => { + const { id: groupId, slug: groupSlug } = data.UpdateGroup + responseId = groupId + responseSlug = groupSlug + }, }) this.$toast.success(this.$t('group.group-updated')) + this.$router.history.push({ + name: 'group-id-slug', + params: { id: responseId, slug: responseSlug }, + }) } catch (error) { this.$toast.error(error.message) } diff --git a/webapp/pages/my-groups.vue b/webapp/pages/my-groups.vue index 4320904d5..7302b92ad 100644 --- a/webapp/pages/my-groups.vue +++ b/webapp/pages/my-groups.vue @@ -7,11 +7,11 @@ - - - + diff --git a/webapp/pages/profile/_id/_slug.vue b/webapp/pages/profile/_id/_slug.vue index 668c271d6..81bb5c49b 100644 --- a/webapp/pages/profile/_id/_slug.vue +++ b/webapp/pages/profile/_id/_slug.vue @@ -31,6 +31,7 @@ {{ userName }} + {{ userSlug }} @@ -253,7 +254,7 @@ export default { }, userSlug() { const { slug } = this.user || {} - return slug && `@${slug}` + return slug }, tabOptions() { return [