akkoma-fe/src/components/user_settings/user_settings.vue

136 lines
5.5 KiB
Vue
Raw Normal View History

<template>
<div class="settings panel panel-default">
<div class="panel-heading">
2017-11-07 14:14:37 +00:00
{{$t('settings.user_settings')}}
</div>
<div class="panel-body profile-edit">
<div class="setting-item">
2018-05-29 19:34:19 +00:00
<h2>{{$t('settings.name_bio')}}</h2>
2017-11-07 14:14:37 +00:00
<p>{{$t('settings.name')}}</p>
<input class='name-changer' id='username' v-model="newname"></input>
2017-11-07 14:14:37 +00:00
<p>{{$t('settings.bio')}}</p>
<textarea class="bio" v-model="newbio"></textarea>
<button :disabled='newname.length <= 0' class="btn btn-default" @click="updateProfile">{{$t('general.submit')}}</button>
</div>
<div class="setting-item">
2018-05-29 19:34:19 +00:00
<h2>{{$t('settings.avatar')}}</h2>
2017-11-07 14:14:37 +00:00
<p>{{$t('settings.current_avatar')}}</p>
<img :src="user.profile_image_url_original" class="old-avatar"></img>
2017-11-07 14:14:37 +00:00
<p>{{$t('settings.set_new_avatar')}}</p>
<img class="new-avatar" v-bind:src="previews[0]" v-if="previews[0]">
</img>
<div>
<input type="file" @change="uploadFile(0, $event)" ></input>
</div>
<i class="icon-spin4 animate-spin" v-if="uploading[0]"></i>
<button class="btn btn-default" v-else-if="previews[0]" @click="submitAvatar">{{$t('general.submit')}}</button>
</div>
<div class="setting-item">
2018-05-29 19:34:19 +00:00
<h2>{{$t('settings.profile_banner')}}</h2>
2017-11-07 14:14:37 +00:00
<p>{{$t('settings.current_profile_banner')}}</p>
<img :src="user.cover_photo" class="banner"></img>
2017-11-07 14:14:37 +00:00
<p>{{$t('settings.set_new_profile_banner')}}</p>
<img class="banner" v-bind:src="previews[1]" v-if="previews[1]">
</img>
<div>
<input type="file" @change="uploadFile(1, $event)" ></input>
</div>
<i class=" icon-spin4 animate-spin uploading" v-if="uploading[1]"></i>
<button class="btn btn-default" v-else-if="previews[1]" @click="submitBanner">{{$t('general.submit')}}</button>
</div>
<div class="setting-item">
2018-05-29 19:34:19 +00:00
<h2>{{$t('settings.profile_background')}}</h2>
2017-11-07 14:14:37 +00:00
<p>{{$t('settings.set_new_profile_background')}}</p>
<img class="bg" v-bind:src="previews[2]" v-if="previews[2]">
</img>
<div>
<input type="file" @change="uploadFile(2, $event)" ></input>
</div>
<i class=" icon-spin4 animate-spin uploading" v-if="uploading[2]"></i>
<button class="btn btn-default" v-else-if="previews[2]" @click="submitBg">{{$t('general.submit')}}</button>
</div>
2018-05-21 22:01:09 +00:00
<div class="setting-item">
2018-05-29 19:34:19 +00:00
<h2>{{$t('settings.change_password')}}</h2>
2018-05-21 22:01:09 +00:00
<div>
<p>{{$t('settings.current_password')}}</p>
<input type="password" v-model="changePasswordInputs[0]">
</div>
<div>
<p>{{$t('settings.new_password')}}</p>
<input type="password" v-model="changePasswordInputs[1]">
</div>
<div>
<p>{{$t('settings.confirm_new_password')}}</p>
<input type="password" v-model="changePasswordInputs[2]">
</div>
<button class="btn btn-default" @click="changePassword">{{$t('general.submit')}}</button>
<p v-if="changedPassword">{{$t('settings.changed_password')}}</p>
<p v-else-if="changePasswordError !== false">{{$t('settings.change_password_error')}}</p>
<p v-if="changePasswordError">{{changePasswordError}}</p>
</div>
2017-12-23 14:44:22 +00:00
<div class="setting-item" v-if="pleromaBackend">
2018-05-29 19:34:19 +00:00
<h2>{{$t('settings.follow_import')}}</h2>
2017-12-23 14:44:22 +00:00
<p>{{$t('settings.import_followers_from_a_csv_file')}}</p>
<form v-model="followImportForm">
<input type="file" ref="followlist" v-on:change="followListChange"></input>
</form>
<i class=" icon-spin4 animate-spin uploading" v-if="uploading[3]"></i>
<button class="btn btn-default" v-else @click="importFollows">{{$t('general.submit')}}</button>
2017-12-23 14:44:22 +00:00
<div v-if="followsImported">
<i class="icon-cross" @click="dismissImported"></i>
<p>{{$t('settings.follows_imported')}}</p>
</div>
<div v-else-if="followImportError">
2018-05-21 22:01:09 +00:00
<i class="icon-cross" @click="dismissImported"></i>
2017-12-23 14:44:22 +00:00
<p>{{$t('settings.follow_import_error')}}</p>
</div>
</div>
2018-05-13 23:47:08 +00:00
<div class="setting-item" v-if="enableFollowsExport">
2018-05-29 19:34:19 +00:00
<h2>{{$t('settings.follow_export')}}</h2>
<button class="btn btn-default" @click="exportFollows">{{$t('settings.follow_export_button')}}</button>
</div>
<div class="setting-item" v-else>
2018-05-29 19:34:19 +00:00
<h2>{{$t('settings.follow_export_processing')}}</h2>
</div>
<hr>
<div class="setting-item">
2018-05-29 19:34:19 +00:00
<h2>{{$t('settings.delete_account')}}</h2>
<p v-if="!deletingAccount">{{$t('settings.delete_account_description')}}</p>
<div v-if="deletingAccount">
<p>{{$t('settings.delete_account_instructions')}}</p>
<p>{{$t('login.password')}}</p>
<input type="password" v-model="deleteAccountConfirmPasswordInput">
<button class="btn btn-default" @click="deleteAccount">{{$t('settings.delete_account')}}</button>
</div>
<p v-if="deleteAccountError !== false">{{$t('settings.delete_account_error')}}</p>
<p v-if="deleteAccountError">{{deleteAccountError}}</p>
<button class="btn btn-default" v-if="!deletingAccount" @click="confirmDelete">{{$t('general.submit')}}</button>
</div>
</div>
</div>
</template>
<script src="./user_settings.js">
</script>
<style lang="scss">
.profile-edit {
2018-04-07 16:30:27 +00:00
.bio {
margin: 0;
}
2018-04-07 16:30:27 +00:00
input[type=file] {
padding: 5px;
}
2018-04-07 16:30:27 +00:00
.banner {
max-width: 400px;
}
2018-04-07 16:30:27 +00:00
.uploading {
font-size: 1.5em;
margin: 0.25em;
}
}
</style>