Edgewall Software

Opened 19 years ago

Last modified 19 years ago

#1908 closed defect

add_stylesheet() should be able to handle plugin's resource — at Version 2

Reported by: Shunichi Goto <gotoh@…> Owned by: Christopher Lenz
Priority: high Milestone: 0.9
Component: general Version: devel
Severity: normal Keywords: chrome
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description (last modified by Christopher Lenz)

In r2064, trac.web.chrome.add_stylesheet() always makes a href to standard htdocs location. So webadmin and helloworldplugin cannot use its own css file.

Attached patch checks whether the specified stylesheet file is in trac's standard htdocs directory. If exist, makes href /trac/css/xxx.cs, or /proj/chrome/css/xxx.cs.

BTW, This means plugin cannot override existing one. Is it good? I think it might be ok that we always make link via /proj/chrome/

Change History (4)

by Shunichi Goto <gotoh@…>, 19 years ago

Patch of add_stylesheet() to support plugin's stylesheet

by Shunichi Goto <gotoh@…>, 19 years ago

Replaced. Previous attachment contains unused codes for my debug, sorry

comment:1 by Christopher Lenz, 19 years ago

Milestone: 0.9
Owner: changed from Jonas Borgström to Christopher Lenz
Priority: normallow
Status: newassigned

Note that this is only true if you have the htdocs_location set in trac.ini. If the option is omitted or left blank, the /chrome/ path will be used for all static file URLs.

Anyway, I'm planning to improve both add_stylesheet and the ITemplateProvider extension point to fix this issue.

comment:2 by Christopher Lenz, 19 years ago

Description: modified (diff)

(Fix formatting in description)

Note: See TracTickets for help on using tickets.