From 0deb87c32efce924bf40f956d57af2969740411b Mon Sep 17 00:00:00 2001 From: ontowhee <82607723+ontowhee@users.noreply.github.com> Date: Fri, 13 Jun 2025 14:21:13 -0700 Subject: [PATCH 1/2] Added tabs for queues. --- trac-env/templates/django_theme.html | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/trac-env/templates/django_theme.html b/trac-env/templates/django_theme.html index d912622..e5d0f89 100644 --- a/trac-env/templates/django_theme.html +++ b/trac-env/templates/django_theme.html @@ -15,6 +15,31 @@ # endmacro +# macro navigation_queues() + +# endmacro + # macro main()
${navigation('mainnav')} + ${navigation_queues()}
Date: Sun, 15 Jun 2025 22:55:09 -0700 Subject: [PATCH 2/2] Added sub navigation bar items for queues. --- DjangoPlugin/tracdjangoplugin/plugins.py | 51 ++++++++++++++++++++++++ scss/trachacks.scss | 18 +++++++++ trac-env/conf/trac.ini | 7 ++++ trac-env/templates/django_theme.html | 29 ++------------ 4 files changed, 79 insertions(+), 26 deletions(-) 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 e5d0f89..f42f27b 100644 --- a/trac-env/templates/django_theme.html +++ b/trac-env/templates/django_theme.html @@ -15,31 +15,6 @@
# endmacro -# macro navigation_queues() - -# endmacro - # macro main()
${navigation('mainnav')} - ${navigation_queues()} + # if req.path_info == '/query': + ${navigation('subnav')} + # endif