Author: gjm
Date: Wed Apr 25 08:45:46 2012
New Revision: 1330156
URL: http://svn.apache.org/viewvc?rev=1330156&view=rev
Log:
theme: fixes to restrict disabling of trac provided css to the bloodhound theme
for #39, based on patch from Olemis
Modified:
incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bloodhound_theme.html
incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py
Modified:
incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bloodhound_theme.html
URL:
http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bloodhound_theme.html?rev=1330156&r1=1330155&r2=1330156&view=diff
==============================================================================
---
incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bloodhound_theme.html
(original)
+++
incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bloodhound_theme.html
Wed Apr 25 08:45:46 2012
@@ -11,7 +11,7 @@
<py:when test="title">${title}</py:when>
<py:otherwise>${project.name or 'Apache(TM) Bloodhound'}</py:otherwise>
</title>
- <link rel="stylesheet" href="/main/chrome/theme/bootstrap.css"
type="text/css" />
+ <link rel="stylesheet" href="${href.chrome('theme/bootstrap.css')}"
type="text/css" />
<py:if test="chrome.links">
<py:for each="rel, links in chrome.links.items()">
<link rel="${rel}" py:for="link in links" py:attrs="link"/>
Modified: incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py
URL:
http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py?rev=1330156&r1=1330155&r2=1330156&view=diff
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py (original)
+++ incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py Wed Apr 25
08:45:46 2012
@@ -28,7 +28,7 @@ from trac.web.api import Request, IReque
from trac.web.chrome import Chrome
from trac.web.main import RequestDispatcher
-from themeengine.api import ThemeBase
+from themeengine.api import ThemeBase, ThemeEngineSystem
from urlparse import urlparse
from wsgiref.util import setup_testing_defaults
@@ -84,7 +84,15 @@ class BloodhoundTheme(ThemeBase):
def post_process_request(self, req, template, data, content_type):
"""Post process request filter.
Removes all trac provided css if required"""
- if self.disable_all_trac_css:
+ def is_active_theme():
+ is_active = False
+ active_theme = ThemeEngineSystem(self.env).theme
+ if active_theme is not None:
+ this_theme_name = self.get_theme_names().next()
+ is_active = active_theme['name'] == this_theme_name
+ return is_active
+
+ if self.disable_all_trac_css and is_active_theme():
links = req.chrome.get('links',{})
stylesheets = links.get('stylesheet',[])
if stylesheets: