diff --git a/webapp/components/Group/GroupForm.vue b/webapp/components/Group/GroupForm.vue index 4c29364ee..dbb8af505 100644 --- a/webapp/components/Group/GroupForm.vue +++ b/webapp/components/Group/GroupForm.vue @@ -16,16 +16,21 @@ :placeholder="`${$t('group.name')} …`" /> - + {{ `${formData.name.length} / ${formSchema.name.max}` }} - + - - + + - - - - + + + + + - + - - {{ `${formData.about.length} / ${formSchema.about.max}` }} - - + + {{ `${formData.goal.length} / ${formSchema.goal.max}` }} + + + @@ -93,14 +102,20 @@ @input="updateEditorDescription" /> - - {{ `${contentLength} / ${formSchema.description.max}` }} - - + + {{ `${descriptionLength} / ${formSchema.description.max}` }} + + + @@ -123,12 +138,10 @@ - - - + + + + @@ -160,15 +173,15 @@ :existingCategoryIds="formData.categoryIds" /> - - {{ formData.categoryIds.length }} / 3 - - + + {{ formData.categoryIds.length }} / 3 + + + + submitDisable: {{submitDisable}} +
+ submitDisableEdit: {{submitDisableEdit}} {{ $t('actions.cancel') }} @@ -217,7 +230,7 @@ export default { }, }, data() { - const { name, slug, groupType, about, description, actionRadius, locationName, categories } = + const { name, slug, groupType, goal, description, actionRadius, locationName, categories } = this.group return { categoriesActive: this.$env.CATEGORIES_ACTIVE, @@ -231,7 +244,7 @@ export default { name: name || '', slug: slug || '', groupType: groupType || '', - about: about || '', + goal: goal || '', description: description || '', locationName: locationName || '', actionRadius: actionRadius || '', @@ -241,8 +254,8 @@ export default { name: { required: true, min: NAME_LENGTH_MIN, max: NAME_LENGTH_MAX }, slug: { required: false }, groupType: { required: true }, - about: { required: true, min: NAME_LENGTH_MIN, max: 150 }, - description: { required: true, min: NAME_LENGTH_MIN, max: 500 }, + goal: { required: true, min: NAME_LENGTH_MIN, max: 150 }, + description: { required: true, min: NAME_LENGTH_MIN, max: 2000 }, actionRadius: { required: true }, locationName: { required: false }, categoryIds: { @@ -262,33 +275,36 @@ export default { } }, computed: { - contentLength() { + descriptionLength() { return this.$filters.removeHtml(this.formData.description).length }, submitDisable() { return ( - this.formData.name === '' || + this.formData.name.length < this.formSchema.name.min || + this.formData.name.length > this.formSchema.name.max || this.formData.groupType === '' || - // this.formData.about === '' || // not mandatory - this.formData.description === '' || + this.formData.goal.length > this.formSchema.goal.max || // not mandatory + this.descriptionLength < this.formSchema.description.min || + this.descriptionLength > this.formSchema.description.max || this.formData.actionRadius === '' || // this.formData.locationName === '' || // not mandatory this.formData.categoryIds.length === 0 ) }, submitDisableEdit() { + if ( this.submitDisable ) return this.submitDisable 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.goal === this.group.goal && this.formData.description === this.group.description && this.formData.actionRadius === this.group.actionRadius && this.formData.locationName === (this.group.locationName ? this.group.locationName : '') && - this.sameCategories + this.sameCategories ) }, - + sameCategories() { const formDataCategories = this.formData.categoryIds.map((id) => id).sort() const groupDataCategories = this.group.categories.map((category) => category.id).sort() @@ -307,11 +323,11 @@ export default { this.$refs.groupForm.update('description', value) }, submit() { - const { name, about, description, groupType, actionRadius, locationName, categoryIds } = + const { name, goal, description, groupType, actionRadius, locationName, categoryIds } = this.formData const variables = { name, - about, + goal, description, groupType, actionRadius, @@ -379,11 +395,8 @@ export default { appearance: auto; } - - ds-chip { - position: absolute; - right: 0px; - - } - - +ds-chip { + position: absolute; + right: 0px; +} +