incubator-bloodhound-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g..@apache.org
Subject svn commit: r1354639 - /incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py
Date Wed, 27 Jun 2012 17:24:36 GMT
Author: gjm
Date: Wed Jun 27 17:24:35 2012
New Revision: 1354639

URL: http://svn.apache.org/viewvc?rev=1354639&view=rev
Log:
theme: show source tab to admins to give a link to documentation when no source is defined
- #20 (based on antony's patch)

Modified:
    incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py

Modified: incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py
URL: http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py?rev=1354639&r1=1354638&r2=1354639&view=diff
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py (original)
+++ incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py Wed Jun 27 17:24:35 2012
@@ -16,6 +16,7 @@
 #  specific language governing permissions and limitations
 #  under the License.
 
+from genshi.builder import tag
 from genshi.filters.transform import Transformer
 
 from trac.core import *
@@ -25,8 +26,10 @@ from trac.ticket.model import Ticket
 from trac.ticket.web_ui import TicketModule
 from trac.util.compat import set
 from trac.util.translation import _
+from trac.versioncontrol.web_ui.browser import BrowserModule
 from trac.web.api import IRequestFilter, IRequestHandler, ITemplateStreamFilter
-from trac.web.chrome import add_stylesheet, ITemplateProvider, prevnext_nav
+from trac.web.chrome import (add_stylesheet, INavigationContributor, 
+                             ITemplateProvider, prevnext_nav)
 
 from themeengine.api import ThemeBase, ThemeEngineSystem
 
@@ -105,7 +108,8 @@ class BloodhoundTheme(ThemeBase):
                 ['table', 'table-condensed']),
     )
 
-    implements(IRequestFilter, ITemplateProvider, ITemplateStreamFilter)
+    implements(IRequestFilter, INavigationContributor, ITemplateProvider,
+               ITemplateStreamFilter)
 
     # ITemplateStreamFilter methods
 
@@ -219,6 +223,19 @@ class BloodhoundTheme(ThemeBase):
         """
         add_stylesheet(req, 'dashboard/css/roadmap.css')
 
+    # INavigationContributor methods
+
+    def get_active_navigation_item(self, req):
+        return
+
+    def get_navigation_items(self, req):
+        if 'BROWSER_VIEW' in req.perm and 'VERSIONCONTROL_ADMIN' in req.perm:
+            bm = self.env[BrowserModule]
+            if bm and not list(bm.get_navigation_items(req)):
+                yield ('mainnav', 'browser', 
+                       tag.a(_('Browse Source'),
+                             href=req.href.wiki('TracRepositoryAdmin')))
+
 class QuickCreateTicketDialog(Component):
     implements(IRequestFilter, IRequestHandler)
 



Mime
View raw message