Edgewall Software
Modify

Opened 9 years ago

Closed 5 years ago

#12196 closed enhancement (fixed)

Link from milestone admin panel to milestone page

Reported by: anonymous Owned by: Ryan J Ollos
Priority: normal Milestone: 1.5.1
Component: admin/web Version:
Severity: normal Keywords:
Cc: Branch:
Release Notes:

Added View Milestone contextual navigation to the Admin milestone edit page.

API Changes:
Internal Changes:

Description

I often want to navigate from the milestone admin panel to the milestone page available from the roadmap.

I would add a link to the contextual navigation menu, or do admin panels not have those?

And maybe also add a link in the reverse direction if the user has admin permissions.

Attachments (0)

Change History (7)

comment:1 by Ryan J Ollos, 9 years ago

Keywords: bitesized added
Milestone: next-major-releases

comment:2 by anonymous, 7 years ago

  • trac/ticket/admin.py

    diff -r a3e91091080a trac/ticket/admin.py
    a b  
    2424                              get_datetime_format_hint, parse_date, user_time
    2525from trac.util.text import exception_to_unicode, print_table, printout
    2626from trac.util.translation import _, N_, gettext
    27 from trac.web.chrome import Chrome, add_notice, add_script, add_warning
     27from trac.web.chrome import Chrome, add_ctxtnav, add_notice, add_script, \
     28                            add_warning
    2829
    2930
    3031class TicketAdminPanel(Component):
     
    252253            chrome = Chrome(self.env)
    253254            chrome.add_wiki_toolbars(req)
    254255            chrome.add_auto_preview(req)
     256            add_ctxtnav(req, _("View on Roadmap"),
     257                        req.href.milestone(milestone_name))
     258            add_ctxtnav(req, _("Edit on Roadmap"),
     259                        req.href.milestone(milestone_name, action='edit'))
    255260            data = {'view': 'detail',
    256261                    'milestone': milestone,
    257262                    'default_due': milestone_module.get_default_due(req)}
  • trac/ticket/roadmap.py

    diff -r a3e91091080a trac/ticket/roadmap.py
    a b  
    4242from trac.timeline.api import ITimelineEventProvider
    4343from trac.web.api import HTTPBadRequest, IRequestHandler, RequestDone
    4444from trac.web.chrome import (Chrome, INavigationContributor, accesskey,
    45                              add_link, add_notice, add_stylesheet, add_warning,
    46                              auth_link, prevnext_nav, web_context)
     45                             add_ctxtnav, add_link, add_notice,
     46                             add_stylesheet, add_warning, auth_link,
     47                             prevnext_nav, web_context)
    4748from trac.wiki.api import IWikiSyntaxProvider
    4849from trac.wiki.formatter import format_to
    4950
     
    10531054            if idx < len(milestones) - 1:
    10541055                add_milestone_link('next', milestones[idx + 1])
    10551056                add_milestone_link('last', milestones[-1])
     1057        add_ctxtnav(req, _("Admin"),
     1058                    req.href.admin('ticket', 'milestones', milestone.name))
    10561059        prevnext_nav(req, _("Previous Milestone"), _("Next Milestone"),
    10571060                     _("Back to Roadmap"))

in reply to:  description comment:3 by anonymous, 7 years ago

if the user has admin permissions.

