From 8125610680b1dbcbf2cb7f20aabbbd2a42de9076 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 11 Jul 2013 18:27:59 +0530 Subject: [PATCH] [minor] [profile] add all roles button --- core/doctype/profile/profile.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/core/doctype/profile/profile.js b/core/doctype/profile/profile.js index 71de1169c8..d06c63574b 100644 --- a/core/doctype/profile/profile.js +++ b/core/doctype/profile/profile.js @@ -85,6 +85,15 @@ wn.RoleEditor = Class.extend({ show_roles: function() { var me = this; $(this.wrapper).empty(); + var add_all_roles = $('

').appendTo($(this.wrapper)); + add_all_roles.find("button").on("click", function() { + $(me.wrapper).find('input[type="checkbox"]').each(function(i, check) { + if(!$(check).is(":checked")) { + check.checked = true; + } + }); + }); + for(var i in this.roles) { $(this.wrapper).append(repl('
\ @@ -98,7 +107,7 @@ wn.RoleEditor = Class.extend({ $(this.wrapper).find('.user-role a').click(function() { me.show_permissions($(this).parent().attr('data-user-role')) return false; - }) + }); }, show: function() { var me = this;