Edgewall Software
Modify

Opened 19 years ago

Closed 14 years ago

Last modified 14 years ago

#2645 closed defect (fixed)

Report custom formatting: font styles not honored

Reported by: kilian.cavalotti@… Owned by: whueskes@…
Priority: lowest Milestone: 0.12.1
Component: report system Version: 0.9.3
Severity: normal Keywords: style report font
Cc: whueskes@…, dgc+trac@… Branch:
Release Notes:
API Changes:
Internal Changes:

Description

I have a problem with reports custom formatting: when using style to change font properties, the specified style is not applied. The following example, given in TracReports, illustrates the problem :

SELECT p.value AS __color__,
     t.milestone AS __group__,
     (CASE owner WHEN '$USER' THEN 'font-weight: bold; background: red;' ELSE 
'' END) AS __style__,
       t.id AS ticket, summary
  FROM ticket t,enum p
  WHERE t.status IN ('new', 'assigned', 'reopened') 
    AND p.name=t.priority AND p.type='priority'
  ORDER BY t.milestone, p.value, t.severity, t.time

Using this report, I correctly see my tickets with a red background, but the font weight is normal. I assume that's because the style="font-weight:bold" attribute is passed to the <tr> tag, when it should probably be passed to each <td> element.

With

(CASE owner WHEN '$USER' THEN 'font-weight: bold;' ELSE '' END) AS __style__,

the generated HTML looks like below:

<tr class="color2-odd" style="font-weight: bold;">
    <td class="ticket">
        <a title="View ticket" href="/trac/ticket/52"> #52 </a>
    </td>
    <td class="component"> trac </td>
    <td class="status"> new </td>
    <td class="type"> task </td>
    <td class="priority"> high </td>
    <td class="severity"> normal </td>
    <td class="owner"> kilian </td>
    <td class="date"> 01/17/06 </td>
</tr>

Attachments (0)

Change History (12)

comment:1 by whueskes@…, 19 years ago

Cc: whueskes@… added

Workaround: change in htdocs/css/trac.css

body, th, td {
 font: normal 13px verdana,arial,'Bitstream Vera Sans',helvetica,sans-serif;
} 

into:

body, th {
 font: normal 13px verdana,arial,'Bitstream Vera Sans',helvetica,sans-serif;
} 

comment:2 by whueskes@…>, 19 years ago

or even better:

body, th, tr {
 font: normal 13px verdana,arial,'Bitstream Vera Sans',helvetica,sans-serif;
} 

comment:3 by Christian Boos, 18 years ago

Milestone: 2.0
Priority: normallowest

Perhaps related to #633?

comment:4 by whueskes@…, 18 years ago

the (second) workaround is working fine for me.

Here is a test case: http://www.hosted-projects.com/trac/TracDemo/Demo/report/14
The background color is applied, but the font is not made bold.
When I edit the css using https://addons.mozilla.org/firefox/60/, I see no other visual change except that line becoming bold, but I am no css expert, so there might be situations or browsers where it does change something.

Changing the DOCTYPE might also solve the problem: (google groups)

comment:5 by Christian Boos, 17 years ago

Summary: Repoort custom formatting: font styles not honoredReport custom formatting: font styles not honored

comment:6 by osimons, 17 years ago

#5128 closed as a duplicate. It contains some related discussion, and identification of a code change that solved it using 0.10.4.

comment:7 by anonymous, 16 years ago

Changing the trac.css as follows should fix the issue:

body {
 font: normal 13px Verdana,Arial,'Bitstream Vera Sans',Helvetica,sans-serif;
}

th, td {
 font: inherit;
}

comment:8 by dgc+trac@…, 15 years ago

Cc: dgc+trac@… added

I'm surprised this ticket is still open. Is there a reason not to make the change above in the distributed trac.css? Seems like a simple solution to a vexing and common problem.

I don't like modifying my trac.css — I don't ever like local customizations to distributed code if I can help it. I solved this problem by creating a local style.css with the following:

tr th,td {
    text-decoration: inherit;
    text-transform: inherit;
    font-size: inherit;
    font-style: inherit;
    font-weight: inherit;
}

Now my reports' <tr> style attributes are inherited by their <td>s.

comment:9 by Christian Boos, 15 years ago

Milestone: 2.0unscheduled

Milestone 2.0 deleted

comment:10 by Remy Blank, 14 years ago

Milestone: triaging0.13
Owner: changed from daniel to Remy Blank

comment:11 by Remy Blank, 14 years ago

Milestone: 0.130.12.1
Resolution: fixed
Status: newclosed

Applied the suggestion in comment:2 in [9954].

comment:12 by Remy Blank, 14 years ago

Owner: changed from Remy Blank to whueskes@…

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain whueskes@….
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from whueskes@… 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.