[fix] merge user.js

This commit is contained in:
Rushabh Mehta 2017-10-31 13:45:53 +05:30
parent 875b965d40
commit fd36f1f01c
2 changed files with 13 additions and 5 deletions

View file

@ -43,13 +43,12 @@ frappe.ui.form.on('User', {
if(!frm.roles_editor) {
var role_area = $('<div style="min-height: 300px">')
.appendTo(frm.fields_dict.roles_html.wrapper);
frm.roles_editor = new frappe.RoleEditor(role_area, frm, true);
frm.roles_editor = new frappe.RoleEditor(role_area, frm, frm.doc.role_profile_name ? 1 : 0);
var module_area = $('<div style="min-height: 300px">')
.appendTo(frm.fields_dict.modules_html.wrapper);
frm.module_editor = new frappe.ModuleEditor(frm, module_area)
}
else {
frm.module_editor = new frappe.ModuleEditor(frm, module_area);
} else {
frm.roles_editor.show();
}
}
@ -113,7 +112,11 @@ frappe.ui.form.on('User', {
frm.trigger('enabled');
frm.roles_editor && frm.roles_editor.show();
if (frm.roles_editor) {
frm.roles_editor.disabled = frm.doc.role_profile_name ? 1 : 0;
frm.roles_editor.show();
}
frm.module_editor && frm.module_editor.refresh();
if(frappe.session.user==doc.name) {

View file

@ -78,6 +78,11 @@ frappe.RoleEditor = Class.extend({
.find('[data-user-role="'+user_role.role+'"] input[type="checkbox"]').get(0);
if(checkbox) checkbox.checked = true;
});
this.set_enable_disable();
},
set_enable_disable: function() {
$('.box').attr('disabled', this.disable ? true : false);
},
set_roles_in_table: function() {
var opts = this.get_roles();