mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-24 21:46:22 -04:00
(nouns) allow that some genders are unspecified (some users put in - or similar), at least two are required
This commit is contained in:
parent
dfb54a4540
commit
af5e3aa16e
@ -37,6 +37,12 @@ const templateBase = ref('');
|
||||
const templateFilter = ref('');
|
||||
const templateVisible = ref(false);
|
||||
|
||||
const canRemoveWord = (gender: typeof genders[number], plural: boolean): boolean => {
|
||||
return genders.filter((otherGender) => {
|
||||
return otherGender !== gender && form.value[plural ? `${otherGender}Pl` as const : otherGender].length > 0;
|
||||
}).length > 1 || form.value[plural ? `${gender}Pl` as const : gender].length > 1;
|
||||
};
|
||||
|
||||
const dialogue = useDialogue();
|
||||
const applyTemplate = async (template: MinimalNoun): Promise<void> => {
|
||||
if (JSON.stringify(form.value) !== JSON.stringify(emptyForm(config))) {
|
||||
@ -109,7 +115,7 @@ defineExpose({ edit, focus });
|
||||
<ListInput
|
||||
v-model="form[gender]"
|
||||
:maxlength="36"
|
||||
:minitems="1"
|
||||
:minitems="canRemoveWord(gender, false) ? 0 : 1"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@ -122,7 +128,7 @@ defineExpose({ edit, focus });
|
||||
<ListInput
|
||||
v-model="form[`${gender}Pl`]"
|
||||
:maxlength="36"
|
||||
:minitems="config.nouns.pluralsRequired ? 1 : 0"
|
||||
:minitems="!config.nouns.pluralsRequired || canRemoveWord(gender, true) ? 0 : 1"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -959,9 +959,9 @@ export class Noun implements Entry {
|
||||
approved = true, base_id = null, author = null, declension = null,
|
||||
}: NounRaw) {
|
||||
this.id = id;
|
||||
this.masc = masc.split('|');
|
||||
this.fem = fem.split('|');
|
||||
this.neutr = neutr.split('|');
|
||||
this.masc = masc ? masc.split('|') : [];
|
||||
this.fem = fem ? fem.split('|') : [];
|
||||
this.neutr = neutr ? neutr.split('|') : [];
|
||||
this.mascPl = mascPl ? mascPl.split('|') : [];
|
||||
this.femPl = femPl ? femPl.split('|') : [];
|
||||
this.neutrPl = neutrPl ? neutrPl.split('|') : [];
|
||||
|
Loading…
x
Reference in New Issue
Block a user