I am adding a branch for the ctxtnav rewrite. So far only the wiki view
template/code has been reworked as an example. If no one vastly objects
to the API used (see below) it would be great if people could help out
porting modules. Its a very mechanical conversion, but there are a lot
to get through.

Two new functions are added to trac.web.chrome, add_ctxtnav(req, tag)
and prevnext_nav(req, prev, next, up). add_ctxtnav is the core of the
new API:

  add_ctxtnav(req,
              tag.a(_('Last Change'), href=req.href.wiki(page.name,
                                      action='diff',
                                      version=page.version)))

prevnext_nav takes the place of the macro of the same name:

   prevnext_nav(req, {
     'version': prev_version,
     'label': _('Version'),
     'href': req.href.wiki(page.name, version=prev_version),
     'title': _('Version %(num)s', num=prev_version),
   }, {
     'version': next_version,
     'label': _('Version'),
     'href': req.href.wiki(page.name, version=next_version),
     'title': _('Version %(num)s', num=next_version),
   }, {
     'label': _('View Latest Version'),
     'href': req.href.wiki(page.name, version=None),
   })

I'm not sure I like having prevnext_nav in trac.web.chrome, perhaps it
should move to a new trac.util.nav?

--Noah

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to