mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
Fix Add Language check for form submit
This commit is contained in:
parent
e4cbf9246b
commit
dd03f4b7f0
@ -24,7 +24,7 @@
|
|||||||
<ds-text align="right">
|
<ds-text align="right">
|
||||||
<ds-chip v-if="form.title.length < formSchema.title.min" class="checkicon" size="base">
|
<ds-chip v-if="form.title.length < formSchema.title.min" class="checkicon" size="base">
|
||||||
{{ form.title.length }}/{{ formSchema.title.max }}
|
{{ form.title.length }}/{{ formSchema.title.max }}
|
||||||
<ds-icon name="warning"></ds-icon>
|
<ds-icon name="warning" class="colorRed"></ds-icon>
|
||||||
</ds-chip>
|
</ds-chip>
|
||||||
<ds-chip
|
<ds-chip
|
||||||
v-else-if="form.title.length < formSchema.title.max"
|
v-else-if="form.title.length < formSchema.title.max"
|
||||||
@ -54,7 +54,7 @@
|
|||||||
size="base"
|
size="base"
|
||||||
>
|
>
|
||||||
{{ form.contentLength }}
|
{{ form.contentLength }}
|
||||||
<ds-icon name="warning"></ds-icon>
|
<ds-icon name="warning" class="colorRed"></ds-icon>
|
||||||
</ds-chip>
|
</ds-chip>
|
||||||
<ds-chip v-else class="checkicon" size="base" color="primary">
|
<ds-chip v-else class="checkicon" size="base" color="primary">
|
||||||
{{ form.contentLength }}
|
{{ form.contentLength }}
|
||||||
@ -71,7 +71,7 @@
|
|||||||
<ds-text align="right">
|
<ds-text align="right">
|
||||||
<ds-chip v-if="form.categoryIds.length === 0" class="checkicon checkicon_cat" size="base">
|
<ds-chip v-if="form.categoryIds.length === 0" class="checkicon checkicon_cat" size="base">
|
||||||
{{ form.categoryIds.length }} / 3
|
{{ form.categoryIds.length }} / 3
|
||||||
<ds-icon name="warning"></ds-icon>
|
<ds-icon name="warning" class="colorRed">></ds-icon>
|
||||||
</ds-chip>
|
</ds-chip>
|
||||||
<ds-chip v-else class="checkicon checkicon_cat" size="base" color="primary">
|
<ds-chip v-else class="checkicon checkicon_cat" size="base" color="primary">
|
||||||
{{ form.categoryIds.length }} / 3
|
{{ form.categoryIds.length }} / 3
|
||||||
@ -79,18 +79,28 @@
|
|||||||
</ds-chip>
|
</ds-chip>
|
||||||
</ds-text>
|
</ds-text>
|
||||||
<ds-flex class="contribution-form-footer">
|
<ds-flex class="contribution-form-footer">
|
||||||
<ds-flex-item :width="{ base: '10%', sm: '10%', md: '10%', lg: '15%' }" />
|
<ds-flex-item>
|
||||||
<ds-flex-item :width="{ base: '80%', sm: '30%', md: '30%', lg: '20%' }">
|
|
||||||
<ds-space margin-bottom="small" />
|
<ds-space margin-bottom="small" />
|
||||||
<ds-select
|
<ds-select
|
||||||
model="language"
|
model="language"
|
||||||
:options="form.languageOptions"
|
:options="form.languageOptions"
|
||||||
icon="globe"
|
icon="globe"
|
||||||
:placeholder="locale"
|
:placeholder="form.languageDefault"
|
||||||
:label="$t('contribution.languageSelectLabel')"
|
:label="$t('contribution.languageSelectLabel')"
|
||||||
|
@input.native="updateLanguage"
|
||||||
/>
|
/>
|
||||||
</ds-flex-item>
|
</ds-flex-item>
|
||||||
</ds-flex>
|
</ds-flex>
|
||||||
|
<ds-text align="right">
|
||||||
|
<ds-chip v-if="form.language !== null" size="base" color="primary">
|
||||||
|
{{ form.language.label }}
|
||||||
|
<ds-icon name="check"></ds-icon>
|
||||||
|
</ds-chip>
|
||||||
|
<ds-chip v-else size="base">
|
||||||
|
{{ $t('contribution.languageSelectLabel') }}
|
||||||
|
<ds-icon name="warning" class="colorRed"></ds-icon>
|
||||||
|
</ds-chip>
|
||||||
|
</ds-text>
|
||||||
<ds-space />
|
<ds-space />
|
||||||
<div slot="footer" style="text-align: right">
|
<div slot="footer" style="text-align: right">
|
||||||
<ds-button
|
<ds-button
|
||||||
@ -150,6 +160,8 @@ export default {
|
|||||||
image: null,
|
image: null,
|
||||||
language: null,
|
language: null,
|
||||||
languageOptions: [],
|
languageOptions: [],
|
||||||
|
languageDefault: this.$t('contribution.languageSelectText'),
|
||||||
|
selectedLanguage: '',
|
||||||
categoryIds: [],
|
categoryIds: [],
|
||||||
},
|
},
|
||||||
formSchema: {
|
formSchema: {
|
||||||
@ -258,6 +270,10 @@ export default {
|
|||||||
this.form.categoryIds = ids
|
this.form.categoryIds = ids
|
||||||
this.validatePost()
|
this.validatePost()
|
||||||
},
|
},
|
||||||
|
updateLanguage() {
|
||||||
|
this.form.selectedLanguage = this.form.language.label
|
||||||
|
this.validatePost()
|
||||||
|
},
|
||||||
addTeaserImage(file) {
|
addTeaserImage(file) {
|
||||||
this.form.teaserImage = file
|
this.form.teaserImage = file
|
||||||
},
|
},
|
||||||
@ -272,7 +288,13 @@ export default {
|
|||||||
const passesContentValidations = this.form.contentLength >= this.contentMin
|
const passesContentValidations = this.form.contentLength >= this.contentMin
|
||||||
const passesCategoryValidations =
|
const passesCategoryValidations =
|
||||||
this.form.categoryIds.length > 0 && this.form.categoryIds.length <= 3
|
this.form.categoryIds.length > 0 && this.form.categoryIds.length <= 3
|
||||||
this.failsValidations = !(passesContentValidations && passesCategoryValidations)
|
const passedLanguageValidation = this.form.language !== null
|
||||||
|
|
||||||
|
this.failsValidations = !(
|
||||||
|
passesContentValidations &&
|
||||||
|
passesCategoryValidations &&
|
||||||
|
passedLanguageValidation
|
||||||
|
)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
apollo: {
|
apollo: {
|
||||||
@ -334,4 +356,7 @@ export default {
|
|||||||
.checkicon_cat {
|
.checkicon_cat {
|
||||||
top: -58px;
|
top: -58px;
|
||||||
}
|
}
|
||||||
|
.colorRed {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -579,7 +579,8 @@
|
|||||||
"filterFollow": "Beiträge filtern von Usern denen ich folge",
|
"filterFollow": "Beiträge filtern von Usern denen ich folge",
|
||||||
"filterALL": "Alle Beiträge anzeigen",
|
"filterALL": "Alle Beiträge anzeigen",
|
||||||
"success": "Gespeichert!",
|
"success": "Gespeichert!",
|
||||||
"languageSelectLabel": "Sprache",
|
"languageSelectLabel": "Sprache deines Beitrags",
|
||||||
|
"languageSelectText": "Sprache wählen",
|
||||||
"categories": {
|
"categories": {
|
||||||
"infoSelectedNoOfMaxCategories": "{chosen} von {max} Kategorien ausgewählt"
|
"infoSelectedNoOfMaxCategories": "{chosen} von {max} Kategorien ausgewählt"
|
||||||
},
|
},
|
||||||
|
|||||||
@ -580,7 +580,8 @@
|
|||||||
"filterFollow": "Filter contributions from users I follow",
|
"filterFollow": "Filter contributions from users I follow",
|
||||||
"filterALL": "View all contributions",
|
"filterALL": "View all contributions",
|
||||||
"success": "Saved!",
|
"success": "Saved!",
|
||||||
"languageSelectLabel": "Language",
|
"languageSelectLabel": "Language of your contribution",
|
||||||
|
"languageSelectText": "Select Language",
|
||||||
"categories": {
|
"categories": {
|
||||||
"infoSelectedNoOfMaxCategories": "{chosen} of {max} categories selected"
|
"infoSelectedNoOfMaxCategories": "{chosen} of {max} categories selected"
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user