2020-07-22 13:19:23 -07:00
|
|
|
|
<template>
|
|
|
|
|
<div class="container">
|
2020-09-11 03:17:29 -07:00
|
|
|
|
<h2>
|
2020-07-22 13:19:23 -07:00
|
|
|
|
<Icon v="books"/>
|
2020-09-28 08:51:26 -07:00
|
|
|
|
<T>sources.headerLonger</T>
|
2020-09-11 03:17:29 -07:00
|
|
|
|
</h2>
|
2020-07-22 13:19:23 -07:00
|
|
|
|
|
2020-10-10 02:33:01 -07:00
|
|
|
|
<p v-if="$t('sources.subheader')">
|
|
|
|
|
<em><T>sources.subheader</T></em>
|
|
|
|
|
</p>
|
|
|
|
|
|
2020-07-24 07:15:28 -07:00
|
|
|
|
<section>
|
2020-09-28 08:51:26 -07:00
|
|
|
|
<Share :title="$t('sources.headerLonger')"/>
|
2020-07-24 07:15:28 -07:00
|
|
|
|
</section>
|
|
|
|
|
|
2020-07-24 05:14:37 -07:00
|
|
|
|
<section>
|
2020-09-08 09:10:04 -07:00
|
|
|
|
<button v-if="!tocShown" class="btn btn-outline-primary btn-block" @click="tocShown = true">
|
|
|
|
|
<Icon v="list"/>
|
2020-09-28 08:51:26 -07:00
|
|
|
|
<T>sources.toc</T>
|
2020-09-08 09:10:04 -07:00
|
|
|
|
</button>
|
|
|
|
|
<ul v-if="tocShown" class="list-group">
|
|
|
|
|
<li v-for="[group, groupTemplates] in templateLibrary.split(filterTemplate, false)" class="list-group-item">
|
|
|
|
|
<p class="h5">
|
|
|
|
|
{{ group.name }}
|
|
|
|
|
</p>
|
|
|
|
|
<div class="small my-1" v-if="group.description">
|
|
|
|
|
<Icon v="info-circle"/>
|
2020-09-16 13:23:28 -07:00
|
|
|
|
<em v-html="group.description"></em>
|
2020-09-08 09:10:04 -07:00
|
|
|
|
</div>
|
|
|
|
|
<ul class="list-unstyled">
|
|
|
|
|
<li v-for="template in groupTemplates" :key="template.canonicalName">
|
|
|
|
|
<a v-if="typeof template === 'string'" :href="'#' + toId(template)">
|
2020-09-28 08:51:26 -07:00
|
|
|
|
<strong>{{ template.replace(/&/g, glue) }}</strong>
|
2020-09-08 09:10:04 -07:00
|
|
|
|
</a>
|
2020-09-28 08:51:26 -07:00
|
|
|
|
<a v-else :href="'#' + toId(template.name(glue))">
|
|
|
|
|
<strong>{{ template.name(glue) }}</strong>
|
2020-09-08 09:10:04 -07:00
|
|
|
|
–
|
|
|
|
|
<small>{{ template.description }}</small>
|
|
|
|
|
</a>
|
2020-09-16 14:40:29 -07:00
|
|
|
|
<NormativeBadge v-if="template.normative"/>
|
2020-09-08 09:10:04 -07:00
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
|
|
|
|
</li>
|
|
|
|
|
<li class="list-group-item">
|
|
|
|
|
<p class="h5 mb-0">
|
2020-09-28 08:51:26 -07:00
|
|
|
|
<a :href="'#' + $t('template.othersRaw')">
|
|
|
|
|
<strong><T>template.others</T></strong>
|
2020-09-08 09:10:04 -07:00
|
|
|
|
</a>
|
|
|
|
|
</p>
|
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
2020-07-24 05:14:37 -07:00
|
|
|
|
</section>
|
|
|
|
|
|
2020-07-27 10:06:41 -07:00
|
|
|
|
<section>
|
|
|
|
|
<span class="mr-2 mb-3">
|
|
|
|
|
<Icon v="filter"/>
|
2020-09-28 08:51:26 -07:00
|
|
|
|
<T>crud.filter</T>:
|
2020-07-27 10:06:41 -07:00
|
|
|
|
</span>
|
2020-08-25 01:41:38 -07:00
|
|
|
|
<div class="d-inline-block d-md-none">
|
|
|
|
|
<div class="btn-group-vertical">
|
2020-09-28 08:51:26 -07:00
|
|
|
|
<button v-for="(icon, type) in sourceTypes"
|
2020-08-25 01:41:38 -07:00
|
|
|
|
:class="['btn', type === filter ? 'btn-primary' : 'btn-outline-primary']"
|
|
|
|
|
@click="filter = type"
|
|
|
|
|
>
|
2020-09-28 08:51:26 -07:00
|
|
|
|
<Icon :v="icon"/>
|
|
|
|
|
<T>sources.type.{{type || 'All'}}</T>
|
2020-08-25 01:41:38 -07:00
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="d-none d-md-inline-block">
|
|
|
|
|
<div class="btn-group">
|
2020-09-28 08:51:26 -07:00
|
|
|
|
<button v-for="(icon, type) in sourceTypes"
|
2020-08-25 01:41:38 -07:00
|
|
|
|
:class="['btn', type === filter ? 'btn-primary' : 'btn-outline-primary']"
|
|
|
|
|
@click="filter = type"
|
|
|
|
|
>
|
2020-09-28 08:51:26 -07:00
|
|
|
|
<Icon :v="icon"/>
|
|
|
|
|
<T>sources.type.{{type || 'All'}}</T>
|
2020-08-25 01:41:38 -07:00
|
|
|
|
</button>
|
|
|
|
|
</div>
|
2020-07-27 10:06:41 -07:00
|
|
|
|
</div>
|
|
|
|
|
</section>
|
|
|
|
|
|
2020-07-25 10:21:52 -07:00
|
|
|
|
<section v-for="template in templates" v-if="template.sources.length">
|
2020-09-28 08:51:26 -07:00
|
|
|
|
<h2 class="h4" :id="toId(template.name(glue))">
|
2020-07-24 07:15:28 -07:00
|
|
|
|
<nuxt-link :to="'/' + template.pronoun()">
|
2020-07-22 13:19:23 -07:00
|
|
|
|
{{ template.description }}
|
2020-09-28 08:51:26 -07:00
|
|
|
|
<small>({{ template.name(glue) }})</small>
|
2020-07-24 07:15:28 -07:00
|
|
|
|
</nuxt-link>
|
|
|
|
|
</h2>
|
2020-07-22 13:19:23 -07:00
|
|
|
|
|
2020-07-24 07:15:28 -07:00
|
|
|
|
<ul class="list-unstyled">
|
|
|
|
|
<li v-for="source in template.sources">
|
2020-07-27 10:06:41 -07:00
|
|
|
|
<Source :name="source" :filter="filter"/>
|
2020-07-24 07:15:28 -07:00
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
2020-07-25 10:21:52 -07:00
|
|
|
|
</section>
|
|
|
|
|
|
2020-07-26 06:43:17 -07:00
|
|
|
|
<section v-for="(sources, multiple) in sourcesForMultipleForms">
|
|
|
|
|
<h2 class="h4" :id="toId(multiple)">
|
|
|
|
|
<nuxt-link :to="'/' + multiple">
|
2020-09-28 08:51:26 -07:00
|
|
|
|
<T>template.alt.header</T>
|
2020-07-26 06:43:17 -07:00
|
|
|
|
<small>({{ multiple.replace(/&/g, ' lub ') }})</small>
|
|
|
|
|
</nuxt-link>
|
|
|
|
|
</h2>
|
|
|
|
|
|
|
|
|
|
<ul class="list-unstyled">
|
|
|
|
|
<li v-for="source in sources">
|
2020-07-27 10:06:41 -07:00
|
|
|
|
<Source :name="source" :filter="filter"/>
|
2020-07-26 06:43:17 -07:00
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
|
|
|
|
</section>
|
|
|
|
|
|
2020-07-25 10:21:52 -07:00
|
|
|
|
<section>
|
2020-09-28 08:51:26 -07:00
|
|
|
|
<h2 class="h4" :id="$t('template.othersRaw')">
|
|
|
|
|
<T>template.others</T>
|
2020-07-25 10:21:52 -07:00
|
|
|
|
</h2>
|
|
|
|
|
|
|
|
|
|
<ul class="list-unstyled">
|
|
|
|
|
<li v-for="source in otherSources">
|
2020-07-27 10:06:41 -07:00
|
|
|
|
<Source :name="source" :filter="filter"/>
|
2020-07-25 10:21:52 -07:00
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
|
|
|
|
</section>
|
2020-07-22 13:19:23 -07:00
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2020-10-08 11:08:51 -07:00
|
|
|
|
import { templates, sources, templateLibrary } from '../src/data'
|
2020-10-12 06:49:33 -07:00
|
|
|
|
import sourcesForMultipleForms from '../data/sources/sourcesMultiple';
|
2020-07-27 10:06:41 -07:00
|
|
|
|
import { Source } from "../src/classes";
|
2020-09-23 12:29:55 -07:00
|
|
|
|
import { head } from "../src/helpers";
|
2020-07-22 13:19:23 -07:00
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
2020-07-25 10:21:52 -07:00
|
|
|
|
templates: templates,
|
2020-07-26 06:43:17 -07:00
|
|
|
|
sourcesForMultipleForms: sourcesForMultipleForms,
|
2020-09-08 09:10:04 -07:00
|
|
|
|
templateLibrary: templateLibrary,
|
|
|
|
|
tocShown: false,
|
2020-07-27 10:06:41 -07:00
|
|
|
|
sourceTypes: Source.TYPES,
|
|
|
|
|
filter: '',
|
2020-09-28 08:51:26 -07:00
|
|
|
|
glue: ' ' + this.$t('template.or') + ' ',
|
2020-07-22 13:19:23 -07:00
|
|
|
|
};
|
|
|
|
|
},
|
2020-07-28 10:04:43 -07:00
|
|
|
|
mounted() {
|
|
|
|
|
if (process.client && window.location.hash) {
|
|
|
|
|
const $hashEl = this.$el.querySelector(window.location.hash);
|
|
|
|
|
if ($hashEl) {
|
|
|
|
|
$hashEl.scrollIntoView();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
2020-07-22 13:19:23 -07:00
|
|
|
|
head() {
|
2020-09-23 12:29:55 -07:00
|
|
|
|
return head({
|
2020-09-28 10:22:36 -07:00
|
|
|
|
title: this.$t('sources.headerLonger'),
|
2020-09-23 12:29:55 -07:00
|
|
|
|
});
|
2020-07-22 13:19:23 -07:00
|
|
|
|
},
|
2020-07-25 10:21:52 -07:00
|
|
|
|
computed: {
|
|
|
|
|
otherSources() {
|
|
|
|
|
const other = new Set(Object.keys(sources));
|
|
|
|
|
for (let template of Object.values(this.templates)) {
|
|
|
|
|
for (let source of template.sources) {
|
|
|
|
|
other.delete(source);
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-07-26 06:43:17 -07:00
|
|
|
|
for (let sources of Object.values(this.sourcesForMultipleForms)) {
|
|
|
|
|
for (let source of sources) {
|
|
|
|
|
other.delete(source);
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-07-25 10:21:52 -07:00
|
|
|
|
return other;
|
|
|
|
|
},
|
|
|
|
|
},
|
2020-07-26 06:43:17 -07:00
|
|
|
|
methods: {
|
|
|
|
|
toId(str) {
|
|
|
|
|
return str.replace(/\//g, '-').replace(/&/g, '_');
|
2020-09-08 09:10:04 -07:00
|
|
|
|
},
|
|
|
|
|
filterTemplate(t) {
|
|
|
|
|
if (typeof t === 'string') {
|
|
|
|
|
return Object.keys(sourcesForMultipleForms).includes(t);
|
|
|
|
|
}
|
|
|
|
|
return t.sources.length;
|
2020-07-26 06:43:17 -07:00
|
|
|
|
}
|
|
|
|
|
},
|
2020-07-22 13:19:23 -07:00
|
|
|
|
}
|
|
|
|
|
</script>
|