#11417 closed enhancement (fixed)
Add a group toggler to the rows in the Permission and Group Membership tables on the Admin Permissions page
Reported by: | Ryan J Ollos | Owned by: | Ryan J Ollos |
---|---|---|---|
Priority: | normal | Milestone: | 1.1.4 |
Component: | admin/web | Version: | |
Severity: | normal | Keywords: | |
Cc: | leho@… | Branch: | |
Release Notes: |
Click on row label of Permissions admin page toggles all of the checkboxes in the group. |
||
API Changes: | |||
Internal Changes: |
Description (last modified by )
A feature proposed in #11056 is to add a group toggle to the rows in the Permissions and Group Membership tables on the Admin Permissions page. The feature will be refined in this ticket.
The scope of this ticket may also be expanded to apply to filters on the query page (effectively integrating the th:QueryUiAssistPlugin into Trac).
Attachments (0)
Change History (19)
comment:1 by , 11 years ago
comment:2 by , 11 years ago
Description: | modified (diff) |
---|
comment:3 by , 10 years ago
Revised changes in log:rjollos.git:t11417.1, including a proposed rename of the function added in #10994.
comment:4 by , 10 years ago
The function added in #10994 was renamed in [13008]. The other changes in log:rjollos.git:t11417.1 will be reviewed again and committed sometime in milestone:1.1.3.
follow-up: 7 comment:5 by , 10 years ago
Replying to rjollos:
The scope of this ticket may also be expanded to apply to filters on the query page (effectively integrating the th:QueryUiAssistPlugin into Trac).
I'm aiming to add this behaviour as well.
The th:QueryUiAssistPlugin has the following behaviour:
- Double click on a checkbox label selects the checkbox and unselects all other checkboxes in the filter group.
- Double click on the label inverts the state of every checkbox. For example, X X O X → O O X O.
I like the first behaviour and I'm considering incorporating it here. The second behaviour I'm not sure is as useful or intuitive. We may want to stick with the originally proposed behaviour of toggling all the checkboxes when clicking on a group label. Both behaviours could work together though, the toggle all on single-click, invert state on double click.
comment:6 by , 10 years ago
Status: | new → assigned |
---|
comment:7 by , 10 years ago
Replying to rjollos:
The th:QueryUiAssistPlugin has the following behaviour:
- Double click on a checkbox label selects the checkbox and unselects all other checkboxes in the filter group.
- Double click on the label inverts the state of every checkbox. For example, X X O X → O O X O.
The behaviors would be useful for the search filters as well.
comment:8 by , 10 years ago
Milestone: | 1.1.3 → 1.1.4 |
---|
comment:9 by , 10 years ago
Cc: | added |
---|
comment:10 by , 10 years ago
Refactoring of QueryUiAssistPlugin in #12062 may make the code more useful for direct utilization in Trac: browser:/queryuiassistplugin/1.0/uiassist/query.py.
comment:11 by , 10 years ago
log:rjollos.git:t11417-query-page integrates the code from QueryUiAssistPlugin.
comment:12 by , 10 years ago
I think it would be simple to use document.getElementById()
like this.
var clicked = this.tagName === "LABEL" ? - $('#' + $(this).attr("for"))[0] : this; + document.getElementById(this.htmlFor) : this;
IMO, I like to use click with a modifier key rather than double click. It wouldn't need to prevent text selection. I don't want to eternally block text-selection by user-select: none
for labels in filter.
-
trac/htdocs/js/query.js
diff --git a/trac/htdocs/js/query.js b/trac/htdocs/js/query.js index 6a00e80..0e15b70 100644
a b 110 110 111 111 var $filters = $("#filters"); 112 112 113 // disable selection of labels114 function disableLabelSelection() {115 $filters.find('label').css("user-select", "none")116 .attr("unselectable", "on")117 .on("selectstart", false);118 }119 disableLabelSelection();120 121 113 // Flip checkboxes in the row 122 $filters.on("dblclick", "th label", function(event) { 114 $filters.on("click", "th label", function(event) { 115 if (!event.metaKey && !event.altKey) 116 return; 123 117 var name = this.id.slice(6); 124 118 $filters.find("input[name=" + name + "]") 125 119 .filter(":checkbox") … … 127 121 }); 128 122 129 123 // Enable only clicked checkbox and clear others 130 $filters.on("dblclick", "td :checkbox, td :checkbox + label", function(event) { 124 $filters.on("click", "td :checkbox, td :checkbox + label", function(event) { 125 if (!event.metaKey && !event.altKey) 126 return; 131 127 var clicked = this.tagName === "LABEL" ? 132 $('#' + $(this).attr("for"))[0]: this;128 document.getElementById(this.htmlFor) : this; 133 129 $("input[name=" + clicked.name + "]", $filters).prop("checked", false); 134 130 $(clicked).prop("checked", true); 135 131 }); … … 278 274 279 275 // Enable the Or... button if it's been disabled 280 276 $("#add_clause").attr("disabled", false); 281 282 disableLabelSelection();283 277 }).next("div.inlinebuttons").remove(); 284 278 285 279 // Add a new empty clause at the end by cloning the current last clause
comment:14 by , 10 years ago
Latest changes in log:rjollos.git:t11417-query-page.2. In addition to the comment:11 changes, single click on row label toggles all checkboxes.
I tested on Win8 with the latest IE, Chrome, Firefox and Opera. I tested on Ubuntu 14.04 with the latest Firefox, Chromium and Opera. On Linux CTRL + ALT + click combination is required rather than just ALT + click. That could be due to running in VMWare though.
An annoying aspect with the Opera browser on Windows is that the main menu opens on keyup of the ALT key. Opera browser on Linux toggles all checkboxes off when CTRL + ALT + click on item of row. I'll investigate those issues further tomorrow.
follow-up: 17 comment:16 by , 10 years ago
Release Notes: | modified (diff) |
---|
Proposed changes in log:rjollos.git:t11417.3. This addresses the original topic of the ticket, a select all toggler for the row labels on the Admin Permissions page.
comment:17 by , 10 years ago
Replying to rjollos:
Proposed changes in log:rjollos.git:t11417.3. This addresses the original topic of the ticket, a select all toggler for the row labels on the Admin Permissions page.
Looks good to me.
comment:18 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Thanks for the review. Committed to trunk in [13824].
Changes proposed in #11056 can be found in log:rjollos.git:t11417, however further iterations are likely.