Edgewall Software

Opened 10 years ago

Last modified 8 years ago

#11417 closed enhancement

Add a group toggler to the rows in the Permission and Group Membership tables on the Admin Permissions page — at Version 16

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 Ryan J Ollos)

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).

Change History (16)

comment:1 by Ryan J Ollos, 10 years ago

Changes proposed in #11056 can be found in log:rjollos.git:t11417, however further iterations are likely.

comment:2 by Ryan J Ollos, 10 years ago

Description: modified (diff)

comment:3 by Ryan J Ollos, 10 years ago

Revised changes in log:rjollos.git:t11417.1, including a proposed rename of the function added in #10994.

comment:4 by Ryan J Ollos, 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.

Last edited 10 years ago by Ryan J Ollos (previous) (diff)

in reply to:  description ; comment:5 by Ryan J Ollos, 9 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 Ryan J Ollos, 9 years ago

Status: newassigned

in reply to:  5 comment:7 by Ryan J Ollos, 9 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 Ryan J Ollos, 9 years ago

Milestone: 1.1.31.1.4

comment:9 by lkraav <leho@…>, 9 years ago

Cc: leho@… added

comment:10 by Ryan J Ollos, 9 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:12 by Jun Omae, 9 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  
    110110
    111111    var $filters = $("#filters");
    112112
    113     // disable selection of labels
    114     function disableLabelSelection() {
    115       $filters.find('label').css("user-select", "none")
    116                             .attr("unselectable", "on")
    117                             .on("selectstart", false);
    118     }
    119     disableLabelSelection();
    120 
    121113    // 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;
    123117      var name = this.id.slice(6);
    124118      $filters.find("input[name=" + name + "]")
    125119              .filter(":checkbox")
     
    127121    });
    128122
    129123    // 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;
    131127      var clicked = this.tagName === "LABEL" ?
    132                     $('#' + $(this).attr("for"))[0] : this;
     128                    document.getElementById(this.htmlFor) : this;
    133129      $("input[name=" + clicked.name + "]", $filters).prop("checked", false);
    134130      $(clicked).prop("checked", true);
    135131    });
     
    278274
    279275      // Enable the Or... button if it's been disabled
    280276      $("#add_clause").attr("disabled", false);
    281 
    282       disableLabelSelection();
    283277    }).next("div.inlinebuttons").remove();
    284278
    285279    // Add a new empty clause at the end by cloning the current last clause
Last edited 9 years ago by Jun Omae (previous) (diff)

comment:13 by Ryan J Ollos, 9 years ago

I'll rework the patch according to the suggestions in comment:12.

comment:14 by Ryan J Ollos, 9 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.

comment:15 by Ryan J Ollos, 9 years ago

Deferring the work in comment:14 to 1.1.5, see #11970.

comment:16 by Ryan J Ollos, 9 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.

Note: See TracTickets for help on using tickets.