Edgewall Software
Modify

Ticket #9678 (closed enhancement: fixed)

Opened 20 months ago

Last modified 8 months ago

Please add __class__ like __style__

Reported by: Marthein1@… Owned by: matthew.schnee@…
Priority: normal Milestone: 0.13
Component: report system Version: 0.12-stable
Severity: normal Keywords:
Cc: trac@…
Release Notes:
API Changes:

Description (last modified by cboos) (diff)

For a clearer view of the ticket, I would like to add html classes to report rows.

This would be possible with a __class__ tag, similar to the __style__ tag. One could then output for example 'status AS __class__' and change report.css to display other colors/pictures, etc for example when status == closed.

Attachments

trac.cssclass.patch (2.8 KB) - added by matthew.schnee@… 8 months ago.
patch to handle cssclass in the report view.

Download all attachments as: .zip

Change History

comment:1 Changed 20 months ago by Reinder <trac@…>

  • Cc trac@… added

comment:2 Changed 20 months ago by cboos

  • Description modified (diff)
  • Milestone set to unscheduled

Changed 8 months ago by matthew.schnee@…

patch to handle cssclass in the report view.

comment:3 Changed 8 months ago by matthew.schnee@…

I have attached a patch to this ticket which implements this feature request. We started using Trac recently where I work, and we've been customizing it pretty heavily in order to add some flexibility to the report views, considering we use some pretty complicated workflow targets that are nice to have visual representation- using __color__ by default applies styles that can override text color, font-weight, and a bunch of other styles (because they're applied by css to the TD element, overwriting your TR style attribute).

A couple of caveats for you:

  • The implementation uses __cssclass__ instead of __class__ as was requested. __class__ is a magic attribute in Python.
  • __cssclass__, like __style__ and __color__ apply to the TR element, and not to any TD or child-elements. Your css selectors should reflect this. I've updated the default TracReport? wikipage in the source to clarify this as well.

Follow the Trac Install wiki section on Site Appearance guide for adding a link to your custom css file.

comment:4 Changed 8 months ago by rblank

  • Milestone changed from unscheduled to 0.13
  • Owner set to rblank
  • Summary changed from Please add __class__ like __style to Please add __class__ like __style__

Thanks for the patch. __class__ is probably ok, even though it's a "magic attribute" in Python. The name is never used in a Python context.

comment:5 Changed 8 months ago by rblank

Well, ok, technically __class__ is used in a Python context, but it's easy to work around ;)

Slightly refactored patch (using __class__) applied in [10822]. Thanks!

comment:6 Changed 8 months ago by rblank

  • Resolution set to fixed
  • Status changed from new to closed

… and documented in 0.13/TracReports@2.

comment:7 Changed 8 months ago by rblank

  • Owner changed from rblank to matthew.schnee@…
View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
to The owner will be changed from matthew.schnee@…. Next status will be 'closed'
Author


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

 
Note: See TracTickets for help on using tickets.