Edgewall Software

Opened 11 years ago

Last modified 11 years ago

#11027 closed enhancement

Show numer of table entries in heading on ticket admin pages — at Version 4

Reported by: Ryan J Ollos <ryan.j.ollos@…> Owned by:
Priority: normal Milestone: 1.0.2
Component: admin/web Version: 1.0-stable
Severity: normal Keywords:
Cc: Steffen Hoffmann Branch:
Release Notes:
API Changes:
Internal Changes:

Description (last modified by Ryan J Ollos <ryan.j.ollos@…>)

It can be useful to see at a glance the number of entries in the Components or Milestones tables, for instance. The attachment sections nicely show the number of attachments (added in #10743), using the trac-count class for styling. This is also done other places in Trac, and we recently added the feature to tables in the th:AccountManagerPlugin as well (th:#7426).

I propose to add a table entry count to the heading of the following admin panels:

  • General: Plugins
  • Ticket System: Components
  • Ticket System: Milestones
  • Ticket System: enums
    • Ticket System: Priorities
    • Ticket System: Resolutions
    • Ticket System: Severities
    • Ticket System: Ticket Types
  • Ticket System: Versions
  • Version Control: Repositories

Change History (5)

comment:1 by Steffen Hoffmann, 11 years ago

Cc: Steffen Hoffmann added

comment:2 by Ryan J Ollos <ryan.j.ollos@…>, 11 years ago

It looks like the best option may be to implement this in JavaScript. The problem with implementing it in the template is that variables such as components are generators, so it's not possible to know the number of items in the table until the table is constructed. In order to implement this in the template, it looks like we'd need to either:

  • Iterate over the generator twice.
  • Extract the generator to a list, either in the python code or at the top of the template before the h2 line.

Any ideas on what is best?

by Ryan J Ollos <ryan.j.ollos@…>, 11 years ago

Attachment: t11027-r11682-1.patch added

Patch against r11682 of the trunk.

comment:3 by Ryan J Ollos <ryan.j.ollos@…>, 11 years ago

t11027-r11682-1.patch implements the feature in JavaScript, in the way described in comment:1. I couldn't find a way to put lightweight generic code in admin.html without a count being added to the Logging page, Permissions page, etc.., but maybe someone will have a clever way to accomplish that. Also, the selector for the Plugins page is slightly different anyway.

Side note: For the trac-count class, the text in the span seems to align better with the text outside the span if I change vertical-align: baseline;vertical-align: top;. I first tried vertical-align: middle;, thinking that would produce the best results, but the result appeared to be the same as vertical-align: baseline;. This is true for the Attachment and Change History count numbers on the ticket page as well (Chrome 22 on Debian, Iceweasel 10 on Debian). I'm not sure why that is the case though, so I haven't included the change in the patch.

comment:4 by Ryan J Ollos <ryan.j.ollos@…>, 11 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.