#249: Provide ticket page with breadcrumb
--------------------------+-----------------------
Reporter: gjm | Owner: gjm
Type: enhancement | Status: review
Priority: major | Milestone: Release 3
Component: dashboard | Version:
Resolution: | Keywords:
--------------------------+-----------------------
Comment (by olemis):
I have reviewed changesets related to this ticket . I'd like to suggest
these modifications .
{{{
#!diff
diff -r 91f12ca0f720 bhtheme/templates/bh_path_ticket.html
--- a/bhtheme/templates/bh_path_ticket.html Mon Nov 05 01:25:57 2012
-0500
+++ b/bhtheme/templates/bh_path_ticket.html Mon Nov 05 03:30:40 2012
-0500
@@ -21,21 +21,35 @@
xmlns:py="http://genshi.edgewall.org/"
xmlns:i18n="http://genshi.edgewall.org/i18n"
xmlns:xi="http://www.w3.org/2001/XInclude"
- py:strip="">
+ py:strip="" py:if="ticket.exists"
+ py:with="
+ path_res = dict([realm, Resource(realm, ticket[realm])]
+ for realm in ['milestone', 'product']);
+ path_show = dict([realm, permname in req.perm(path_res[realm])]
+ for realm, permname in [('milestone', 'MILESTONE_VIEW'),
+ ('product', 'PRODUCT_VIEW')])">
<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}">
+ <li py:if="ticket.product">
+ <a href="${url_of(path_res.product)}" py:if="path_show.product">
+ ${shortname_of(path_res.product)}
+ </a>
+ <a py:if="not path_show.product"
+ href="${href.query(product=ticket['product'], active='!closed')}"
+ title="Active tickets for product ${ticket.product}">
${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}">
+ <li py:if="ticket.milestone">
+ <a href="${url_of(path_res.milestone)}" py:if="path_show.milestone">
+ ${shortname_of(path_res.milestone)}
+ </a>
+ <a py:if="not path_show.milestone"
+ title="Active tickets in milestone ${ticket.milestone}"
+ href="${href.query(milestone=ticket['milestone'],
active='!closed')}">
${ticket.milestone}
</a>
<span class="divider">/</span>
diff -r 91f12ca0f720 bhtheme/theme.py
--- a/bhtheme/theme.py Mon Nov 05 01:25:57 2012 -0500
+++ b/bhtheme/theme.py Mon Nov 05 03:30:40 2012 -0500
@@ -21,7 +21,6 @@
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
@@ -229,13 +228,8 @@
"""Insert Bootstrap scroll spy files.
"""
self._modify_scrollspy(req, template, data, content_type,
is_active)
- if data:
+ if data and data['ticket'].exists:
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.
}}}
I was actually trying to achieve something slightly different but it turn
outs that there's no possible way to render resource description in
context by calling `shortname_of` function . But mainly the goal is to
move permission checks out of source code and include it in the template .
Anyway , if approved it'd be nice to commit this together with
[comment:2:ticket:254 patch] fixing #254 .
--
Ticket URL: <https://issues.apache.org/bloodhound/ticket/249#comment:5>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound (incubating) issue tracker