(refactor) loop over noun genus instead of writing all cases

This commit is contained in:
Valentyne Stigloher 2024-11-11 14:59:32 +01:00
parent 90e0438952
commit b918be44a5
2 changed files with 7 additions and 35 deletions

View File

@ -123,40 +123,18 @@ defineExpose({ loadNouns });
<template #row="s">
<template v-if="s">
<td>
<NounsItem :noun="s.el" gender="masc" />
<td v-for="gender in genders" :key="gender">
<NounsItem :noun="s.el" :gender="gender" />
<small v-if="s.el.base && nouns[s.el.base]">
<p><strong><T>nouns.edited</T><T>quotation.colon</T></strong></p>
<Diff switchable>
<template #before><NounsItem :noun="nouns[s.el.base]" gender="masc" /></template>
<template #after><NounsItem :noun="s.el" gender="masc" /></template>
</Diff>
</small>
</td>
<td>
<NounsItem :noun="s.el" gender="fem" />
<small v-if="s.el.base && nouns[s.el.base]">
<p><strong><T>nouns.edited</T><T>quotation.colon</T></strong></p>
<Diff switchable>
<template #before><NounsItem :noun="nouns[s.el.base]" gender="fem" /></template>
<template #after><NounsItem :noun="s.el" gender="fem" /></template>
</Diff>
</small>
</td>
<td>
<NounsItem :noun="s.el" gender="neutr" />
<small v-if="s.el.base && nouns[s.el.base]">
<p><strong><T>nouns.edited</T><T>quotation.colon</T></strong></p>
<Diff switchable>
<template #before><NounsItem :noun="nouns[s.el.base]" gender="neutr" /></template>
<template #after><NounsItem :noun="s.el" gender="neutr" /></template>
<template #before><NounsItem :noun="nouns[s.el.base]" :gender="gender" /></template>
<template #after><NounsItem :noun="s.el" :gender="gender" /></template>
</Diff>
</small>
<div v-if="s.el.sourcesData.length" class="div-three-columns">
<div v-if="gender === 'neutr' && s.el.sourcesData.length" class="div-three-columns">
<p><strong><T>sources.referenced</T><T>quotation.colon</T></strong></p>
<ul class="list-unstyled">
<li v-for="source in s.el.sourcesData" :key="source.id">

View File

@ -38,14 +38,8 @@ const templates = computed((): (MinimalNoun & { id: string })[] => {
<th></th>
</template>
<template #row="{ el: template }">
<td>
<NounsItem :noun="template" gender="masc" />
</td>
<td>
<NounsItem :noun="template" gender="fem" />
</td>
<td>
<NounsItem :noun="template" gender="neutr" />
<td v-for="gender in genders" :key="gender">
<NounsItem :noun="template" :gender="gender" />
</td>
<th>
<ul class="list-unstyled list-btn-concise">