Modify

Opened 21 months ago

Last modified 18 months ago

#10745 new enhancement

[Patch] Add a 'Select all' checkbox to the header on the Manager User Accounts page

Reported by: rjollos Owned by: hasienda
Priority: normal Component: AccountManagerPlugin
Severity: normal Keywords: jQuery selection
Cc: Trac Release:

Description

Using jQuery, add the following dynamic behaviors:

  • A checkbox in the header that toggles all of the checkboxes in the column (similar to t:#9609). The checkbox will have tri-state behavior.
  • Disable the Remove selected accounts and Review account attributes buttons until at least one of the checkboxes has been selected.
  • Prompt with an are you sure? dialog when deleting accounts.

The patch will also cleanup some other non-JavaScript issues:

  • When Remove selected accounts is submitted with no items selected, there is no action. The common behavior in Trac is to display a TracError: No users selected (e.g. see the behavior of Remove selected items on the admin milestones panel).
  • Whether or not any of the checkboxes are selected has no affect on what is displayed when submitting Review account attributes. If only one item is selected when Review account attributes is submitted, then only the attributes of that item should be shown on the Accounts: Cleanup page.

If either of the above issues require lengthy changes, then I'll create a dedicated ticket.

Attachments (4)

th10745-r12508-1.patch (2.5 KB) - added by rjollos 21 months ago.
Patch against r12508 of the trunk.
th10745-r12508-2.patch (2.3 KB) - added by rjollos 21 months ago.
Patch against r12508 of the trunk.
th10745-r12508-Trac-1.0.patch (1.9 KB) - added by rjollos 21 months ago.
Patch against r12508 of the trunk - for Trac 1.0 and later only.
th10745-r12508-3.patch (4.9 KB) - added by rjollos 21 months ago.
Patch against r12508 of the trunk.

Download all attachments as: .zip

Change History (19)

comment:1 Changed 21 months ago by rjollos

I reworked my patch for t:#9609 in the course of working on this ticket, and that patch has now been scheduled for inclusion in 1.1.1. The patch for this ticket will be nearly identical, except that we need to support earlier versions of jQuery so we can't use the methods closest and prop that were used in the t:#9609 patch. Therefore there will be a couple of lines of compatibility code in the patch for this ticket.

comment:2 in reply to: ↑ description Changed 21 months ago by rjollos

Replying to rjollos:

  • Whether or not any of the checkboxes are selected has no affect on what is displayed when submitting Review account attributes. If only one item is selected when Review account attributes is submitted, then only the attributes of that item should be shown on the Accounts: Cleanup page.

I see now that this has been discussed in #9253 as well.

Changed 21 months ago by rjollos

Patch against r12508 of the trunk.

Changed 21 months ago by rjollos

Patch against r12508 of the trunk.

comment:3 Changed 21 months ago by rjollos

th10745-r12508-2.patch implements the feature, and has been tested with Trac 0.11, 0.12 and 1.1.1dev-r11483. You'll notice that there is "jQuery compatibility" code in 3 places. What I mean by that is, those lines are needed for earlier versions of jQuery, and can eventually be dropped when the plugin only needs to support Trac 1.0 and later. However, Trac 0.11 ships with jQuery 1.2.3 and Trac 0.12 with jQuery 1.4.2, so we can't use all the jQuery features that are provided with Trac 1.0 (jQuery 1.7.2).

Changed 21 months ago by rjollos

Patch against r12508 of the trunk - for Trac 1.0 and later only.

comment:4 Changed 21 months ago by rjollos

For demonstration only, I've provided th10745-r12508-Trac-1.0.patch, which will only work with Trac 1.0 and later.

comment:5 Changed 21 months ago by rjollos

I meant to say, that th10745-r12508-2.patch is not the whole story, as I intend to implement the 3 jQuery features described in comment:description. I should have the whole patch finished later this evening.

Changed 21 months ago by rjollos

Patch against r12508 of the trunk.

comment:6 follow-ups: Changed 21 months ago by rjollos

th10745-r12508-3.patch implements disabling/enabling of the buttons and the prompt for deleting accounts, which rounds out the jQuery work I had planned for this ticket. Later on, I will consider implementing similar code for the checkboxes on the Accounts: Cleanup page.

I'll also deal the two non-JavaScript issues mentioned in comment:description with a separate patch, but that will be a few days down the road, and those issues might be better suited for (a) different ticket(s).

comment:7 in reply to: ↑ description Changed 21 months ago by rjollos

Replying to rjollos:

The patch will also cleanup some other non-JavaScript issues:

These issues seem better suited for different tickets, to keep the changelog clean.

  • When Remove selected accounts is submitted with no items selected, there is no action. The common behavior in Trac is to display a TracError: No users selected (e.g. see the behavior of Remove selected items on the admin milestones panel).

=> #10753.

  • Whether or not any of the checkboxes are selected has no affect on what is displayed when submitting Review account attributes. If only one item is selected when Review account attributes is submitted, then only the attributes of that item should be shown on the Accounts: Cleanup page.

=> #10754.

comment:8 in reply to: ↑ 6 Changed 21 months ago by rjollos

Replying to rjollos:

Later on, I will consider implementing similar code for the checkboxes on the Accounts: Cleanup page.

=> #10755.

comment:9 in reply to: ↑ 6 Changed 21 months ago by hasienda

  • Keywords jQuery selection added

Replying to rjollos:

th10745-r12508-3.patch implements disabling/enabling of the buttons and the prompt for deleting accounts, which rounds out the jQuery work I had planned for this ticket.

Awesome work. After reading related tickets for Trac core I'm even more impressed about your jQuery foo. This has been certainly a bunch of hours to get it right.

comment:10 Changed 21 months ago by rjollos

Thanks, very much a work in progress still in terms of style and perhaps even functional issues, but I've learned a lot from reading around the web and working with Jun on AdminEnumListPlugin. This bit of work will certainly benefit from your careful eye towards testing before integration, and I may revisit the code later once #9609 is integrated into Trac, if the Trac devs show me how to do something better when they commit that patch.

comment:11 Changed 21 months ago by hasienda

(In [12512]) AccountManagerPlugin: Add a 'Select all' and account delete confirmation via jQuery-UI, refs #10745.

Thanks to Ryan J Ollos for this clever piece of jQuery code.

I added least intrusive translation support for the confirmation message as
done for single (own) user account deletion in AccountModule before, so it
won't require message extraction from JS code itself.

comment:12 Changed 21 months ago by hasienda

Developer note: While Babel is perfectly capable of pulling translatable strings from JavaScript code, this results in a separate message catalog, so extra care must be taken to package and compile translations, etc., so the workaround pulling in translated messages as variables from the Python domain is a blessing IMHO. Only I don't remember how I found out about it, maybe this has been another trick learned from Jun Omae?

comment:13 Changed 20 months ago by rjollos

Since there are < and > characters in the JavaScript code, do we need to wrap the code in a /*<![CDATA[*/ and /*]]>*/ section? I'm not entirely sure, but as discussed here, it can't hurt anything, and would guard against any future oversight of adding the section delimiters when editing the code.

comment:14 Changed 20 months ago by hasienda

(In [12577]) AccountManagerPlugin: Add some interaction for 1st wizard pages, refs #8930 and #10745.

I do agree to the idea of using CDATA wraps less selectively as considered in
t:ticket:#10995, hence I'm adding one to Ryan's latest jQuery code as well.

comment:15 Changed 18 months ago by hasienda

(In [12738]) AccountManagerPlugin: Move pager to user list in accounts admin panel, refs #809, #9946, #10682, #10745, #10754 and #10873.

This should fix broken display of extra-long user lists, and it makes
selections from user list useful for the clean-up page as requested.

Dumped access to anonymous session attributes for the current solution,
so these are no longer available for clean-up in the admin web-UI, but
I'll re-implement this later on, if it will be missed too much.

Add Comment

Modify Ticket

Action
as new .
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.