#77 [nouns] hide noun examples (accordion)

This commit is contained in:
Andrea Vos 2020-10-16 18:55:41 +02:00
parent 28a01fe98f
commit 6cfcb65643
3 changed files with 298 additions and 270 deletions

View File

@ -24,9 +24,11 @@
<T>nouns.personNouns.info</T>
<h4><T>nouns.examples</T>:</h4>
<section class="table-responsive">
<details class="border mb-3">
<summary class="bg-light p-3">
<h4 class="h5 d-inline"><T>nouns.examples</T></h4>
</summary>
<div class="border-top table-responsive">
<table class="table table-striped table-hover table-fixed-3">
<thead>
<tr>
@ -73,7 +75,8 @@
</tr>
</tbody>
</table>
</section>
</div>
</details>
<Separator icon="atom-alt"/>
@ -83,9 +86,11 @@
<T>nouns.dukajNouns.info</T>
<h4><T>nouns.examples</T>:</h4>
<section class="table-responsive">
<details class="border mb-3">
<summary class="bg-light p-3">
<h4 class="h5 d-inline"><T>nouns.examples</T></h4>
</summary>
<div class="border-top table-responsive">
<table class="table table-striped table-hover table-fixed-3">
<thead>
<tr>
@ -139,7 +144,8 @@
</tr>
</tbody>
</table>
</section>
</div>
</details>
<Separator icon="atom-alt"/>
@ -190,15 +196,20 @@
masc: 'austronauta', fem: 'austronautka', neutr: 'austronautu',
mascPl: 'austronauci', femPl: 'austronautki', neutrPl: 'austronauty',
}),
new Noun({
id: 'Europejczyk',
masc: 'Europejczyk', fem: 'Europejka', neutr: 'Europeju',
mascPl: 'Europejczycy', femPl: 'Europejki', neutrPl: 'Europejy',
}),
new Noun({
id: 'przyjaciel',
masc: 'przyjaciel', fem: 'przyjaciółka', neutr: 'przyjaciełu',
mascPl: 'przyjaciele', femPl: 'przyjaciółki', neutrPl: 'przyjacieły',
}),
new Noun({
id: 'Europejczyk',
masc: 'Europejczyk', fem: 'Europejka', neutr: 'Europeju',
mascPl: 'Europejczycy', femPl: 'Europejki', neutrPl: 'Europejy',
id: 'twórca',
masc: 'twórca', fem: 'twórczyni', neutr: 'twórcu',
mascPl: 'twórcy', femPl: 'twórczynie', neutrPl: 'twórcy',
}),
],
dukajDeclension: new NounDeclension({

View File

@ -165,8 +165,8 @@ nouns:
z wyszczególnieniem ich formy męskiej, żeńskiej i nijakiej.
Podane wzory odmiany są normatywne, na podstawie słów z tymi samymi końcówkami.
examples: 'Przykłady'
dictionary: 'Słownik neutratywów'
approved: 'wpisów zatwierdzonych'
pending: 'oczekuje na moderację'

View File

@ -13,8 +13,16 @@
<NounsExtra/>
<details class="border mb-3" ref="dictionary">
<summary class="bg-light p-3" @click="loadNouns">
<h4 class="h5 d-inline">
<Icon v="book"/>
<T>nouns.dictionary</T>
</h4>
</summary>
<div class="border-top">
<Loading :value="nounsRaw">
<section v-if="$admin()">
<section v-if="$admin()" class="px-3">
<div class="alert alert-info">
<strong>{{ nounsCountApproved() }}</strong> <T>nouns.approved</T>,
<strong>{{ nounsCountPending() }}</strong> <T>nouns.pending</T>.
@ -169,12 +177,16 @@
</tbody>
</table>
</section>
</Loading>
<Separator icon="plus"/>
<div class="px-3">
<NounSubmitForm ref="form"/>
</div>
</Loading>
</div>
</details>
</div>
</template>
<script>
@ -193,9 +205,6 @@
},
mounted() {
if (process.client) {
this.$axios.$get(`/nouns/all`, { headers: this.$auth() }).then(data => {
this.nounsRaw = data;
});
if (window.location.hash) {
const anchor = decodeURIComponent(window.location.hash.substr(1));
this.$nextTick(_ => {
@ -204,10 +213,12 @@
$anchor.scrollIntoView();
} else {
this.filter = anchor;
this.$refs.filter.focus();
this.$refs.filter.scrollIntoView();
this.loadNouns();
this.$refs.dictionary.open = true;
this.$refs.dictionary.focus();
this.$refs.dictionary.scrollIntoView();
setTimeout(_ => {
this.$refs.filter.scrollIntoView();
this.$refs.dictionary.scrollIntoView();
}, 1000);
}
})
@ -215,6 +226,12 @@
}
},
methods: {
async loadNouns() {
if (this.nounsRaw !== undefined) {
return;
}
this.nounsRaw = await this.$axios.$get(`/nouns/all`, { headers: this.$auth() });
},
edit(noun) {
this.$refs.form.edit(noun);
},