bloodhound-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g..@apache.org
Subject svn commit: r1341394 - in /incubator/bloodhound/trunk/bloodhound_theme/bhtheme: htdocs/images/bh.ico theme.py
Date Tue, 22 May 2012 10:33:37 GMT
Author: gjm
Date: Tue May 22 10:33:36 2012
New Revision: 1341394

URL: http://svn.apache.org/viewvc?rev=1341394&view=rev
Log:
theme: use a bloodhound favicon when configuration does not specify a custom alternative

Added:
    incubator/bloodhound/trunk/bloodhound_theme/bhtheme/htdocs/images/bh.ico   (with props)
Modified:
    incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py

Added: incubator/bloodhound/trunk/bloodhound_theme/bhtheme/htdocs/images/bh.ico
URL: http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_theme/bhtheme/htdocs/images/bh.ico?rev=1341394&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/bloodhound/trunk/bloodhound_theme/bhtheme/htdocs/images/bh.ico
------------------------------------------------------------------------------
    svn:mime-type = image/x-icon

Modified: incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py
URL: http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py?rev=1341394&r1=1341393&r2=1341394&view=diff
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py (original)
+++ incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py Tue May 22 10:33:36 2012
@@ -17,6 +17,7 @@
 #  under the License.
 
 from trac.core import *
+from trac.mimeview.api import get_mimetype
 from trac.ticket.api import TicketSystem
 from trac.ticket.model import Ticket
 from trac.ticket.web_ui import TicketModule
@@ -111,11 +112,21 @@ class BloodhoundTheme(ThemeBase):
                 this_theme_name = self.get_theme_names().next()
                 is_active = active_theme['name'] == this_theme_name
             return is_active
+
+        links = req.chrome.get('links',{})
+        # replace favicon if appropriate
+        if self.env.project_icon == 'common/trac.ico':
+            bh_icon = 'theme/images/bh.ico'
+            new_icon = {'href': req.href.chrome(bh_icon),
+                        'type': get_mimetype(bh_icon)}
+            if links.get('icon'):
+                links.get('icon')[0].update(new_icon)
+            if links.get('shortcut icon'):
+                links.get('shortcut icon')[0].update(new_icon)
         
         is_active_theme = is_active_theme()
         if self.disable_all_trac_css and is_active_theme:
             if self.disable_all_trac_css:
-                links = req.chrome.get('links',{})
                 stylesheets = links.get('stylesheet',[])
                 if stylesheets:
                     path = req.base_path + '/chrome/common/css/'



Mime
View raw message