From af5c4258439341fd2153a951fb871269bd754e58 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Mon, 12 Feb 2018 17:18:45 +0100 Subject: [permissionmanager] Tweak style, fix role filtering (and make it AND), minor cleanups --- .../permissionmanager/templates/roleeditor.html | 70 ++++++++++++---------- 1 file changed, 37 insertions(+), 33 deletions(-) (limited to 'modules-available/permissionmanager/templates/roleeditor.html') diff --git a/modules-available/permissionmanager/templates/roleeditor.html b/modules-available/permissionmanager/templates/roleeditor.html index eadce027..d50f2145 100644 --- a/modules-available/permissionmanager/templates/roleeditor.html +++ b/modules-available/permissionmanager/templates/roleeditor.html @@ -1,24 +1,42 @@ -

{{lang_roleEditor}}

+

+ {{#roleid}} + {{lang_editRoleHeading}} + {{/roleid}} + {{^roleid}} + {{lang_addRoleHeading}} + {{/roleid}} +

+
+
+ + + + +
+
+ +
+ {{lang_cancel}} + +
{{{permissionHTML}}} +
+
+   + {{lang_locationAwareDesc}} +
+
{{{locationHTML}}} @@ -31,31 +49,17 @@ document.addEventListener("DOMContentLoaded", function () { - $(".tree-panel input[type=checkbox]").change(function () { - var checked = $(this).prop("checked"); - var parent = $(this).parent().parent(); - if (parent.hasClass("panel-heading")) parent = parent.parent(); - - var checkboxes = parent.find("input[type=checkbox]"); - if (checked) { - checkboxes.prop("checked", true); - } else { - checkboxes.prop("checked", false); - while (!parent.hasClass("tree-panel")) { - parent = parent.parent().parent(); - if (parent.hasClass("tree-container")) parent = parent.parent().parent(); - parent.find("input[type=checkbox]:first").prop("checked", false); - } - } + $(".tree-container input[type=checkbox]").change(function () { + // (Un)Mark all sub-elements when changing a checkbox in the panel body + var $this = $(this); + var checked = $this.prop("checked"); + $this.closest('li').find("input[type=checkbox]").prop("checked", checked); }); - - $('form').submit(function () { - var input = $("#rolename"); - var name = $.trim(input.val()); - if (!name) { - input.addClass("missingInput"); - return false; - } + $("input.master-checkbox").change(function () { + // (Un)Mark everything within the panel when the master checkbox on top is clicked + var $this = $(this); + var checked = $this.prop("checked"); + $this.closest('.tree-panel').find("input[type=checkbox]").prop("checked", checked); }); $('[data-toggle="tooltip"]').tooltip({ -- cgit v1.2.3-55-g7522