Edgewall Software
Modify

Opened 5 years ago

Closed 4 years ago

Last modified 3 years ago

#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@…
Release Notes:

Click on row label of Permissions admin page toggles all of the checkboxes in the group.

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

Attachments (0)

Change History (19)

comment:1 Changed 5 years ago by Ryan J Ollos

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

comment:2 Changed 5 years ago by Ryan J Ollos

Description: modified (diff)

comment:3 Changed 4 years ago by Ryan J Ollos

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

comment:4 Changed 4 years ago by Ryan J Ollos

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 4 years ago by Ryan J Ollos (previous) (diff)

comment:5 in reply to:  description ; Changed 4 years ago by Ryan J Ollos

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 Changed 4 years ago by Ryan J Ollos

Status: newassigned

comment:7 in reply to:  5 Changed 4 years ago by Ryan J Ollos

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 Changed 4 years ago by Ryan J Ollos

Milestone: 1.1.31.1.4

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

Cc: leho@… added

comment:10 Changed 4 years ago by Ryan J Ollos

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 Changed 4 years ago by Ryan J Ollos

comment:12 Changed 4 years ago by Jun Omae

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 4 years ago by Jun Omae (previous) (diff)

comment:13 Changed 4 years ago by Ryan J Ollos

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

comment:14 Changed 4 years ago by Ryan J Ollos

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 Changed 4 years ago by Ryan J Ollos

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

comment:16 Changed 4 years ago by Ryan J Ollos

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 in reply to:  16 Changed 4 years ago by Jun Omae

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 Changed 4 years ago by Ryan J Ollos

Resolution: fixed
Status: assignedclosed

Thanks for the review. Committed to trunk in [13824].

comment:19 Changed 3 years ago by Ryan J Ollos

See related #12376.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted.
to The owner will be changed from Ryan J Ollos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.