Skip to content

Commit 72675ad

Browse files
committed
Added sub navigation bar items for queues.
1 parent 0deb87c commit 72675ad

File tree

4 files changed

+80
-27
lines changed

4 files changed

+80
-27
lines changed

DjangoPlugin/tracdjangoplugin/plugins.py

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,57 @@ def get_navigation_items(self, req):
8888
]
8989

9090

91+
class CustomUnreviewed(Component):
92+
"""Add Unreviewed item to queue navigation bar."""
93+
94+
implements(INavigationContributor)
95+
96+
def get_active_navigation_item(self, req):
97+
stage = req.args.get("stage")
98+
has_patch = req.args.get("has_patch")
99+
needs_better_patch = req.args.get("needs_better_patch")
100+
101+
if stage == "Ready+for+checkin":
102+
return "ready_for_checkin"
103+
if stage == "Accepted" and has_patch == "0":
104+
return "needs_patch"
105+
if stage == "Accepted" and has_patch == "1" and needs_better_patch == "0":
106+
return "needs_review"
107+
if stage == "Accepted" and has_patch == "1" and needs_better_patch == "1":
108+
return "waiting_on_author"
109+
110+
return "unreviewed"
111+
112+
def get_navigation_items(self, req):
113+
return [
114+
(
115+
"subnav",
116+
"unreviewed",
117+
tag.a("Unreviewed", href="/query?stage=Unreviewed&status=!closed&order=changetime&desc=1"),
118+
),
119+
(
120+
"subnav",
121+
"needs_patch",
122+
tag.a("Needs Patch", href="/query?has_patch=0&stage=Accepted&status=!closed&order=changetime&desc=1"),
123+
),
124+
(
125+
"subnav",
126+
"needs_review",
127+
tag.a("Needs Review", href="/query?has_patch=1&needs_better_patch=0&needs_docs=0&needs_tests=0&stage=Accepted&status=!closed&order=changetime&desc=1"),
128+
),
129+
(
130+
"subnav",
131+
"waiting_on_author",
132+
tag.a("Waiting On Author", href="/query?has_patch=1&needs_better_patch=1&stage=Accepted&status=!closed&order=changetime&desc=1"),
133+
),
134+
(
135+
"subnav",
136+
"ready_for_checkin",
137+
tag.a("Ready For Checkin", href="/query?stage=Ready+for+checkin&status=!closed&order=changetime&desc=1"),
138+
),
139+
]
140+
141+
91142
class GitHubBrowserWithSVNChangesets(GitHubBrowser):
92143
def _format_changeset_link(self, formatter, ns, chgset, label, fullmatch=None):
93144
# Dead-simple version for SVN changesets.

scss/trachacks.scss

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,24 @@ div[role="main"]{
330330
}
331331
}
332332

333+
#subnav {
334+
@include sans-serif;
335+
336+
ul {
337+
text-align: left;
338+
339+
li {
340+
&.active {
341+
background: $green-medium;
342+
a {
343+
background: none;
344+
color: $white;
345+
}
346+
}
347+
}
348+
}
349+
}
350+
333351
#main {
334352
@include sans-serif;
335353

trac-env/conf/trac.ini

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,13 @@ tickets.order = 2.0
8484
timeline.order = 4.0
8585
wiki.order = 5.0
8686

87+
[subnav]
88+
unreviewed.order = 1.0
89+
needs_patch.order = 2.0
90+
needs_review.order = 3.0
91+
waiting_on_author.order = 4.0
92+
ready_for_checkin.order = 5.0
93+
8794
[metanav]
8895
; The metanav is hardcoded in templates/django_theme.html
8996
; because it was too hard to make the login plugins play nice with each other
@@ -275,7 +282,7 @@ ticket_show_component = enabled
275282
auth_cookie_lifetime = 1209600
276283
base_url = https://code.djangoproject.com
277284
check_auth_ip = enabled
278-
database = postgres://code.djangoproject@/code.djangoproject
285+
database = postgres://code.djangoproject:secret@db/code.djangoproject
279286
default_charset = utf-8
280287
default_handler = CustomWikiModule
281288
ignore_auth_case = disabled

trac-env/templates/django_theme.html

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -15,31 +15,6 @@
1515
</div>
1616
# endmacro
1717

18-
# macro navigation_queues()
19-
<div id="mainnav_queues" class="nav">
20-
<ul>
21-
<li class="first">
22-
<a href="/query?stage=Unreviewed&status=!closed&order=priority">Unreviewed</a>
23-
</li>
24-
<li>
25-
<a href="/query?has_patch=0&stage=Accepted&status=!closed&order=priority">Needs Patch</a>
26-
</li>
27-
<li>
28-
<a href="/query?has_patch=1&needs_better_patch=0&needs_docs=0&needs_tests=0&stage=Accepted&status=!closed&order=changetime&desc=1">Needs Review</a>
29-
</li>
30-
<li>
31-
<a href="/query?has_patch=1&needs_better_patch=1&stage=Accepted&status=!closed&order=priority">Waiting On Author</a>
32-
</li>
33-
<li>
34-
<a href="/query?stage=Ready+for+checkin&status=!closed&order=priority">Ready For Checkin</a>
35-
</li>
36-
<li class="last">
37-
<a href="/query">Custom Query</a>
38-
</li>
39-
</ul>
40-
</div>
41-
# endmacro
42-
4318
# macro main()
4419
<div role="main">
4520
<div id="metanav" class="nav">
@@ -59,7 +34,9 @@
5934
</ul>
6035
</div>
6136
${navigation('mainnav')}
62-
${navigation_queues()}
37+
# if req.path_info == '/query':
38+
${navigation('subnav')}
39+
# endif
6340
<div id="main" ${{'class': {
6441
'uisymbols': req.session.get('ui.use_symbols'),
6542
'uinohelp': req.session.get('ui.hide_help'),

0 commit comments

Comments
 (0)