2018-02-12 16:17:08 +02:00
|
|
|
<template>
|
2018-02-20 16:22:19 +02:00
|
|
|
<div class="profile">
|
2018-02-12 16:17:08 +02:00
|
|
|
<label class="avatar ui from group">
|
2018-04-14 19:04:40 +03:00
|
|
|
<p>%i18n:@avatar%</p>
|
2018-07-24 17:43:14 +03:00
|
|
|
<img class="avatar" :src="$store.state.i.avatarUrl" alt="avatar"/>
|
2018-04-14 19:04:40 +03:00
|
|
|
<button class="ui" @click="updateAvatar">%i18n:@choice-avatar%</button>
|
2018-02-12 16:17:08 +02:00
|
|
|
</label>
|
|
|
|
<label class="ui from group">
|
2018-09-28 18:48:02 +03:00
|
|
|
<ui-input v-model="name" type="text">%i18n:@name%</ui-input>
|
2018-02-12 16:17:08 +02:00
|
|
|
</label>
|
|
|
|
<label class="ui from group">
|
2018-09-28 18:48:02 +03:00
|
|
|
<ui-input v-model="location" type="text">%i18n:@location%</ui-input>
|
2018-02-12 16:17:08 +02:00
|
|
|
</label>
|
|
|
|
<label class="ui from group">
|
2018-09-28 18:48:02 +03:00
|
|
|
<ui-textarea v-model="description">%i18n:@description%</ui-textarea>
|
2018-02-12 16:17:08 +02:00
|
|
|
</label>
|
|
|
|
<label class="ui from group">
|
2018-04-14 19:04:40 +03:00
|
|
|
<p>%i18n:@birthday%</p>
|
2018-09-15 15:48:10 +03:00
|
|
|
<input type="date" v-model="birthday"/>
|
2018-02-12 16:17:08 +02:00
|
|
|
</label>
|
2018-09-28 18:48:02 +03:00
|
|
|
<ui-button primary @click="save">%i18n:@save%</ui-button>
|
2018-03-01 23:26:31 +02:00
|
|
|
<section>
|
2018-06-01 18:51:20 +03:00
|
|
|
<h2>%i18n:@locked-account%</h2>
|
2018-10-13 14:11:00 +03:00
|
|
|
<ui-switch v-model="isLocked" @change="save(false)">%i18n:@is-locked%</ui-switch>
|
|
|
|
<ui-switch v-model="carefulBot" @change="save(false)">%i18n:@careful-bot%</ui-switch>
|
2018-06-01 18:51:20 +03:00
|
|
|
</section>
|
|
|
|
<section>
|
|
|
|
<h2>%i18n:@other%</h2>
|
2018-10-13 14:11:00 +03:00
|
|
|
<ui-switch v-model="isBot" @change="save(false)">%i18n:@is-bot%</ui-switch>
|
|
|
|
<ui-switch v-model="isCat" @change="save(false)">%i18n:@is-cat%</ui-switch>
|
2018-09-27 06:55:10 +03:00
|
|
|
<ui-switch v-model="alwaysMarkNsfw">%i18n:common.always-mark-nsfw%</ui-switch>
|
2018-03-01 23:26:31 +02:00
|
|
|
</section>
|
2018-02-12 16:17:08 +02:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
|
|
|
|
|
|
|
export default Vue.extend({
|
|
|
|
data() {
|
|
|
|
return {
|
2018-02-20 16:22:19 +02:00
|
|
|
name: null,
|
|
|
|
location: null,
|
|
|
|
description: null,
|
|
|
|
birthday: null,
|
2018-10-13 14:11:00 +03:00
|
|
|
isBot: false,
|
|
|
|
isCat: false,
|
|
|
|
isLocked: false,
|
|
|
|
carefulBot: false,
|
2018-02-12 16:17:08 +02:00
|
|
|
};
|
|
|
|
},
|
2018-09-14 14:11:01 +03:00
|
|
|
computed: {
|
|
|
|
alwaysMarkNsfw: {
|
|
|
|
get() { return this.$store.state.i.settings.alwaysMarkNsfw; },
|
|
|
|
set(value) { (this as any).api('i/update', { alwaysMarkNsfw: value }); }
|
|
|
|
},
|
|
|
|
},
|
2018-02-20 16:22:19 +02:00
|
|
|
created() {
|
2018-05-27 07:49:09 +03:00
|
|
|
this.name = this.$store.state.i.name || '';
|
|
|
|
this.location = this.$store.state.i.profile.location;
|
|
|
|
this.description = this.$store.state.i.description;
|
|
|
|
this.birthday = this.$store.state.i.profile.birthday;
|
2018-10-13 14:11:00 +03:00
|
|
|
this.isCat = this.$store.state.i.isCat;
|
|
|
|
this.isBot = this.$store.state.i.isBot;
|
|
|
|
this.isLocked = this.$store.state.i.isLocked;
|
|
|
|
this.carefulBot = this.$store.state.i.carefulBot;
|
2018-02-20 16:22:19 +02:00
|
|
|
},
|
2018-02-12 16:17:08 +02:00
|
|
|
methods: {
|
|
|
|
updateAvatar() {
|
2018-02-20 22:55:19 +02:00
|
|
|
(this as any).apis.updateAvatar();
|
2018-02-12 16:17:08 +02:00
|
|
|
},
|
2018-10-13 14:11:00 +03:00
|
|
|
save(notify) {
|
2018-02-18 05:35:18 +02:00
|
|
|
(this as any).api('i/update', {
|
2018-04-05 19:36:34 +03:00
|
|
|
name: this.name || null,
|
2018-02-12 16:17:08 +02:00
|
|
|
location: this.location || null,
|
|
|
|
description: this.description || null,
|
2018-10-13 14:11:00 +03:00
|
|
|
birthday: this.birthday || null,
|
|
|
|
isCat: this.isCat,
|
|
|
|
isBot: this.isBot,
|
|
|
|
isLocked: this.isLocked,
|
|
|
|
carefulBot: this.carefulBot
|
2018-02-12 16:17:08 +02:00
|
|
|
}).then(() => {
|
2018-10-13 14:11:00 +03:00
|
|
|
if (notify) {
|
|
|
|
(this as any).apis.notify('%i18n:@profile-updated%');
|
|
|
|
}
|
2018-05-21 05:08:08 +03:00
|
|
|
});
|
2018-02-12 16:17:08 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="stylus" scoped>
|
2018-02-20 16:22:19 +02:00
|
|
|
.profile
|
2018-02-12 16:17:08 +02:00
|
|
|
> .avatar
|
|
|
|
> img
|
|
|
|
display inline-block
|
|
|
|
vertical-align top
|
|
|
|
width 64px
|
|
|
|
height 64px
|
|
|
|
border-radius 4px
|
|
|
|
|
|
|
|
> button
|
|
|
|
margin-left 8px
|
|
|
|
|
|
|
|
</style>
|
|
|
|
|