Edgewall Software

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#11406 closed defect (fixed)

diff.css is added twice on the diff_view page

Reported by: Ryan J Ollos Owned by: Ryan J Ollos
Priority: normal Milestone: 1.1.2
Component: general Version:
Severity: normal Keywords: css
Cc: Branch:
Release Notes:

Removed duplicate linking of diff.css when rendering diff_view.html.

API Changes:

Plugins using diff_view.html will need to use add_stylesheet to add diff.css before rendering the template.

Internal Changes:

Description (last modified by Ryan J Ollos)

On a page such as /wiki/WikiStart?action=diff&version=2, the diff.css stylesheet is added to the page twice. I noticed this when trying to modify the CSS in the browser while working on #11403.

The issue happens for all the cases in which diff_view.html is used, since for each case there is a call to add_stylesheet in the Python code as well as the linking of the stylesheet in the template code:

$ grep -R "diff_view\.html" trac --exclude-dir=locale --exclude=*.pyc
trac/ticket/web_ui.py:        return 'diff_view.html', data, None
trac/ticket/web_ui.py:        return 'diff_view.html', data, None
trac/wiki/templates/wiki_diff.html:    <xi:include href="diff_view.html" />

The proposed change is:

  • trac/templates/diff_view.html

    diff --git a/trac/templates/diff_view.html b/trac/templates/diff_view.html
    index 3c74b8a..40542a2 100644
    a b  
    88  <xi:include href="layout.html" />
    99  <head>
    1010    <title>$title</title>
    11     <link rel="stylesheet" type="text/css" href="${chrome.htdocs_location}css/d
    1211    <meta name="ROBOTS" content="NOINDEX, NOFOLLOW" />
    1312  </head>

The issue seems to have been present ever since the template was added in [4347] (it was named ticket_diff.html at that time). #11126 also suggests making this change, but doesn't mention that diff.css is added to the page twice.

It might be better to make the change on the trunk rather than on 1.0-stable since we might be concerned that a plugin utilizing diff_view.html is expecting diff.css to be added by the template.

Attachments (0)

Change History (5)

comment:1 by Ryan J Ollos, 9 years ago

Description: modified (diff)

comment:2 by Jun Omae, 9 years ago

Looks good to me. Please commit it on trunk.

comment:3 by Ryan J Ollos, 9 years ago

API Changes: modified (diff)
Milestone: 1.1.2
Release Notes: modified (diff)
Resolution: fixed
Status: newclosed

Committed to trunk in [12337].

comment:4 by Ryan J Ollos, 9 years ago

API Changes: modified (diff)

comment:5 by Ryan J Ollos, 9 years ago

Description: modified (diff)
Keywords: css added

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.
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.