mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-23 12:43:48 -04:00
#26 filtrowanie przykładów po typie
This commit is contained in:
parent
c5b7e25c4f
commit
0c2e1b35bf
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div v-show="!filter || filter === source.type">
|
||||||
<Icon :v="source.icon()"/>
|
<Icon :v="source.icon()"/>
|
||||||
<strong>{{source.author}}<span v-if="source.author"> – </span><em><a v-if="source.link" :href="source.link" target="_blank" rel="noopener">{{source.title}}</a><span v-else>{{source.title}}</span></em></strong><template v-if="source.extra"> ({{source.extra}})</template>, {{source.year}}<template v-if="source.comment">; {{source.comment}}</template>
|
<strong>{{source.author}}<span v-if="source.author"> – </span><em><a v-if="source.link" :href="source.link" target="_blank" rel="noopener">{{source.title}}</a><span v-else>{{source.title}}</span></em></strong><template v-if="source.extra"> ({{source.extra}})</template>, {{source.year}}<template v-if="source.comment">; {{source.comment}}</template>
|
||||||
<ul v-if="source.fragments.length">
|
<ul v-if="source.fragments.length">
|
||||||
@ -16,6 +16,7 @@
|
|||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
name: { required: true },
|
name: { required: true },
|
||||||
|
filter: { default: '' },
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -34,6 +34,22 @@
|
|||||||
<Share title="Niebinarna polszczyzna w literaturze, prasie, filmach i serialach"/>
|
<Share title="Niebinarna polszczyzna w literaturze, prasie, filmach i serialach"/>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<span class="mr-2 mb-3">
|
||||||
|
<Icon v="filter"/>
|
||||||
|
Filtruj:
|
||||||
|
</span>
|
||||||
|
<div class="btn-group">
|
||||||
|
<button v-for="(config, type) in sourceTypes"
|
||||||
|
:class="['btn', type === filter ? 'btn-primary' : 'btn-outline-primary']"
|
||||||
|
@click="filter = type"
|
||||||
|
>
|
||||||
|
<Icon :v="config.icon"/>
|
||||||
|
{{ config.text }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
<section v-for="template in templates" v-if="template.sources.length">
|
<section v-for="template in templates" v-if="template.sources.length">
|
||||||
<h2 class="h4" :id="toId(template.name())">
|
<h2 class="h4" :id="toId(template.name())">
|
||||||
<nuxt-link :to="'/' + template.pronoun()">
|
<nuxt-link :to="'/' + template.pronoun()">
|
||||||
@ -44,7 +60,7 @@
|
|||||||
|
|
||||||
<ul class="list-unstyled">
|
<ul class="list-unstyled">
|
||||||
<li v-for="source in template.sources">
|
<li v-for="source in template.sources">
|
||||||
<Source :name="source"/>
|
<Source :name="source" :filter="filter"/>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
@ -59,7 +75,7 @@
|
|||||||
|
|
||||||
<ul class="list-unstyled">
|
<ul class="list-unstyled">
|
||||||
<li v-for="source in sources">
|
<li v-for="source in sources">
|
||||||
<Source :name="source"/>
|
<Source :name="source" :filter="filter"/>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
@ -71,7 +87,7 @@
|
|||||||
|
|
||||||
<ul class="list-unstyled">
|
<ul class="list-unstyled">
|
||||||
<li v-for="source in otherSources">
|
<li v-for="source in otherSources">
|
||||||
<Source :name="source"/>
|
<Source :name="source" :filter="filter"/>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
@ -80,12 +96,15 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { templates, sources, sourcesForMultipleForms } from '../src/data'
|
import { templates, sources, sourcesForMultipleForms } from '../src/data'
|
||||||
|
import { Source } from "../src/classes";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
templates: templates,
|
templates: templates,
|
||||||
sourcesForMultipleForms: sourcesForMultipleForms,
|
sourcesForMultipleForms: sourcesForMultipleForms,
|
||||||
|
sourceTypes: Source.TYPES,
|
||||||
|
filter: '',
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
head() {
|
head() {
|
||||||
|
@ -63,13 +63,6 @@ function clone(mainObject) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class Source {
|
export class Source {
|
||||||
ICONS = {
|
|
||||||
Book: 'book-open',
|
|
||||||
Article: 'newspaper',
|
|
||||||
Movie: 'film',
|
|
||||||
Series: 'tv',
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor (type, author, title, extra, year, fragments = [], comment = null, link = null) {
|
constructor (type, author, title, extra, year, fragments = [], comment = null, link = null) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.author = author;
|
this.author = author;
|
||||||
@ -81,8 +74,18 @@ export class Source {
|
|||||||
this.link = link;
|
this.link = link;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static get TYPES() {
|
||||||
|
return {
|
||||||
|
'': { icon: 'clipboard-list', text: 'Wszystkie' },
|
||||||
|
Book: { icon: 'book-open', text: 'Książki' },
|
||||||
|
Article: { icon:'newspaper', text: 'Prasa' },
|
||||||
|
// Movie: { icon:'film', text: 'Filmy' },
|
||||||
|
Series: { icon:'tv', text: 'Seriale' },
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
icon() {
|
icon() {
|
||||||
return this.ICONS[this.type] || 'horizontal-rule';
|
return Source.TYPES[this.type].icon;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user