You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
wiki/client/js/pages/admin.js

50 lines
903 B

if($('#page-type-admin-users').length) {
//=include ../modals/admin-users-create.js
} else if($('#page-type-admin-users-edit').length) {
let vueEditUser = new Vue({
el: '#page-type-admin-users-edit',
data: {
id: '',
email: '',
password: '********',
name: '',
rights: [],
roleoverride: 'none'
},
methods: {
addRightsRow: (ev) => {
vueEditUser.rights.push({});
},
removeRightsRow: (ev) => {
},
saveUser: (ev) => {
}
},
created: function() {
this.id = usrData._id;
this.email = usrData.email;
this.name = usrData.name;
console.log(_.find(usrData.rights, { role: 'admin' }));
if(_.find(usrData.rights, { role: 'admin' })) {
this.rights = _.reject(usrData.rights, ['role', 'admin']);
this.roleoverride = 'admin';
} else {
this.rights = usrData.rights;
}
}
});
//=include ../modals/admin-users-delete.js
}