#23 pokazuj wszystkie przykłady dla form wymiennych
This commit is contained in:
parent
2d31a233ea
commit
41a7d29ac5
11
pages/_.vue
11
pages/_.vue
|
@ -50,8 +50,8 @@
|
|||
<Share :title="'Moje zaimki to: ' + selectedTemplate.name()"/>
|
||||
</section>
|
||||
|
||||
<section v-if="getTemplate(templates, selectedTemplate.name()) && getTemplate(templates, selectedTemplate.name()).sources.length">
|
||||
<Literature :sources="getTemplate(templates, selectedTemplate.name()).sources"/>
|
||||
<section v-if="sources.length">
|
||||
<Literature :sources="sources"/>
|
||||
</section>
|
||||
|
||||
<Separator icon="info"/>
|
||||
|
@ -67,7 +67,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { examples, templates } from "~/src/data";
|
||||
import { examples, templates, getSources } from "~/src/data";
|
||||
import { buildTemplate, getTemplate } from "../src/buildTemplate";
|
||||
|
||||
export default {
|
||||
|
@ -106,6 +106,11 @@
|
|||
],
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
sources() {
|
||||
return getSources(this.selectedTemplate);
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
@ -133,8 +133,8 @@
|
|||
<div class="card-footer" v-if="link">
|
||||
<LinkInput :link="link"/>
|
||||
</div>
|
||||
<div class="card-body border-top" v-if="getTemplate(templates, selectedTemplate.name()) && getTemplate(templates, selectedTemplate.name()).sources.length">
|
||||
<Literature :sources="getTemplate(templates, selectedTemplate.name()).sources"/>
|
||||
<div class="card-body border-top" v-if="sources.length">
|
||||
<Literature :sources="sources"/>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
@ -190,7 +190,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { examples, templates } from "~/src/data";
|
||||
import { examples, templates, getSources } from "~/src/data";
|
||||
import Compressor from "../src/compressor";
|
||||
import { getTemplate } from "../src/buildTemplate";
|
||||
|
||||
|
@ -251,6 +251,9 @@
|
|||
|
||||
return process.env.baseUrl + '/' + this.multiple.join('&');
|
||||
},
|
||||
sources() {
|
||||
return getSources(this.selectedTemplate);
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
toggleMultiple(name) {
|
||||
|
|
25
src/data.js
25
src/data.js
|
@ -1,6 +1,9 @@
|
|||
import { Source, Example } from './classes'
|
||||
import { buildDict, buildList } from './helpers';
|
||||
import { parseTemplates } from './buildTemplate';
|
||||
import { parseTemplates, getTemplate } from './buildTemplate';
|
||||
|
||||
import templatesRaw from '../data/templates.tsv';
|
||||
export const templates = parseTemplates(templatesRaw);
|
||||
|
||||
import examplesRaw from '../data/examples.tsv';
|
||||
export const examples = buildList(function* () {
|
||||
|
@ -32,7 +35,21 @@ export const sources = buildDict(function* () {
|
|||
}
|
||||
});
|
||||
|
||||
// TODO wymienne: jurewicz
|
||||
export const sourcesForMultipleForms = {
|
||||
'on&ona': ['jurewicz'],
|
||||
}
|
||||
|
||||
import templatesRaw from '../data/templates.tsv';
|
||||
export const templates = parseTemplates(templatesRaw);
|
||||
export const getSources = (selectedTemplate) => {
|
||||
if (!selectedTemplate) {
|
||||
return [];
|
||||
}
|
||||
|
||||
let sources = [];
|
||||
for (let option of selectedTemplate.nameOptions()) {
|
||||
const template = getTemplate(templates, option);
|
||||
if (template && template.sources.length) {
|
||||
sources = [...sources, ...template.sources];
|
||||
}
|
||||
}
|
||||
return sources;
|
||||
}
|
||||
|
|
Reference in New Issue