2020-07-22 13:19:23 -07:00
|
|
|
|
<template>
|
|
|
|
|
<div class="container">
|
2020-09-24 12:38:15 -07:00
|
|
|
|
<h2>
|
|
|
|
|
<Icon v="tags"/>
|
2020-09-28 08:51:26 -07:00
|
|
|
|
<T>home.why</T>
|
2020-09-24 12:38:15 -07:00
|
|
|
|
</h2>
|
|
|
|
|
|
2020-07-22 13:19:23 -07:00
|
|
|
|
<section>
|
2020-09-28 08:51:26 -07:00
|
|
|
|
<T>home.about</T>
|
2020-09-24 12:38:15 -07:00
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
<section>
|
|
|
|
|
<Share/>
|
2020-07-22 13:19:23 -07:00
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
<Separator icon="link"/>
|
|
|
|
|
|
|
|
|
|
<section>
|
2020-09-24 12:38:15 -07:00
|
|
|
|
<h2>
|
|
|
|
|
<Icon v="tags"/>
|
2020-09-28 08:51:26 -07:00
|
|
|
|
<T>home.templates</T>
|
2020-09-24 12:38:15 -07:00
|
|
|
|
</h2>
|
|
|
|
|
|
|
|
|
|
<ul class="list-group mt-4">
|
2020-09-08 09:10:04 -07:00
|
|
|
|
<li v-for="[group, groupTemplates] in templateLibrary.split()" 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">
|
|
|
|
|
<nuxt-link v-if="typeof template === 'string'" :to="'/' + template">
|
2020-09-28 08:51:26 -07:00
|
|
|
|
<strong>{{template.replace(/&/g, ' ' + $t('template.or') + ' ')}}</strong>
|
2020-09-08 09:10:04 -07:00
|
|
|
|
</nuxt-link>
|
|
|
|
|
<nuxt-link v-else :to="addSlash('/' + template.canonicalName)">
|
2020-09-28 08:51:26 -07:00
|
|
|
|
<strong>{{template.name(glue)}}</strong>
|
2020-09-08 09:10:04 -07:00
|
|
|
|
–
|
|
|
|
|
<small>{{template.description}}</small>
|
|
|
|
|
</nuxt-link>
|
2020-09-16 14:40:29 -07:00
|
|
|
|
<NormativeBadge v-if="template.normative"/>
|
2020-09-08 09:10:04 -07:00
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
2020-08-11 00:22:09 -07:00
|
|
|
|
</li>
|
2020-09-08 15:10:31 -07:00
|
|
|
|
<li class="list-group-item">
|
|
|
|
|
<a v-if="!customiseMultiple" href="#" @click.prevent="customiseMultiple = true" class="btn btn-outline-primary btn-block">
|
|
|
|
|
<Icon v="sliders-h-square"/>
|
2020-09-28 08:51:26 -07:00
|
|
|
|
<T>template.alt.button</T>
|
2020-09-08 15:10:31 -07:00
|
|
|
|
</a>
|
|
|
|
|
<div v-else class="card">
|
|
|
|
|
<div class="card-header">
|
|
|
|
|
<Icon v="sliders-h-square"/>
|
2020-09-28 08:51:26 -07:00
|
|
|
|
<T>template.alt.header</T>:
|
2020-09-08 15:10:31 -07:00
|
|
|
|
</div>
|
|
|
|
|
<div class="card-body">
|
|
|
|
|
<div class="card-title">
|
|
|
|
|
<ul class="list-inline d-inline mb-0">
|
|
|
|
|
<li class="list-inline-item" v-for="(template, pronoun) in templates">
|
|
|
|
|
<button :class="['btn', multiple.includes(pronoun) ? 'btn-primary' : 'btn-outline-primary', 'btn-sm', 'my-1']"
|
|
|
|
|
@click="toggleMultiple(pronoun)"
|
|
|
|
|
>
|
|
|
|
|
{{template.name()}}
|
|
|
|
|
</button>
|
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="card-footer" v-if="linkMultiple">
|
|
|
|
|
<LinkInput :link="linkMultiple"/>
|
|
|
|
|
</div>
|
2020-07-22 13:19:23 -07:00
|
|
|
|
</div>
|
2020-09-08 15:10:31 -07:00
|
|
|
|
</li>
|
|
|
|
|
<li class="list-group-item">
|
|
|
|
|
<p class="h5">
|
2020-09-28 08:51:26 -07:00
|
|
|
|
<T>home.generator.header</T>
|
2020-09-08 15:10:31 -07:00
|
|
|
|
</p>
|
2020-07-22 13:19:23 -07:00
|
|
|
|
<p>
|
2020-09-28 08:51:26 -07:00
|
|
|
|
<T>home.generator.description</T>
|
2020-07-22 13:19:23 -07:00
|
|
|
|
</p>
|
2020-09-08 15:10:31 -07:00
|
|
|
|
<a v-if="!customise" href="#" @click.prevent="customise = true" class="btn btn-outline-primary btn-block">
|
|
|
|
|
<Icon v="sliders-h-square"/>
|
2020-09-28 08:51:26 -07:00
|
|
|
|
<T>home.generator.button</T>
|
2020-09-08 15:10:31 -07:00
|
|
|
|
</a>
|
|
|
|
|
<div v-else class="card mb-5">
|
|
|
|
|
<div class="card-header">
|
|
|
|
|
<Icon v="sliders-h-square"/>
|
2020-09-28 08:51:26 -07:00
|
|
|
|
<T>home.generator.header2</T>
|
2020-09-08 15:10:31 -07:00
|
|
|
|
</div>
|
|
|
|
|
<div class="card-body">
|
|
|
|
|
<div class="card-title border-bottom pb-3">
|
|
|
|
|
<ul class="list-inline d-inline mb-0">
|
|
|
|
|
<li class="list-inline-item pt-1 h5">
|
2020-09-28 08:51:26 -07:00
|
|
|
|
<T>home.generator.base</T>:
|
2020-09-08 15:10:31 -07:00
|
|
|
|
</li>
|
|
|
|
|
<li class="list-inline-item" v-for="(template, pronoun) in templates">
|
2020-09-28 08:51:26 -07:00
|
|
|
|
<button :class="['btn', template.name(glue) === selectedTemplate.name(glue) ? 'btn-primary' : 'btn-outline-primary', 'btn-sm', 'my-1']"
|
2020-09-08 15:10:31 -07:00
|
|
|
|
@click="selectedTemplate = templates[pronoun].clone()"
|
|
|
|
|
>
|
2020-09-28 08:51:26 -07:00
|
|
|
|
{{template.name(glue)}}
|
2020-09-08 15:10:31 -07:00
|
|
|
|
</button>
|
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="alert alert-primary">
|
|
|
|
|
<p class="h3 mb-0 text-center">
|
2020-09-28 08:51:26 -07:00
|
|
|
|
{{ selectedTemplate.name(glue) }}
|
2020-09-08 15:10:31 -07:00
|
|
|
|
<br/>
|
|
|
|
|
<input v-model="selectedTemplate.description"
|
|
|
|
|
class="form-control form-input p-0 form-control-sm"
|
|
|
|
|
:size="selectedTemplate.description.length + 3"
|
|
|
|
|
maxlength="48"
|
|
|
|
|
/>
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<p>
|
2020-09-28 08:51:26 -07:00
|
|
|
|
<T>template.examples</T>:
|
2020-09-08 15:10:31 -07:00
|
|
|
|
</p>
|
|
|
|
|
<template v-for="isHonorific in [false, true]">
|
|
|
|
|
<ul>
|
|
|
|
|
<li v-for="example in examples" v-if="example.isHonorific === isHonorific">
|
2020-10-12 14:28:26 -07:00
|
|
|
|
<span v-for="part in example[(isHonorific ? selectedTemplate.isPluralHonorific() : selectedTemplate.isPlural()) ? 'pluralParts' : 'singularParts']">
|
2020-07-24 11:52:01 -07:00
|
|
|
|
<input v-if="part.variable" v-model="selectedTemplate.morphemes[part.str]"
|
|
|
|
|
:class="['form-control form-input p-0', {'active': selectedMorpheme === part.str}]"
|
|
|
|
|
:size="selectedTemplate.morphemes[part.str] ? selectedTemplate.morphemes[part.str].length : 0"
|
2020-07-26 05:52:01 -07:00
|
|
|
|
maxlength="12"
|
2020-07-24 11:52:01 -07:00
|
|
|
|
@focus="selectedMorpheme = part.str"
|
|
|
|
|
@blur="selectedMorpheme = ''"
|
|
|
|
|
/>
|
|
|
|
|
<span v-else>{{part.str}}</span>
|
|
|
|
|
</span>
|
2020-09-08 15:10:31 -07:00
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
|
|
|
|
<div class="my-3">
|
|
|
|
|
<div class="custom-control custom-switch" v-if="isHonorific">
|
2020-10-12 14:28:26 -07:00
|
|
|
|
<input type="checkbox" class="custom-control-input" id="pluralHonorific" v-model="selectedTemplate.pluralHonorific[0]">
|
2020-09-28 08:51:26 -07:00
|
|
|
|
<label class="custom-control-label" for="pluralHonorific"><T>template.plural</T> <Icon v="level-up"/></label>
|
2020-09-08 15:10:31 -07:00
|
|
|
|
</div>
|
|
|
|
|
<div class="custom-control custom-switch" v-else>
|
2020-10-12 14:28:26 -07:00
|
|
|
|
<input type="checkbox" class="custom-control-input" id="plural" v-model="selectedTemplate.plural[0]">
|
2020-09-28 08:51:26 -07:00
|
|
|
|
<label class="custom-control-label" for="plural"><T>template.plural</T> <Icon v="level-up"/></label>
|
2020-09-08 15:10:31 -07:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<p class="small">
|
|
|
|
|
<Icon v="info-circle"/>
|
2020-09-28 08:51:26 -07:00
|
|
|
|
<T>home.generator.alt</T>
|
2020-09-08 15:10:31 -07:00
|
|
|
|
</p>
|
|
|
|
|
<div class="alert alert-warning">
|
|
|
|
|
<p class="mb-0 small">
|
|
|
|
|
<Icon v="exclamation-triangle"/>
|
2020-09-28 08:51:26 -07:00
|
|
|
|
<T>beta</T>
|
2020-09-08 15:10:31 -07:00
|
|
|
|
</p>
|
2020-07-24 11:52:01 -07:00
|
|
|
|
</div>
|
2020-07-22 13:19:23 -07:00
|
|
|
|
</div>
|
2020-09-08 15:10:31 -07:00
|
|
|
|
<div class="card-footer" v-if="link">
|
|
|
|
|
<LinkInput :link="link"/>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="card-body border-top" v-if="Object.keys(sources).length">
|
|
|
|
|
<Literature :sources="sources"/>
|
|
|
|
|
</div>
|
2020-09-01 07:30:18 -07:00
|
|
|
|
</div>
|
2020-09-08 15:10:31 -07:00
|
|
|
|
</li>
|
2020-09-13 13:15:44 -07:00
|
|
|
|
<li class="list-group-item">
|
|
|
|
|
<p class="h5">
|
2020-09-28 10:22:36 -07:00
|
|
|
|
<nuxt-link :to="'/' + config.template.any.route"><T>template.any.header</T></nuxt-link>
|
2020-09-13 13:15:44 -07:00
|
|
|
|
</p>
|
|
|
|
|
<p>
|
2020-09-28 08:51:26 -07:00
|
|
|
|
<T>template.any.description</T>
|
2020-09-13 13:15:44 -07:00
|
|
|
|
</p>
|
|
|
|
|
</li>
|
2020-09-08 15:10:31 -07:00
|
|
|
|
</ul>
|
2020-07-22 13:19:23 -07:00
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
<Separator icon="bookmark"/>
|
|
|
|
|
|
|
|
|
|
<section>
|
2020-09-24 12:38:15 -07:00
|
|
|
|
<Links/>
|
|
|
|
|
<Media/>
|
|
|
|
|
<Socials/>
|
2020-07-22 13:19:23 -07:00
|
|
|
|
</section>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2020-09-08 09:10:04 -07:00
|
|
|
|
import { examples, templates, getSources, templateLibrary } from "~/src/data";
|
2020-07-22 13:19:23 -07:00
|
|
|
|
import Compressor from "../src/compressor";
|
2020-07-24 09:50:33 -07:00
|
|
|
|
import { getTemplate } from "../src/buildTemplate";
|
2020-10-12 06:49:33 -07:00
|
|
|
|
import MORPHEMES from '../data/templates/morphemes';
|
2020-07-22 13:19:23 -07:00
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
examples: examples,
|
|
|
|
|
templates: templates,
|
2020-07-24 09:50:33 -07:00
|
|
|
|
getTemplate: getTemplate,
|
2020-09-08 09:10:04 -07:00
|
|
|
|
templateLibrary: templateLibrary,
|
2020-07-22 13:19:23 -07:00
|
|
|
|
|
2020-09-28 11:28:00 -07:00
|
|
|
|
selectedTemplate: templates[this.config.template.default].clone(),
|
2020-07-22 13:19:23 -07:00
|
|
|
|
selectedMorpheme: '',
|
|
|
|
|
|
2020-07-26 05:52:01 -07:00
|
|
|
|
customiseMultiple: false,
|
2020-07-26 06:30:10 -07:00
|
|
|
|
multiple: ['on', 'ona'],
|
2020-07-26 05:52:01 -07:00
|
|
|
|
|
2020-07-22 13:19:23 -07:00
|
|
|
|
customise: false,
|
2020-09-28 08:51:26 -07:00
|
|
|
|
|
|
|
|
|
glue: ' ' + this.$t('template.or') + ' ',
|
2020-07-22 13:19:23 -07:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
computed: {
|
|
|
|
|
usedBase() {
|
2020-09-28 08:51:26 -07:00
|
|
|
|
const name = this.selectedTemplate.name(this.glue);
|
2020-07-24 09:50:33 -07:00
|
|
|
|
for (let key in this.templates) {
|
|
|
|
|
if (this.templates.hasOwnProperty(key)) {
|
|
|
|
|
if (key === name) {
|
|
|
|
|
return key;
|
|
|
|
|
}
|
|
|
|
|
for (let alias of this.templates[key].aliases) {
|
|
|
|
|
if (alias === name) {
|
|
|
|
|
return key;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
},
|
|
|
|
|
usedBaseEquals() {
|
2020-07-24 10:33:46 -07:00
|
|
|
|
return this.usedBase && this.templates[this.usedBase].equals(this.selectedTemplate);
|
2020-07-22 13:19:23 -07:00
|
|
|
|
},
|
|
|
|
|
longLink() {
|
2020-09-29 06:36:49 -07:00
|
|
|
|
const base = this.templates[this.selectedTemplate.morphemes[MORPHEMES[0]]];
|
2020-07-22 13:19:23 -07:00
|
|
|
|
|
|
|
|
|
return base
|
|
|
|
|
? Compressor.compress(this.selectedTemplate.toArray(), base.toArray()).join(',')
|
|
|
|
|
: this.selectedTemplate.toString();
|
|
|
|
|
},
|
|
|
|
|
link() {
|
|
|
|
|
if (!this.selectedTemplate.pronoun()) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
2020-10-13 12:49:08 -07:00
|
|
|
|
return this.addSlash(process.env.BASE_URL + '/' + (this.usedBaseEquals ? this.usedBase : this.longLink));
|
2020-07-22 13:19:23 -07:00
|
|
|
|
},
|
2020-07-26 05:52:01 -07:00
|
|
|
|
linkMultiple() {
|
|
|
|
|
if (!this.multiple.length) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
2020-10-13 12:49:08 -07:00
|
|
|
|
return this.addSlash(process.env.BASE_URL + '/' + this.multiple.join('&'));
|
2020-07-26 05:52:01 -07:00
|
|
|
|
},
|
2020-07-26 06:27:36 -07:00
|
|
|
|
sources() {
|
|
|
|
|
return getSources(this.selectedTemplate);
|
|
|
|
|
},
|
2020-07-26 05:52:01 -07:00
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
toggleMultiple(name) {
|
|
|
|
|
const index = this.multiple.indexOf(name);
|
|
|
|
|
if (index > -1) {
|
|
|
|
|
this.multiple.splice(index, 1);
|
|
|
|
|
} else {
|
|
|
|
|
this.multiple.push(name);
|
|
|
|
|
}
|
2020-08-03 05:54:43 -07:00
|
|
|
|
},
|
|
|
|
|
addSlash(link) {
|
|
|
|
|
return link + (link.substr(link.length - 1) === '*' ? '/' : '');
|
2020-10-05 05:57:17 -07:00
|
|
|
|
},
|
2020-07-22 13:19:23 -07:00
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss">
|
2020-09-28 10:22:36 -07:00
|
|
|
|
@import "../assets/style";
|
2020-07-22 13:19:23 -07:00
|
|
|
|
|
|
|
|
|
.form-input {
|
|
|
|
|
text-align: center;
|
|
|
|
|
&.active {
|
|
|
|
|
@include alert-variant(
|
|
|
|
|
theme-color-level('primary', $alert-bg-level),
|
|
|
|
|
theme-color-level('primary', $alert-border-level),
|
|
|
|
|
theme-color-level('primary', $alert-color-level)
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
&.form-control {
|
|
|
|
|
width: auto;
|
|
|
|
|
display: inline;
|
|
|
|
|
}
|
|
|
|
|
&[size="0"] {
|
|
|
|
|
width: .5rem !important;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-07-24 08:08:22 -07:00
|
|
|
|
|
|
|
|
|
@include media-breakpoint-up('md', $grid-breakpoints) {
|
|
|
|
|
.btn-md-lg {
|
|
|
|
|
@include button-size($btn-padding-y-lg, $btn-padding-x-lg, $btn-font-size-lg, $btn-line-height-lg, $btn-border-radius-lg);
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-07-22 13:19:23 -07:00
|
|
|
|
</style>
|