2020-07-22 13:19:23 -07:00
|
|
|
|
<template>
|
2020-11-29 02:03:01 -08:00
|
|
|
|
<div>
|
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>
|
|
|
|
|
|
2021-08-12 00:56:21 -07:00
|
|
|
|
<SourcesChart :sources="sources" label="all pronouns"/>
|
|
|
|
|
|
2021-08-07 01:18:48 -07:00
|
|
|
|
<Loading :value="sourceLibrary" size="5rem"><template v-if="sourceLibrary !== undefined">
|
|
|
|
|
|
2021-06-16 09:13:56 -07:00
|
|
|
|
<section v-show="config.sources.submit">
|
2021-03-24 06:43:24 -07:00
|
|
|
|
<SourceSubmitForm v-show="submitShown" ref="form"/>
|
|
|
|
|
<button v-show="!submitShown" class="btn btn-outline-success w-100" @click="submitShown = true">
|
2020-10-31 06:54:56 -07:00
|
|
|
|
<Icon v="plus-circle"/>
|
|
|
|
|
<T>sources.submit.header</T>
|
|
|
|
|
</button>
|
|
|
|
|
</section>
|
|
|
|
|
|
2020-07-24 05:14:37 -07:00
|
|
|
|
<section>
|
2021-01-22 14:54:24 -08:00
|
|
|
|
<button v-if="!tocShown" class="btn btn-outline-primary w-100" @click="tocShown = true">
|
2020-09-08 09:10:04 -07:00
|
|
|
|
<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">
|
2020-11-10 15:47:44 -08:00
|
|
|
|
<li v-for="[group, groupPronouns] in pronounLibrary.split(filterPronoun, false)" v-if="groupPronouns.length" class="list-group-item">
|
2020-09-08 09:10:04 -07:00
|
|
|
|
<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">
|
2020-12-06 07:12:32 -08:00
|
|
|
|
<li v-for="pronoun in groupPronouns" :key="pronoun.canonicalName" v-if="config.sources.mergePronouns[pronoun.canonicalName] === undefined">
|
2020-11-10 15:47:44 -08:00
|
|
|
|
<a v-if="typeof pronoun === 'string'" :href="'#' + toId(pronoun)">
|
|
|
|
|
<strong>{{ pronoun.replace(/&/g, glue) }}</strong>
|
2020-09-08 09:10:04 -07:00
|
|
|
|
</a>
|
2020-11-10 15:47:44 -08:00
|
|
|
|
<a v-else :href="'#' + toId(pronoun.name(glue))">
|
|
|
|
|
<strong>{{ pronoun.name(glue) }}</strong>
|
2020-09-08 09:10:04 -07:00
|
|
|
|
–
|
2020-11-10 15:47:44 -08:00
|
|
|
|
<small>{{ pronoun.description }}</small>
|
2020-09-08 09:10:04 -07:00
|
|
|
|
</a>
|
2020-11-10 15:47:44 -08:00
|
|
|
|
<NormativeBadge v-if="pronoun.normative"/>
|
2020-09-08 09:10:04 -07:00
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
|
|
|
|
</li>
|
2020-12-04 13:09:57 -08:00
|
|
|
|
<li class="list-group-item" v-if="sourceLibrary.multiple.length">
|
|
|
|
|
<p class="h5 mb-0">
|
|
|
|
|
<a :href="'#' + $t('pronouns.alt.raw')">
|
|
|
|
|
<strong><T>pronouns.alt.header</T></strong>
|
|
|
|
|
</a>
|
|
|
|
|
</p>
|
|
|
|
|
</li>
|
2020-12-05 11:54:36 -08:00
|
|
|
|
<li class="list-group-item" v-if="sourceLibrary.getForPronoun('', pronounLibrary)">
|
2020-09-08 09:10:04 -07:00
|
|
|
|
<p class="h5 mb-0">
|
2020-11-10 15:47:44 -08:00
|
|
|
|
<a :href="'#' + $t('pronouns.othersRaw')">
|
|
|
|
|
<strong><T>pronouns.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-12-30 15:03:30 -08:00
|
|
|
|
<section v-if="$isGranted('sources')" class="px-3">
|
2020-12-05 11:37:10 -08:00
|
|
|
|
<div class="alert alert-info">
|
|
|
|
|
<strong>{{ sourceLibrary.countApproved }}</strong> <T>nouns.approved</T>,
|
|
|
|
|
<a href="#" @click.prevent="filter='__awaiting__'">
|
|
|
|
|
<strong>{{ sourceLibrary.countPending }}</strong> <T>nouns.pending</T>.
|
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
</section>
|
|
|
|
|
|
2022-04-06 04:52:14 -07:00
|
|
|
|
<ModerationRules type="rulesSources" emphasise/>
|
|
|
|
|
|
2020-11-09 12:41:52 -08:00
|
|
|
|
<section class="sticky-top bg-white">
|
|
|
|
|
<div class="input-group mb-1 bg-white">
|
2021-01-22 14:54:24 -08:00
|
|
|
|
<span class="input-group-text">
|
|
|
|
|
<Icon v="filter"/>
|
|
|
|
|
</span>
|
2020-11-09 12:41:52 -08:00
|
|
|
|
<input class="form-control border-primary" v-model="filter" :placeholder="$t('crud.filterLong')" ref="filter"/>
|
2021-01-22 14:54:24 -08:00
|
|
|
|
<button v-if="filter" class="btn btn-outline-danger" @click="filter = ''; $refs.filter.focus()">
|
|
|
|
|
<Icon v="times"/>
|
|
|
|
|
</button>
|
2020-08-25 01:41:38 -07:00
|
|
|
|
</div>
|
2020-11-09 12:41:52 -08:00
|
|
|
|
|
2021-01-22 14:54:24 -08:00
|
|
|
|
<div class="btn-group w-100">
|
2020-11-09 12:41:52 -08:00
|
|
|
|
<button v-for="(icon, type) in sourceTypes"
|
|
|
|
|
:class="['btn btn-sm', type === filterType ? 'btn-primary' : 'btn-outline-primary']"
|
|
|
|
|
@click="filterType = type"
|
|
|
|
|
>
|
|
|
|
|
<Icon :v="icon"/>
|
|
|
|
|
<span class="d-none d-md-inline">
|
2020-09-28 08:51:26 -07:00
|
|
|
|
<T>sources.type.{{type || 'All'}}</T>
|
2020-11-09 12:41:52 -08:00
|
|
|
|
</span>
|
|
|
|
|
</button>
|
2020-07-27 10:06:41 -07:00
|
|
|
|
</div>
|
|
|
|
|
</section>
|
|
|
|
|
|
2020-12-06 07:12:32 -08:00
|
|
|
|
<section v-for="pronoun in pronouns" v-if="config.sources.mergePronouns[pronoun.canonicalName] === undefined && sourceLibrary.getForPronoun(pronoun.canonicalName).length">
|
2020-12-10 07:23:39 -08:00
|
|
|
|
<SourceList :sources="sourceLibrary.getForPronoun(pronoun.canonicalName)" :pronoun="pronoun" :filter="filter" :filterType="filterType" manage @edit-source="edit">
|
2020-11-10 15:47:44 -08:00
|
|
|
|
<h2 class="h4" :id="toId(pronoun.name(glue))">
|
2020-12-03 10:42:55 -08:00
|
|
|
|
<nuxt-link :to="'/' + pronoun.canonicalName">
|
2020-11-10 15:47:44 -08:00
|
|
|
|
{{ pronoun.description }}
|
|
|
|
|
<small>({{ pronoun.name(glue) }})</small>
|
2020-11-09 12:41:52 -08:00
|
|
|
|
</nuxt-link>
|
|
|
|
|
</h2>
|
|
|
|
|
</SourceList>
|
2020-07-25 10:21:52 -07:00
|
|
|
|
</section>
|
|
|
|
|
|
2020-12-04 13:09:57 -08:00
|
|
|
|
<a :id="$t('pronouns.alt.raw')"/>
|
|
|
|
|
<section v-for="multiple in sourceLibrary.multiple" v-if="sourceLibrary.getForPronoun(multiple).length">
|
2020-12-05 11:37:10 -08:00
|
|
|
|
<SourceList :sources="sourceLibrary.getForPronoun(multiple)" :filter="filter" :filterType="filterType" manage @edit-source="edit">
|
2020-11-09 12:41:52 -08:00
|
|
|
|
<h2 class="h4" :id="toId(multiple)">
|
|
|
|
|
<nuxt-link :to="'/' + multiple">
|
2020-11-10 15:47:44 -08:00
|
|
|
|
<T>pronouns.alt.header</T>
|
2020-12-04 03:24:12 -08:00
|
|
|
|
<small>({{ multiple.replace(/&/g, glue) }})</small>
|
2020-11-09 12:41:52 -08:00
|
|
|
|
</nuxt-link>
|
|
|
|
|
</h2>
|
|
|
|
|
</SourceList>
|
2020-07-26 06:43:17 -07:00
|
|
|
|
</section>
|
|
|
|
|
|
2020-12-05 11:54:36 -08:00
|
|
|
|
<section v-if="sourceLibrary.getForPronoun('', pronounLibrary)">
|
|
|
|
|
<SourceList :sources="sourceLibrary.getForPronoun('', pronounLibrary)" :filter="filter" :filterType="filterType" manage @edit-source="edit">
|
2020-11-10 15:47:44 -08:00
|
|
|
|
<h2 class="h4" :id="$t('pronouns.othersRaw')">
|
|
|
|
|
<T>pronouns.others</T>
|
2020-11-09 12:41:52 -08:00
|
|
|
|
</h2>
|
|
|
|
|
</SourceList>
|
2020-07-25 10:21:52 -07:00
|
|
|
|
</section>
|
2021-08-07 01:18:48 -07:00
|
|
|
|
|
|
|
|
|
</template></Loading>
|
2020-07-22 13:19:23 -07:00
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2020-12-04 13:09:57 -08:00
|
|
|
|
import { pronouns, pronounLibrary } from '../src/data'
|
|
|
|
|
import { Source, SourceLibrary } from "../src/classes";
|
2020-09-23 12:29:55 -07:00
|
|
|
|
import { head } from "../src/helpers";
|
2020-12-17 13:18:18 -08:00
|
|
|
|
import hash from "../plugins/hash";
|
2020-07-22 13:19:23 -07:00
|
|
|
|
|
|
|
|
|
export default {
|
2020-12-17 13:18:18 -08:00
|
|
|
|
mixins: [ hash ],
|
2020-07-22 13:19:23 -07:00
|
|
|
|
data() {
|
|
|
|
|
return {
|
2020-11-10 15:47:44 -08:00
|
|
|
|
pronouns,
|
|
|
|
|
pronounLibrary,
|
2020-09-08 09:10:04 -07:00
|
|
|
|
tocShown: false,
|
2020-07-27 10:06:41 -07:00
|
|
|
|
sourceTypes: Source.TYPES,
|
|
|
|
|
filter: '',
|
2020-11-09 12:41:52 -08:00
|
|
|
|
filterType: '',
|
2020-11-10 15:47:44 -08:00
|
|
|
|
glue: ' ' + this.$t('pronouns.or') + ' ',
|
2020-10-31 06:54:56 -07:00
|
|
|
|
submitShown: false,
|
2021-08-07 01:18:48 -07:00
|
|
|
|
sources: undefined,
|
|
|
|
|
sourceLibrary: undefined,
|
2020-07-22 13:19:23 -07:00
|
|
|
|
};
|
|
|
|
|
},
|
2021-08-07 01:18:48 -07:00
|
|
|
|
async mounted() {
|
|
|
|
|
if (!process.client) { return; }
|
|
|
|
|
|
2020-12-17 13:18:18 -08:00
|
|
|
|
this.handleHash('', filter => {
|
|
|
|
|
this.filter = filter;
|
2021-07-14 06:46:30 -07:00
|
|
|
|
if (filter) {
|
|
|
|
|
this.$refs.filter.scrollIntoView();
|
|
|
|
|
}
|
2020-12-17 13:18:18 -08:00
|
|
|
|
});
|
2021-08-07 01:18:48 -07:00
|
|
|
|
this.sources = await this.$axios.$get(`/sources`);
|
|
|
|
|
this.sourceLibrary = new SourceLibrary(this.sources);
|
2020-07-28 10:04:43 -07:00
|
|
|
|
},
|
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'),
|
2021-12-23 08:56:27 -08:00
|
|
|
|
description: this.$t('sources.subheader'),
|
2020-09-23 12:29:55 -07:00
|
|
|
|
});
|
2020-07-22 13:19:23 -07:00
|
|
|
|
},
|
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
|
|
|
|
},
|
2020-12-04 13:09:57 -08:00
|
|
|
|
filterPronoun(pronoun) {
|
2021-08-07 01:18:48 -07:00
|
|
|
|
if (this.sourceLibrary === undefined) { return false; }
|
2020-12-04 13:09:57 -08:00
|
|
|
|
return this.sourceLibrary.getForPronoun(pronoun.canonicalName).length > 0;
|
|
|
|
|
},
|
2020-12-05 11:37:10 -08:00
|
|
|
|
edit(source) {
|
|
|
|
|
this.submitShown = true;
|
2021-03-24 06:43:24 -07:00
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
this.$refs.form.edit(source)
|
|
|
|
|
});
|
2020-12-05 11:37:10 -08:00
|
|
|
|
}
|
2020-07-26 06:43:17 -07:00
|
|
|
|
},
|
2020-12-07 10:10:14 -08:00
|
|
|
|
watch: {
|
|
|
|
|
filter() {
|
2020-12-17 13:18:18 -08:00
|
|
|
|
this.setHash('', this.filter);
|
2020-12-07 10:10:14 -08:00
|
|
|
|
}
|
|
|
|
|
},
|
2020-07-22 13:19:23 -07:00
|
|
|
|
}
|
|
|
|
|
</script>
|