wikijs-fork/client/js/pages/admin.js

50 lines
903 B
JavaScript
Raw Normal View History

2017-01-04 05:07:15 +00:00
if($('#page-type-admin-users').length) {
2017-01-04 05:07:15 +00:00
//=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
2017-01-04 05:07:15 +00:00
}