Merge branch 'user_settings_tabs' into 'develop'

Add tabs to user settings

See merge request pleroma/pleroma-fe!308
This commit is contained in:
kaniini 2018-08-19 23:40:31 +00:00
commit d6b3394b79
3 changed files with 32 additions and 11 deletions

View File

@ -18,7 +18,8 @@ const UserSettings = {
deleteAccountError: false, deleteAccountError: false,
changePasswordInputs: [ '', '', '' ], changePasswordInputs: [ '', '', '' ],
changedPassword: false, changedPassword: false,
changePasswordError: false changePasswordError: false,
activeTab: 'profile'
} }
}, },
components: { components: {
@ -235,6 +236,9 @@ const UserSettings = {
this.changePasswordError = res.error this.changePasswordError = res.error
} }
}) })
},
activateTab (tabName) {
this.activeTab = tabName
} }
} }
} }

View File

@ -4,7 +4,12 @@
{{$t('settings.user_settings')}} {{$t('settings.user_settings')}}
</div> </div>
<div class="panel-body profile-edit"> <div class="panel-body profile-edit">
<div class="setting-item"> <div class="tab-switcher">
<button class="btn btn-default" @click="activateTab('profile')">{{$t('settings.profile_tab')}}</button>
<button class="btn btn-default" @click="activateTab('security')">{{$t('settings.security_tab')}}</button>
<button class="btn btn-default" @click="activateTab('data_import_export')" v-if="pleromaBackend">{{$t('settings.data_import_export_tab')}}</button>
</div>
<div class="setting-item" v-if="activeTab == 'profile'">
<h2>{{$t('settings.name_bio')}}</h2> <h2>{{$t('settings.name_bio')}}</h2>
<p>{{$t('settings.name')}}</p> <p>{{$t('settings.name')}}</p>
<input class='name-changer' id='username' v-model="newname"></input> <input class='name-changer' id='username' v-model="newname"></input>
@ -25,7 +30,7 @@
</div> </div>
<button :disabled='newname.length <= 0' class="btn btn-default" @click="updateProfile">{{$t('general.submit')}}</button> <button :disabled='newname.length <= 0' class="btn btn-default" @click="updateProfile">{{$t('general.submit')}}</button>
</div> </div>
<div class="setting-item"> <div class="setting-item" v-if="activeTab == 'profile'">
<h2>{{$t('settings.avatar')}}</h2> <h2>{{$t('settings.avatar')}}</h2>
<p>{{$t('settings.current_avatar')}}</p> <p>{{$t('settings.current_avatar')}}</p>
<img :src="user.profile_image_url_original" class="old-avatar"></img> <img :src="user.profile_image_url_original" class="old-avatar"></img>
@ -38,7 +43,7 @@
<i class="icon-spin4 animate-spin" v-if="uploading[0]"></i> <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> <button class="btn btn-default" v-else-if="previews[0]" @click="submitAvatar">{{$t('general.submit')}}</button>
</div> </div>
<div class="setting-item"> <div class="setting-item" v-if="activeTab == 'profile'">
<h2>{{$t('settings.profile_banner')}}</h2> <h2>{{$t('settings.profile_banner')}}</h2>
<p>{{$t('settings.current_profile_banner')}}</p> <p>{{$t('settings.current_profile_banner')}}</p>
<img :src="user.cover_photo" class="banner"></img> <img :src="user.cover_photo" class="banner"></img>
@ -51,7 +56,7 @@
<i class=" icon-spin4 animate-spin uploading" v-if="uploading[1]"></i> <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> <button class="btn btn-default" v-else-if="previews[1]" @click="submitBanner">{{$t('general.submit')}}</button>
</div> </div>
<div class="setting-item"> <div class="setting-item" v-if="activeTab == 'profile'">
<h2>{{$t('settings.profile_background')}}</h2> <h2>{{$t('settings.profile_background')}}</h2>
<p>{{$t('settings.set_new_profile_background')}}</p> <p>{{$t('settings.set_new_profile_background')}}</p>
<img class="bg" v-bind:src="previews[2]" v-if="previews[2]"> <img class="bg" v-bind:src="previews[2]" v-if="previews[2]">
@ -62,7 +67,7 @@
<i class=" icon-spin4 animate-spin uploading" v-if="uploading[2]"></i> <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> <button class="btn btn-default" v-else-if="previews[2]" @click="submitBg">{{$t('general.submit')}}</button>
</div> </div>
<div class="setting-item"> <div class="setting-item" v-if="activeTab == 'security'">
<h2>{{$t('settings.change_password')}}</h2> <h2>{{$t('settings.change_password')}}</h2>
<div> <div>
<p>{{$t('settings.current_password')}}</p> <p>{{$t('settings.current_password')}}</p>
@ -81,7 +86,7 @@
<p v-else-if="changePasswordError !== false">{{$t('settings.change_password_error')}}</p> <p v-else-if="changePasswordError !== false">{{$t('settings.change_password_error')}}</p>
<p v-if="changePasswordError">{{changePasswordError}}</p> <p v-if="changePasswordError">{{changePasswordError}}</p>
</div> </div>
<div class="setting-item" v-if="pleromaBackend"> <div class="setting-item" v-if="pleromaBackend && activeTab == 'data_import_export'">
<h2>{{$t('settings.follow_import')}}</h2> <h2>{{$t('settings.follow_import')}}</h2>
<p>{{$t('settings.import_followers_from_a_csv_file')}}</p> <p>{{$t('settings.import_followers_from_a_csv_file')}}</p>
<form v-model="followImportForm"> <form v-model="followImportForm">
@ -98,15 +103,15 @@
<p>{{$t('settings.follow_import_error')}}</p> <p>{{$t('settings.follow_import_error')}}</p>
</div> </div>
</div> </div>
<div class="setting-item" v-if="enableFollowsExport"> <div class="setting-item" v-if="enableFollowsExport && activeTab == 'data_import_export'">
<h2>{{$t('settings.follow_export')}}</h2> <h2>{{$t('settings.follow_export')}}</h2>
<button class="btn btn-default" @click="exportFollows">{{$t('settings.follow_export_button')}}</button> <button class="btn btn-default" @click="exportFollows">{{$t('settings.follow_export_button')}}</button>
</div> </div>
<div class="setting-item" v-else> <div class="setting-item" v-else-if="activeTab == 'data_import_export'">
<h2>{{$t('settings.follow_export_processing')}}</h2> <h2>{{$t('settings.follow_export_processing')}}</h2>
</div> </div>
<hr> <hr>
<div class="setting-item"> <div class="setting-item" v-if="activeTab == 'security'">
<h2>{{$t('settings.delete_account')}}</h2> <h2>{{$t('settings.delete_account')}}</h2>
<p v-if="!deletingAccount">{{$t('settings.delete_account_description')}}</p> <p v-if="!deletingAccount">{{$t('settings.delete_account_description')}}</p>
<div v-if="deletingAccount"> <div v-if="deletingAccount">
@ -146,4 +151,13 @@
margin: 0.25em; margin: 0.25em;
} }
} }
.tab-switcher {
margin: 7px 7px;
display: inline-block;
button {
height: 30px;
}
}
</style> </style>

View File

@ -333,7 +333,10 @@ const en = {
changed_password: 'Password changed successfully!', changed_password: 'Password changed successfully!',
change_password_error: 'There was an issue changing your password.', change_password_error: 'There was an issue changing your password.',
lock_account_description: 'Restrict your account to approved followers only', lock_account_description: 'Restrict your account to approved followers only',
default_vis: 'Default visibility scope' default_vis: 'Default visibility scope',
profile_tab: 'Profile',
security_tab: 'Security',
data_import_export_tab: 'Data Import / Export'
}, },
notifications: { notifications: {
notifications: 'Notifications', notifications: 'Notifications',