I'm not exactly sure what the right permission check is. Looking at the existing code possibly this:

  • trac/ticket/roadmap.py

    diff -r a3e91091080a trac/ticket/roadmap.py
    a b  
    10371038
    10381039        add_stylesheet(req, 'common/css/roadmap.css')
    10391040
     1041        admin_perm = req.perm('admin', 'ticket/milestones')
     1042        if 'MILESTONE_ADMIN' in admin_perm or \
     1043                'MILESTONE_MODIFY' in admin_perm and 'TICKET_ADMIN' in admin_perm:
     1044            add_ctxtnav(req, _("Admin"),
     1045                        req.href.admin('ticket', 'milestones', milestone.name))
     1046
    10401047        def add_milestone_link(rel, milestone):
    10411048            href = req.href.milestone(milestone.name, by=req.args.get('by'))
    10421049            add_link(req, rel, href, _('Milestone "%(name)s"',

comment:4 by anonymous, 6 years ago

Keywords: patch review added

Please can you let me know what is missing in the patches above for Trac? They would be very helpful. Thanks! 🎅

comment:5 by Ryan J Ollos, 5 years ago

Milestone: next-major-releases1.5.1
Owner: set to Ryan J Ollos
Status: newassigned
  1. View on Roadmap looks useful, though I'd name it View Milestone.
  2. What is the reason for Edit on Roadmap? After #3754 is implemented, it's just the same edit page set within a different context.
  3. Same thought as (2) for the Admin link from the Edit Milestone page.
  4. A link to the Milestone from the Manage Milestone page (/admin/ticket/milestones) would be useful, but I'm not sure where to put it. The Name column could link to the milestone if we had an Edit link (such as: [✎ Edit], see Wiki History page for example) somewhere: to the left or right of the table, or to the right of the link in the name column.

Unless there's an idea for (4), I propose to just commit this change:

  • trac/ticket/admin.py

    diff --git a/trac/ticket/admin.py b/trac/ticket/admin.py
    index acc2df617..93d2766b8 100644
    a b from trac.util.datefmt import format_date, format_datetime, \  
    2424                              get_datetime_format_hint, parse_date, user_time
    2525from trac.util.text import exception_to_unicode, print_table, printout
    2626from trac.util.translation import _, N_, gettext
    27 from trac.web.chrome import Chrome, add_notice, add_script, add_warning
     27from trac.web.chrome import Chrome, add_ctxtnav, add_notice, add_script, \
     28                            add_warning
    2829
    2930
    3031class TicketAdminPanel(Component):
    class MilestoneAdminPanel(TicketAdminPanel):  
    252253            chrome = Chrome(self.env)
    253254            chrome.add_wiki_toolbars(req)
    254255            chrome.add_auto_preview(req)
     256            add_ctxtnav(req, _("View Milestone"),
     257                        req.href.milestone(milestone_name))
    255258            data = {'view': 'detail',
    256259                    'milestone': milestone,
    257260                    'default_due': milestone_module.get_default_due(req)}

in reply to:  5 comment:6 by anonymous, 5 years ago

  1. View on Roadmap looks useful, though I'd name it View Milestone.

Agree, sounds good.

  1. What is the reason for Edit on Roadmap? After #3754 is implemented, it's just the same edit page set within a different context.

Agree. The idea was "we are already in the (admin) edit milestone view so we apparently want to edit the milestone, so allow to go directly to the (roadmap) edit milestone view to use the more advanced editing features there". if #3754 is implemented and makes all the advanced editing features available on the admin page already, then the Edit on Roadmap link is not urgently needed.

  1. Same thought as (2) for the Admin link from the Edit Milestone page.

Maybe it is not urgently needed. I think navigation from roadmap to admin panel could be useful just in case (maybe in the future or with some plugin it is still needed), for completeness (after navigating from admin panel to roadmap you get "stuck" and can not easily return to the admin panel), and for discoverability (new users may not be aware of related admin panel).

  1. A link to the Milestone from the Manage Milestone page (/admin/ticket/milestones) would be useful, but I'm not sure where to put it. The Name column could link to the milestone if we had an Edit link (such as: [✎ Edit], see Wiki History page for example) somewhere: to the left or right of the table, or to the right of the link in the name column.

Unless there's an idea for (4)

Agree it could be nice, but there is no obvious good place. Contextual navigation links was the best "workaround" I could find.

I propose to just commit this change:

Looks good, thanks! 🥮

comment:7 by Ryan J Ollos, 5 years ago

Keywords: bitesized patch review removed
Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

comment:5 patch committed in r17168.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Ryan J Ollos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.