1
0
mirror of https://github.com/misskey-dev/misskey synced 2024-12-28 05:29:00 +09:00
misskey/src/web/app/desktop/views/components/profile-setting.vue

74 lines
1.9 KiB
Vue
Raw Normal View History

2018-02-12 23:17:08 +09:00
<template>
<div class="mk-profile-setting">
<label class="avatar ui from group">
2018-02-18 12:35:18 +09:00
<p>%i18n:desktop.tags.mk-profile-setting.avatar%</p><img class="avatar" :src="`${os.i.avatar_url}?thumbnail&size=64`" alt="avatar"/>
2018-02-12 23:17:08 +09:00
<button class="ui" @click="updateAvatar">%i18n:desktop.tags.mk-profile-setting.choice-avatar%</button>
</label>
<label class="ui from group">
<p>%i18n:desktop.tags.mk-profile-setting.name%</p>
<input v-model="name" type="text" class="ui"/>
</label>
<label class="ui from group">
<p>%i18n:desktop.tags.mk-profile-setting.location%</p>
<input v-model="location" type="text" class="ui"/>
</label>
<label class="ui from group">
<p>%i18n:desktop.tags.mk-profile-setting.description%</p>
<textarea v-model="description" class="ui"></textarea>
</label>
<label class="ui from group">
<p>%i18n:desktop.tags.mk-profile-setting.birthday%</p>
<input v-model="birthday" type="date" class="ui"/>
</label>
<button class="ui primary" @click="save">%i18n:desktop.tags.mk-profile-setting.save%</button>
</div>
</template>
<script lang="ts">
import Vue from 'vue';
import updateAvatar from '../../scripts/update-avatar';
import notify from '../../scripts/notify';
export default Vue.extend({
data() {
return {
2018-02-18 12:35:18 +09:00
name: (this as any).os.i.name,
location: (this as any).os.i.location,
description: (this as any).os.i.description,
birthday: (this as any).os.i.birthday,
2018-02-12 23:17:08 +09:00
};
},
methods: {
updateAvatar() {
2018-02-18 12:35:18 +09:00
updateAvatar((this as any).os.i);
2018-02-12 23:17:08 +09:00
},
save() {
2018-02-18 12:35:18 +09:00
(this as any).api('i/update', {
2018-02-12 23:17:08 +09:00
name: this.name,
location: this.location || null,
description: this.description || null,
birthday: this.birthday || null
}).then(() => {
notify('プロフィールを更新しました');
});
}
}
});
</script>
<style lang="stylus" scoped>
.mk-profile-setting
> .avatar
> img
display inline-block
vertical-align top
width 64px
height 64px
border-radius 4px
> button
margin-left 8px
</style>