diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2018-04-10 13:24:40 +0200 |
---|---|---|
committer | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2018-05-16 09:50:21 +0200 |
commit | 8bca1558c3d4056c1bfcb746516f9394fc93f09f (patch) | |
tree | c36aa5ab51c514159c2b5a4efc4b05f4281f0ea2 /settings/src/components/userList.vue | |
parent | 82e1f182c826b3a586cef59e9a4e90e1a4b9eb1f (diff) | |
download | nextcloud-server-8bca1558c3d4056c1bfcb746516f9394fc93f09f.tar.gz nextcloud-server-8bca1558c3d4056c1bfcb746516f9394fc93f09f.zip |
Settings users list new user language
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'settings/src/components/userList.vue')
-rw-r--r-- | settings/src/components/userList.vue | 39 |
1 files changed, 34 insertions, 5 deletions
diff --git a/settings/src/components/userList.vue b/settings/src/components/userList.vue index ed5be1f6adf..62040b1c33f 100644 --- a/settings/src/components/userList.vue +++ b/settings/src/components/userList.vue @@ -73,7 +73,13 @@ @tag="validateQuota" > </multiselect> </div> - <div class="languages" v-if="showConfig.showLanguages"></div> + <div class="languages" v-if="showConfig.showLanguages"> + <multiselect :options="languages" v-model="newUser.language" + :placeholder="t('settings', 'Default language')" + label="name" track-by="code" class="multiselect-vue" + :allowEmpty="false" group-values="languages" group-label="label"> + </multiselect> + </div> <div class="storageLocation" v-if="showConfig.showStoragePath"></div> <div class="userBackend" v-if="showConfig.showUserBackend"></div> <div class="lastLogin" v-if="showConfig.showLastLogin"></div> @@ -86,7 +92,7 @@ </form> <user-row v-for="(user, key) in filteredUsers" :user="user" :key="key" :settings="settings" :showConfig="showConfig" - :groups="groups" :subAdminsGroups="subAdminsGroups" :quotaOptions="quotaOptions" /> + :groups="groups" :subAdminsGroups="subAdminsGroups" :quotaOptions="quotaOptions" :languages="languages" /> <infinite-loading @infinite="infiniteHandler" ref="infiniteLoading"> <div slot="spinner"><div class="users-icon-loading icon-loading"></div></div> <div slot="no-more"><div class="users-list-end">— {{t('settings', 'no more results')}} —</div></div> @@ -104,6 +110,7 @@ import userRow from './userList/userRow'; import Multiselect from 'vue-multiselect'; import InfiniteLoading from 'vue-infinite-loading'; +import Vue from 'vue'; export default { name: 'userList', @@ -128,14 +135,21 @@ export default { mailAddress:'', groups: [], subAdminsGroups: [], - quota: defaultQuota + quota: defaultQuota, + language: {code: 'en', name: t('settings', 'Default language')} } }; }, mounted() { if (!this.settings.canChangePassword) { - OC.Notification.showTemporary(t('settings','Password change is disabled because the master key is disabled')); + OC.Notification.showTemporary(t('settings', 'Password change is disabled because the master key is disabled')); } + /** + * Init default language from server data. The use of this.settings + * requires a computed variable,vwhich break the v-model binding of the form, + * this is a much easier solution than getter and setter + */ + Vue.set(this.newUser.language, 'code', this.settings.defaultLanguage); }, computed: { settings() { @@ -190,6 +204,20 @@ export default { } } return ''; + }, + + /* LANGUAGES */ + languages() { + return Array( + { + label: t('settings', 'Common languages'), + languages: this.settings.languages.commonlanguages + }, + { + label: t('settings', 'All languages'), + languages: this.settings.languages.languages + } + ); } }, watch: { @@ -240,7 +268,8 @@ export default { email: this.newUser.mailAddress, groups: this.newUser.groups.map(group => group.id), subadmin: this.newUser.subAdminsGroups.map(group => group.id), - quota: this.newUser.quota.id + quota: this.newUser.quota.id, + language: this.newUser.language.code, }).then(() => this.resetForm()); } } |