Browse Source

[fix] merge user.js

version-14
Rushabh Mehta 7 years ago
parent
commit
fd36f1f01c
2 changed files with 13 additions and 5 deletions
  1. +8
    -5
      frappe/core/doctype/user/user.js
  2. +5
    -0
      frappe/public/js/frappe/roles_editor.js

+ 8
- 5
frappe/core/doctype/user/user.js View File

@@ -43,13 +43,12 @@ frappe.ui.form.on('User', {
if(!frm.roles_editor) { if(!frm.roles_editor) {
var role_area = $('<div style="min-height: 300px">') var role_area = $('<div style="min-height: 300px">')
.appendTo(frm.fields_dict.roles_html.wrapper); .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">') var module_area = $('<div style="min-height: 300px">')
.appendTo(frm.fields_dict.modules_html.wrapper); .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(); frm.roles_editor.show();
} }
} }
@@ -113,7 +112,11 @@ frappe.ui.form.on('User', {


frm.trigger('enabled'); 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(); frm.module_editor && frm.module_editor.refresh();


if(frappe.session.user==doc.name) { if(frappe.session.user==doc.name) {


+ 5
- 0
frappe/public/js/frappe/roles_editor.js View File

@@ -78,6 +78,11 @@ frappe.RoleEditor = Class.extend({
.find('[data-user-role="'+user_role.role+'"] input[type="checkbox"]').get(0); .find('[data-user-role="'+user_role.role+'"] input[type="checkbox"]').get(0);
if(checkbox) checkbox.checked = true; 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() { set_roles_in_table: function() {
var opts = this.get_roles(); var opts = this.get_roles();


Loading…
Cancel
Save