2020-10-24 12:50:08 -07:00
|
|
|
<template>
|
2020-12-11 11:37:04 -08:00
|
|
|
<MustLogin v-if="!$user()"/>
|
|
|
|
<div v-else>
|
2020-10-24 12:50:08 -07:00
|
|
|
<div class="mb-3 d-flex justify-content-between flex-column flex-md-row">
|
|
|
|
<h2 class="text-nowrap">
|
|
|
|
<Avatar :user="$user()"/>
|
|
|
|
@{{ $user().username }}
|
|
|
|
</h2>
|
|
|
|
<div>
|
|
|
|
<nuxt-link :to="`/@${$user().username}`" class="btn btn-outline-primary btn-sm">
|
|
|
|
<Icon v="id-card"/>
|
|
|
|
<T>profile.show</T>
|
|
|
|
</nuxt-link>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<form @submit.prevent="save" :class="[saving ? 'saving' : '']">
|
2021-08-11 03:23:29 -07:00
|
|
|
<div v-if="$isGranted()" class="border border-primary rounded p-4">
|
2021-01-12 11:06:59 -08:00
|
|
|
<h3 class="h4 mb-3">
|
|
|
|
<Icon v="user-cog"/>
|
|
|
|
Admin section
|
|
|
|
</h3>
|
|
|
|
|
|
|
|
<p class="small text-muted mb-0">
|
|
|
|
This will be shown on the “Team” page.
|
|
|
|
If you leave it empty, you won't show up there (for this language version).
|
|
|
|
You can use a different display name in different language versions.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<div class="form-group">
|
|
|
|
<label for="teamName">Team page display name:</label>
|
|
|
|
<input class="form-control" name="teamName" maxlength="36" v-model="teamName"/>
|
2021-12-14 09:38:53 -08:00
|
|
|
<PropagateCheckbox field="teamName" :before="beforeChanges.teamName" :after="teamName" v-if="otherProfiles > 0" @change="propagateChanged"/>
|
2021-01-12 11:06:59 -08:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<hr/>
|
|
|
|
|
|
|
|
<p class="small text-muted mb-0">
|
|
|
|
If you feel that you've contributed to this language version enough to get credited in the footer
|
|
|
|
(not saying how much that is, that's on you to decide 😉),
|
|
|
|
then add your name and areas here (in the local language!).
|
|
|
|
The team as a whole will be credited in the footer either way.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<div class="form-group">
|
|
|
|
<label for="footerName">Footer display name:</label>
|
|
|
|
<input class="form-control" name="footerName" maxlength="36" v-model="footerName"/>
|
2021-12-14 09:38:53 -08:00
|
|
|
<PropagateCheckbox field="footerName" :before="beforeChanges.footerName" :after="footerName" v-if="otherProfiles > 0" @change="propagateChanged"/>
|
2021-01-12 11:06:59 -08:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="form-group">
|
|
|
|
<label for="footerAreas">Areas responsible for / contributing to:</label>
|
|
|
|
<ListInput v-model="footerAreas"/>
|
|
|
|
</div>
|
2021-08-26 05:25:59 -07:00
|
|
|
|
|
|
|
<template v-if="$te('contact.team.credentials')">
|
|
|
|
<hr/>
|
|
|
|
|
|
|
|
<p class="small text-muted mb-0">
|
|
|
|
This will be displayed on the team page in the "Credentials" section.
|
|
|
|
You might want to put here your full legal name here, but it's not required
|
|
|
|
(you can leave this field empty).
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<div class="form-group">
|
|
|
|
<label for="credentials">Credentials:</label>
|
|
|
|
<ListInput v-model="credentials"/>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="form-group">
|
|
|
|
<label for="credentials">Credentials level:</label>
|
|
|
|
<select v-model="credentialsLevel" class="form-select">
|
|
|
|
<option :value="null"></option>
|
|
|
|
<option :value="1">Higher education, but irrelevant field</option>
|
|
|
|
<option :value="2">Bachelor (not completed yet)</option>
|
|
|
|
<option :value="3">Bachelor</option>
|
|
|
|
<option :value="4">Master (not completed yet)</option>
|
|
|
|
<option :value="5">Master</option>
|
|
|
|
<option :value="6">PhD (not completed yet)</option>
|
|
|
|
<option :value="7">PhD</option>
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="form-group">
|
|
|
|
<label for="credentials">Name for credentials:</label>
|
|
|
|
<input v-model="credentialsName" class="form-control" placeholder="(not required)"/>
|
|
|
|
</div>
|
|
|
|
</template>
|
2021-01-12 11:06:59 -08:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<section>
|
|
|
|
<OpinionLegend/>
|
|
|
|
</section>
|
|
|
|
|
2021-08-28 12:52:08 -07:00
|
|
|
<section class="form-group">
|
2020-10-24 12:50:08 -07:00
|
|
|
<h3 class="h4">
|
|
|
|
<Icon v="signature"/>
|
|
|
|
<T>profile.names</T>
|
|
|
|
</h3>
|
|
|
|
<OpinionListInput v-model="names"/>
|
2021-12-14 09:38:53 -08:00
|
|
|
<PropagateCheckbox field="names" :before="beforeChanges.names" :after="names" v-if="otherProfiles > 0" @change="propagateChanged"/>
|
2021-08-28 12:52:08 -07:00
|
|
|
</section>
|
2020-10-24 12:50:08 -07:00
|
|
|
|
2021-08-28 12:52:08 -07:00
|
|
|
<section class="form-group">
|
2020-10-24 12:50:08 -07:00
|
|
|
<h3 class="h4">
|
2022-03-31 08:21:32 -07:00
|
|
|
<Icon v="tags"/>
|
2020-10-24 12:50:08 -07:00
|
|
|
<T>profile.pronouns</T>
|
|
|
|
</h3>
|
2021-08-29 01:40:37 -07:00
|
|
|
<div class="alert alert-info">
|
|
|
|
<p class="small mb-0">
|
|
|
|
<Icon v="info-circle"/>
|
|
|
|
<T>profile.pronounsInfo</T>
|
|
|
|
</p>
|
|
|
|
</div>
|
2020-11-05 05:06:47 -08:00
|
|
|
<OpinionListInput v-model="pronouns" :validation="validatePronoun"/>
|
2021-08-28 12:52:08 -07:00
|
|
|
</section>
|
2020-10-24 12:50:08 -07:00
|
|
|
|
2021-08-28 12:52:08 -07:00
|
|
|
<section class="form-group">
|
2020-10-24 12:50:08 -07:00
|
|
|
<h3 class="h4">
|
|
|
|
<Icon v="comment-edit"/>
|
|
|
|
<T>profile.description</T>
|
|
|
|
</h3>
|
2021-11-23 05:30:51 -08:00
|
|
|
<textarea class="form-control form-control-sm" v-model="description" maxlength="256" rows="8"/>
|
2021-08-28 12:52:08 -07:00
|
|
|
</section>
|
2020-10-24 12:50:08 -07:00
|
|
|
|
2021-08-28 12:52:08 -07:00
|
|
|
<section class="form-group">
|
2020-10-26 16:42:42 -07:00
|
|
|
<h3 class="h4">
|
|
|
|
<Icon v="flag"/>
|
|
|
|
<T>profile.flags</T>
|
|
|
|
</h3>
|
|
|
|
<p class="small text-muted mb-0">
|
|
|
|
<T>profile.flagsInfo</T>
|
|
|
|
</p>
|
|
|
|
<ButtonList v-model="flags" :options="allFlags" v-slot="s">
|
2022-05-07 13:52:18 -07:00
|
|
|
<Flag
|
|
|
|
:name="s.desc.split('|')[0]"
|
|
|
|
:alt="s.desc.split('|')[1]"
|
|
|
|
:img="`/flags/${s.v}.png`"
|
|
|
|
:asterisk="flagsAsterisk.includes(s.v)"
|
|
|
|
/>
|
2020-10-26 16:42:42 -07:00
|
|
|
</ButtonList>
|
2021-12-14 09:38:53 -08:00
|
|
|
<PropagateCheckbox field="flags" :before="beforeChanges.flags" :after="flags" v-if="otherProfiles > 0" @change="propagateChanged"/>
|
2020-10-26 16:42:42 -07:00
|
|
|
|
2021-08-28 12:52:08 -07:00
|
|
|
<details class="form-group border rounded" :open="Object.keys(customFlags).length > 0">
|
|
|
|
<summary class="px-3 py-2">
|
|
|
|
<T>profile.flagsCustom</T>
|
|
|
|
</summary>
|
|
|
|
<div class="border-top">
|
|
|
|
<ImageWidgetRich v-model="customFlags" sizes="flag"/>
|
|
|
|
</div>
|
|
|
|
</details>
|
2021-12-14 09:38:53 -08:00
|
|
|
<PropagateCheckbox field="customFlags" :before="beforeChanges.customFlags" :after="customFlags" v-if="otherProfiles > 0" @change="propagateChanged"/>
|
2021-08-28 12:52:08 -07:00
|
|
|
<Answer question="flags" small/>
|
|
|
|
</section>
|
2021-04-08 05:37:31 -07:00
|
|
|
|
2021-08-28 12:52:08 -07:00
|
|
|
<section class="form-group">
|
2020-10-24 12:50:08 -07:00
|
|
|
<h3 class="h4">
|
|
|
|
<Icon v="link"/>
|
|
|
|
<T>profile.links</T>
|
|
|
|
</h3>
|
|
|
|
<ListInput v-model="links" v-slot="s">
|
2021-08-24 13:53:08 -07:00
|
|
|
<input v-model="s.val" type="url" class="form-control" @keyup="s.update(s.val)" @paste="s.update(s.val)" @change="s.update(s.val)" required/>
|
2020-10-24 12:50:08 -07:00
|
|
|
</ListInput>
|
2021-12-14 09:38:53 -08:00
|
|
|
<PropagateCheckbox field="links" :before="beforeChanges.links" :after="links" v-if="otherProfiles > 0" @change="propagateChanged"/>
|
2021-06-27 03:16:14 -07:00
|
|
|
<p class="small text-muted mb-0">
|
|
|
|
<Icon v="ad"/>
|
2021-12-05 01:00:08 -08:00
|
|
|
<T>profile.linksRecommended</T>
|
2021-06-27 03:16:14 -07:00
|
|
|
<a v-for="provider in recommendedLinkProviders()" :href="provider.homepage" target="_blank" rel="noopener">
|
|
|
|
<Icon :v="provider.icon" :set="provider.iconSet || 'l'"/>
|
|
|
|
{{ provider.name }}
|
|
|
|
</a>
|
2021-12-05 01:00:08 -08:00
|
|
|
<T silent>profile.linksRecommendedAfter</T>
|
2021-06-27 03:16:14 -07:00
|
|
|
😉
|
|
|
|
</p>
|
2022-05-04 18:01:53 -07:00
|
|
|
<p v-if="$te('profile.linksWarning')" class="small text-muted mt-2 mb-0">
|
|
|
|
<Icon v="exclamation-triangle"/>
|
|
|
|
<T>profile.linksWarning</T>
|
|
|
|
</p>
|
2021-08-28 12:52:08 -07:00
|
|
|
</section>
|
2020-10-24 12:50:08 -07:00
|
|
|
|
2021-08-28 12:52:08 -07:00
|
|
|
<section class="form-group">
|
2020-10-24 12:50:08 -07:00
|
|
|
<h3 class="h4">
|
|
|
|
<Icon v="birthday-cake"/>
|
|
|
|
<T>profile.birthday</T>
|
2021-12-11 01:55:32 -08:00
|
|
|
<button type="button" class="btn btn-outline-danger btn-sm" v-if="birthday !== null" @click="birthday = null">
|
|
|
|
<Icon v="times"/>
|
|
|
|
<T>crud.remove</T>
|
|
|
|
</button>
|
2020-10-24 12:50:08 -07:00
|
|
|
</h3>
|
2021-12-11 01:55:32 -08:00
|
|
|
<p class="small text-muted">
|
2020-10-24 12:50:08 -07:00
|
|
|
<T>profile.birthdayInfo</T>
|
|
|
|
</p>
|
2021-05-21 08:31:09 -07:00
|
|
|
<div class="input-group mb-3">
|
2021-12-11 01:55:32 -08:00
|
|
|
<datepicker v-model="birthday" inline :disabled-dates="disabledDates" initial-view="year"/>
|
2021-05-21 08:31:09 -07:00
|
|
|
</div>
|
2021-12-14 09:38:53 -08:00
|
|
|
<PropagateCheckbox field="birthday" :before="beforeChanges.birthday" :after="birthday" v-if="otherProfiles > 0" @change="propagateChanged"/>
|
2021-08-28 12:52:08 -07:00
|
|
|
</section>
|
2020-10-24 12:50:08 -07:00
|
|
|
|
2021-08-28 12:52:08 -07:00
|
|
|
<section class="form-group">
|
2021-11-15 11:55:59 -08:00
|
|
|
<div class="h4 d-flex justify-content-between">
|
|
|
|
<h3 class="h4">
|
|
|
|
<Icon v="scroll-old"/>
|
|
|
|
<T>profile.words</T>
|
|
|
|
</h3>
|
2021-11-22 00:57:22 -08:00
|
|
|
<button type="button" class="btn btn-outline-warning btn-sm" @click.prevent="resetWords">
|
2021-11-15 11:55:59 -08:00
|
|
|
<T>profile.editor.defaults</T>
|
|
|
|
</button>
|
|
|
|
</div>
|
2020-10-24 12:50:08 -07:00
|
|
|
<template v-for="i in [0, 1, 2, 3]">
|
|
|
|
<h4 class="h5">
|
|
|
|
<T>profile.column</T> {{i + 1}}
|
|
|
|
</h4>
|
2020-10-25 04:30:55 -07:00
|
|
|
<OpinionListInput v-model="words[i]" group="words"/>
|
2020-10-24 12:50:08 -07:00
|
|
|
</template>
|
2021-08-28 12:52:08 -07:00
|
|
|
</section>
|
2020-10-24 12:50:08 -07:00
|
|
|
|
2021-08-28 12:52:08 -07:00
|
|
|
<section>
|
|
|
|
<button class="btn btn-primary w-100" type="submit">
|
|
|
|
<Icon v="save"/>
|
|
|
|
<T>profile.editor.save</T>
|
|
|
|
</button>
|
|
|
|
</section>
|
2020-10-24 12:50:08 -07:00
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2020-12-08 15:04:42 -08:00
|
|
|
import {head, dictToList, listToDict, buildList, buildDict} from "../src/helpers";
|
2020-11-10 15:47:44 -08:00
|
|
|
import { pronouns } from "~/src/data";
|
|
|
|
import { buildPronoun } from "../src/buildPronoun";
|
2020-10-24 13:58:34 -07:00
|
|
|
import config from '../data/config.suml';
|
2021-06-27 03:16:14 -07:00
|
|
|
import link from '../plugins/link';
|
2021-12-11 01:55:32 -08:00
|
|
|
import {minBirthdate, maxBirthdate, formatDate} from '../src/birthdate';
|
2020-10-24 13:58:34 -07:00
|
|
|
|
2020-10-28 08:22:29 -07:00
|
|
|
const defaultWords = config.profile.defaultWords.map(c => buildList(function* () {
|
2020-10-24 13:58:34 -07:00
|
|
|
for (let word of c) {
|
|
|
|
yield {key: word, value: 0};
|
|
|
|
}
|
|
|
|
}))
|
2020-10-24 12:50:08 -07:00
|
|
|
|
2021-12-14 09:38:53 -08:00
|
|
|
const buildProfile = (profiles, currentLocale) => {
|
|
|
|
for (let locale in profiles) {
|
|
|
|
if (!profiles.hasOwnProperty(locale)) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (locale === currentLocale) {
|
|
|
|
const profile = profiles[locale];
|
|
|
|
return {
|
|
|
|
names: dictToList(profile.names),
|
|
|
|
pronouns: dictToList(profile.pronouns),
|
|
|
|
description: profile.description,
|
|
|
|
birthday: profile.birthday,
|
|
|
|
links: Object.keys(profile.links).length ? profile.links : [],
|
|
|
|
flags: profile.flags,
|
|
|
|
customFlags: profile.customFlags,
|
|
|
|
words: profile.words.map(x => dictToList(x)),
|
|
|
|
teamName: profile.teamName,
|
|
|
|
footerName: profile.footerName,
|
|
|
|
footerAreas: profile.footerAreas,
|
|
|
|
credentials: profile.credentials,
|
|
|
|
credentialsLevel: profile.credentialsLevel,
|
|
|
|
credentialsName: profile.credentialsName,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (let locale in profiles) {
|
|
|
|
if (!profiles.hasOwnProperty(locale)) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
const profile = profiles[locale];
|
|
|
|
return {
|
|
|
|
names: dictToList(profile.names),
|
|
|
|
pronouns: [],
|
|
|
|
description: '',
|
|
|
|
birthday: profile.birthday,
|
|
|
|
links: Object.keys(profile.links).length ? profile.links : [],
|
|
|
|
flags: profile.flags.filter(f => !f.startsWith('-')),
|
|
|
|
customFlags: profile.customFlags,
|
|
|
|
words: [...defaultWords],
|
|
|
|
teamName: profile.teamName,
|
|
|
|
footerName: profile.footerName,
|
|
|
|
footerAreas: [],
|
|
|
|
credentials: [],
|
|
|
|
credentialsLevel: null,
|
|
|
|
credentialsName: null,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
|
|
names: [],
|
|
|
|
pronouns: [],
|
|
|
|
description: '',
|
|
|
|
birthday: null,
|
|
|
|
links: [],
|
|
|
|
flags: [],
|
|
|
|
customFlags: {},
|
|
|
|
words: [...defaultWords],
|
|
|
|
teamName: '',
|
|
|
|
footerName: '',
|
|
|
|
footerAreas: [],
|
|
|
|
credentials: [],
|
|
|
|
credentialsLevel: null,
|
|
|
|
credentialsName: null,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2020-10-24 12:50:08 -07:00
|
|
|
export default {
|
2021-06-27 03:16:14 -07:00
|
|
|
mixins: [link],
|
2020-10-24 12:50:08 -07:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
saving: false,
|
2021-12-11 01:55:32 -08:00
|
|
|
disabledDates: {
|
|
|
|
to: minBirthdate,
|
|
|
|
from: maxBirthdate,
|
|
|
|
},
|
2021-12-14 09:38:53 -08:00
|
|
|
propagate: [],
|
2022-05-07 13:52:18 -07:00
|
|
|
flagsAsterisk: process.env.FLAGS_ASTERISK,
|
2020-10-24 12:50:08 -07:00
|
|
|
};
|
|
|
|
},
|
|
|
|
async asyncData({ app, store }) {
|
|
|
|
if (!store.state.user) {
|
|
|
|
return {};
|
|
|
|
}
|
|
|
|
|
2021-07-24 05:54:15 -07:00
|
|
|
const profiles = (await app.$axios.$get(`/profile/get/${encodeURIComponent(store.state.user.username)}`, { headers: {
|
2020-10-24 12:50:08 -07:00
|
|
|
authorization: 'Bearer ' + store.state.token,
|
2021-07-24 05:54:15 -07:00
|
|
|
} })).profiles;
|
2020-10-24 12:50:08 -07:00
|
|
|
|
2021-12-14 09:38:53 -08:00
|
|
|
const profile = buildProfile(profiles, app.context.env.LOCALE);
|
2020-10-24 12:50:08 -07:00
|
|
|
|
|
|
|
return {
|
2021-12-14 09:38:53 -08:00
|
|
|
...profile,
|
|
|
|
beforeChanges: JSON.parse(JSON.stringify(profile)),
|
|
|
|
otherProfiles: Object.keys(profiles).filter(l => l !== app.context.env.LOCALE).length,
|
2020-10-24 12:50:08 -07:00
|
|
|
};
|
|
|
|
},
|
2020-12-11 11:37:04 -08:00
|
|
|
mounted() {
|
|
|
|
if (process.client && !this.$user()) {
|
|
|
|
window.sessionStorage.setItem('after-login', window.location.pathname);
|
|
|
|
this.$router.push('/' + this.config.user.route);
|
|
|
|
}
|
|
|
|
},
|
2020-10-24 12:50:08 -07:00
|
|
|
methods: {
|
|
|
|
async save() {
|
|
|
|
this.saving = true;
|
2021-06-09 09:06:32 -07:00
|
|
|
try {
|
|
|
|
await this.$post(`/profile/save`, {
|
|
|
|
names: listToDict(this.names),
|
|
|
|
pronouns: listToDict(this.pronouns),
|
|
|
|
description: this.description,
|
2021-12-14 00:11:24 -08:00
|
|
|
birthday: formatDate(this.birthday),
|
2021-06-09 09:06:32 -07:00
|
|
|
links: [...this.links],
|
|
|
|
flags: [...this.flags],
|
|
|
|
customFlags: {...this.customFlags},
|
|
|
|
words: this.words.map(x => listToDict(x)),
|
2021-12-14 09:38:53 -08:00
|
|
|
|
2021-06-09 09:06:32 -07:00
|
|
|
teamName: this.teamName,
|
|
|
|
footerName: this.footerName,
|
|
|
|
footerAreas: this.footerAreas,
|
2021-08-26 05:25:59 -07:00
|
|
|
credentials: this.credentials,
|
|
|
|
credentialsLevel: this.credentialsLevel,
|
|
|
|
credentialsName: this.credentialsName,
|
2021-12-14 09:38:53 -08:00
|
|
|
|
|
|
|
propagate: this.propagate,
|
2021-06-09 09:06:32 -07:00
|
|
|
});
|
|
|
|
this.$router.push(`/@${this.$user().username}`);
|
|
|
|
} finally {
|
|
|
|
this.saving = false;
|
|
|
|
}
|
2020-10-24 12:50:08 -07:00
|
|
|
},
|
2020-12-08 14:14:40 -08:00
|
|
|
normalisePronoun(pronoun) {
|
2021-03-09 07:36:17 -08:00
|
|
|
return decodeURIComponent(
|
2020-11-24 15:54:02 -08:00
|
|
|
pronoun
|
2020-12-04 14:26:59 -08:00
|
|
|
.toLowerCase()
|
2020-12-05 13:01:12 -08:00
|
|
|
.trim()
|
2020-11-24 15:54:02 -08:00
|
|
|
.replace(new RegExp('^' + this.$base), '')
|
|
|
|
.replace(new RegExp('^' + this.$base.replace(/^https?:\/\//, '')), '')
|
|
|
|
.replace(new RegExp('^/'), '')
|
|
|
|
);
|
2021-03-09 07:36:17 -08:00
|
|
|
},
|
|
|
|
normaliseAndBuildPronoun(pronoun) {
|
|
|
|
return buildPronoun(pronouns, this.normalisePronoun(pronoun));
|
2020-12-08 14:14:40 -08:00
|
|
|
},
|
|
|
|
validatePronoun(pronoun) {
|
2021-03-09 07:36:17 -08:00
|
|
|
pronoun = this.normalisePronoun(pronoun);
|
2021-09-28 12:34:25 -07:00
|
|
|
return pronoun === this.config.pronouns.any
|
2021-12-23 03:36:54 -08:00
|
|
|
|| pronoun.startsWith(this.config.pronouns.any + ':')
|
2021-09-28 12:34:25 -07:00
|
|
|
|| (this.config.pronouns.null && this.config.pronouns.null.routes && this.config.pronouns.null.routes.includes(pronoun))
|
2021-11-30 09:50:38 -08:00
|
|
|
|| (this.config.pronouns.mirror && this.config.pronouns.mirror.route === pronoun)
|
2021-09-28 12:34:25 -07:00
|
|
|
|| buildPronoun(pronouns, pronoun)
|
|
|
|
? null
|
|
|
|
: 'profile.pronounsNotFound'
|
2020-12-08 14:14:40 -08:00
|
|
|
},
|
2021-11-15 11:55:59 -08:00
|
|
|
async resetWords() {
|
|
|
|
await this.$confirm();
|
|
|
|
|
|
|
|
this.words = [...defaultWords];
|
2021-12-14 09:38:53 -08:00
|
|
|
},
|
|
|
|
propagateChanged(field, checked) {
|
|
|
|
this.propagate = this.propagate.filter(f => f !== field);
|
|
|
|
if (checked) {
|
|
|
|
this.propagate.push(field);
|
|
|
|
}
|
|
|
|
},
|
2020-12-08 14:14:40 -08:00
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
mainPronoun() {
|
|
|
|
let mainPronoun = buildPronoun(pronouns, this.config.profile.flags.defaultPronoun);
|
|
|
|
let mainOpinion = -1;
|
|
|
|
for (let {key: pronoun, value: opinion} of this.pronouns) {
|
|
|
|
if (opinion === 2) {
|
|
|
|
opinion = 0.5;
|
|
|
|
}
|
|
|
|
if (opinion > mainOpinion) {
|
2021-03-09 07:36:17 -08:00
|
|
|
const p = this.normaliseAndBuildPronoun(pronoun);
|
2020-12-08 14:14:40 -08:00
|
|
|
if (p) {
|
|
|
|
mainPronoun = p;
|
|
|
|
mainOpinion = opinion;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return mainPronoun;
|
2020-11-05 05:06:47 -08:00
|
|
|
},
|
2020-12-08 15:04:42 -08:00
|
|
|
allFlags() {
|
|
|
|
const that = this;
|
|
|
|
const flags = buildList(function*() {
|
|
|
|
for (let key in process.env.FLAGS) {
|
|
|
|
if (!process.env.FLAGS.hasOwnProperty(key)) { continue; }
|
2020-12-10 08:47:48 -08:00
|
|
|
yield [
|
|
|
|
key,
|
|
|
|
(key.startsWith('-') ? process.env.FLAGS[key] : that.$translateForPronoun(process.env.FLAGS[key], that.mainPronoun))
|
|
|
|
+ '|' + process.env.FLAGS[key]
|
|
|
|
];
|
2020-12-08 15:04:42 -08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
flags.sort((a, b) => a[1].localeCompare(b[1]));
|
|
|
|
|
|
|
|
return buildDict(function *() {
|
|
|
|
for (let [key, display] of flags) {
|
|
|
|
yield [key, display];
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
2020-10-24 12:50:08 -07:00
|
|
|
},
|
|
|
|
head() {
|
|
|
|
return head({
|
|
|
|
title: this.$t('profile.editor.header'),
|
|
|
|
});
|
|
|
|
},
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.avatar {
|
|
|
|
width: 100%;
|
|
|
|
max-width: 5rem;
|
|
|
|
max-height: 5rem;
|
|
|
|
}
|
|
|
|
.saving {
|
|
|
|
opacity: .5;
|
|
|
|
}
|
2021-08-28 12:52:08 -07:00
|
|
|
section.form-group {
|
|
|
|
margin-bottom: 5rem;
|
|
|
|
}
|
2020-10-24 12:50:08 -07:00
|
|
|
</style>
|