incubator-bloodhound-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g..@apache.org
Subject svn commit: r1404963 - in /incubator/bloodhound/trunk/bloodhound_theme/bhtheme: templates/bh_path_ticket.html theme.py
Date Fri, 02 Nov 2012 13:58:04 GMT
Author: gjm
Date: Fri Nov  2 13:58:03 2012
New Revision: 1404963

URL: http://svn.apache.org/viewvc?rev=1404963&view=rev
Log:
adding a breadcrumb to the ticket view with links to dashboard views based on view resource
view permissions - towards #249

Added:
    incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_path_ticket.html   (with
props)
Modified:
    incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py

Added: incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_path_ticket.html
URL: http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_path_ticket.html?rev=1404963&view=auto
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_path_ticket.html (added)
+++ incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_path_ticket.html Fri
Nov  2 13:58:03 2012
@@ -0,0 +1,44 @@
+<!--!
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+<div xmlns="http://www.w3.org/1999/xhtml"
+     xmlns:py="http://genshi.edgewall.org/"
+     xmlns:i18n="http://genshi.edgewall.org/i18n"
+     xmlns:xi="http://www.w3.org/2001/XInclude"
+    py:strip="">
+  <li py:if="bhdb">
+    <a title="View the dashboard" href="${href.dashboard()}">Dashboard</a>
+    <span class="divider">/</span>
+  </li>
+  <li py:if="ticket.product" py:with="prodlink = path_show_product and href.products(ticket.product)
or href.query(product=ticket['product'], active='!closed')">
+    <a title="Active tickets for product ${ticket.product}"
+        href="${prodlink}">
+      ${ticket.product}
+    </a>
+    <span class="divider">/</span>
+  </li>
+  <li py:if="ticket.milestone" py:with="mslink = path_show_milestone and href.milestone(ticket.milestone)
or href.query(milestone=ticket['milestone'], active='!closed')">
+    <a title="Active tickets in milestone ${ticket.milestone}"
+        href="${mslink}">
+      ${ticket.milestone}
+    </a>
+    <span class="divider">/</span>
+  </li>
+  <li><span>Ticket #${ticket.id}</span></li>
+</div>

Propchange: incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_path_ticket.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_path_ticket.html
------------------------------------------------------------------------------
    svn:mime-type = text/html

Modified: incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py
URL: http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py?rev=1404963&r1=1404962&r2=1404963&view=diff
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py (original)
+++ incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py Fri Nov  2 13:58:03 2012
@@ -21,6 +21,7 @@ from genshi.filters.transform import Tra
 
 from trac.core import *
 from trac.mimeview.api import get_mimetype
+from trac.resource import Resource
 from trac.ticket.api import TicketSystem
 from trac.ticket.model import Ticket
 from trac.ticket.notification import TicketNotifyEmail
@@ -94,7 +95,7 @@ class BloodhoundTheme(ThemeBase):
         'report_edit.html' : ('bh_report_edit.html', None), 
         'report_list.html' : ('bh_report_list.html', None),
         'report_view.html' : ('bh_report_view.html', None),
-        'ticket.html' : ('bh_ticket.html', '_modify_scrollspy'),
+        'ticket.html' : ('bh_ticket.html', '_modify_ticket'),
         'ticket_preview.html' : ('bh_ticket_preview.html', None),
 
         # Multi Product
@@ -224,6 +225,18 @@ class BloodhoundTheme(ThemeBase):
         """
         add_stylesheet(req, 'dashboard/css/roadmap.css')
 
+    def _modify_ticket(self, req, template, data, content_type, is_active):
+        """Insert Bootstrap scroll spy files.
+        """
+        self._modify_scrollspy(req, template, data, content_type, is_active)
+        if data:
+            data['resourcepath_template'] = 'bh_path_ticket.html'
+            # determine path permissions
+            for resname, permname in [('milestone', 'MILESTONE_VIEW'),
+                                      ('product', 'PRODUCT_VIEW')]:
+                res = Resource(resname, data['ticket'][resname])
+                data['path_show_' + resname] = permname in req.perm(res)
+
     def _modify_scrollspy(self, req, template, data, content_type, is_active):
         """Insert Bootstrap scroll spy files.
         """



Mime
View raw message