diff --git a/DjangoPlugin/tracdjangoplugin/plugins.py b/DjangoPlugin/tracdjangoplugin/plugins.py index 8438dd4..5bc3664 100644 --- a/DjangoPlugin/tracdjangoplugin/plugins.py +++ b/DjangoPlugin/tracdjangoplugin/plugins.py @@ -88,6 +88,57 @@ def get_navigation_items(self, req): ] +class CustomSubNavigationBar(Component): + """Add queue items for the sub navigation bar.""" + + implements(INavigationContributor) + + def get_active_navigation_item(self, req): + stage = req.args.get("stage") + has_patch = req.args.get("has_patch") + needs_better_patch = req.args.get("needs_better_patch") + + if stage == "Ready+for+checkin": + return "ready_for_checkin" + if stage == "Accepted" and has_patch == "0": + return "needs_patch" + if stage == "Accepted" and has_patch == "1" and needs_better_patch == "0": + return "needs_review" + if stage == "Accepted" and has_patch == "1" and needs_better_patch == "1": + return "waiting_on_author" + + return "unreviewed" + + def get_navigation_items(self, req): + return [ + ( + "subnav", + "unreviewed", + tag.a("Unreviewed", href="/query?stage=Unreviewed&status=!closed&order=changetime&desc=1"), + ), + ( + "subnav", + "needs_patch", + tag.a("Needs Patch", href="/query?has_patch=0&stage=Accepted&status=!closed&order=changetime&desc=1"), + ), + ( + "subnav", + "needs_review", + 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"), + ), + ( + "subnav", + "waiting_on_author", + tag.a("Waiting On Author", href="/query?has_patch=1&needs_better_patch=1&stage=Accepted&status=!closed&order=changetime&desc=1"), + ), + ( + "subnav", + "ready_for_checkin", + tag.a("Ready For Checkin", href="/query?stage=Ready+for+checkin&status=!closed&order=changetime&desc=1"), + ), + ] + + class GitHubBrowserWithSVNChangesets(GitHubBrowser): def _format_changeset_link(self, formatter, ns, chgset, label, fullmatch=None): # Dead-simple version for SVN changesets. diff --git a/scss/trachacks.scss b/scss/trachacks.scss index 2ec86b2..1d6160e 100644 --- a/scss/trachacks.scss +++ b/scss/trachacks.scss @@ -330,6 +330,24 @@ div[role="main"]{ } } + #subnav { + @include sans-serif; + + ul { + text-align: left; + + li { + &.active { + background: $green-medium; + a { + background: none; + color: $white; + } + } + } + } + } + #main { @include sans-serif; diff --git a/trac-env/conf/trac.ini b/trac-env/conf/trac.ini index d8bb307..c74ef95 100644 --- a/trac-env/conf/trac.ini +++ b/trac-env/conf/trac.ini @@ -84,6 +84,13 @@ tickets.order = 2.0 timeline.order = 4.0 wiki.order = 5.0 +[subnav] +unreviewed.order = 1.0 +needs_patch.order = 2.0 +needs_review.order = 3.0 +waiting_on_author.order = 4.0 +ready_for_checkin.order = 5.0 + [metanav] ; The metanav is hardcoded in templates/django_theme.html ; because it was too hard to make the login plugins play nice with each other diff --git a/trac-env/templates/django_theme.html b/trac-env/templates/django_theme.html index d912622..f42f27b 100644 --- a/trac-env/templates/django_theme.html +++ b/trac-env/templates/django_theme.html @@ -34,6 +34,9 @@ ${navigation('mainnav')} + # if req.path_info == '/query': + ${navigation('subnav')} + # endif