comparison mercurial/hgweb/hgwebdir_mod.py @ 18258:bebb05a7e249

hgweb: add a "URL breadcrumb" to the index and repository pages The purpose of this change is to make it much easier to navigate up the repository tree when the hg web server is used to serve more than one repository. A "URL breadcrumb" is a path where each of the path items can be clicked to go to the corresponding path page. This lets you go up the folder hierarchy very quickly. For example, when showing the list of repositories in http://myserver/myteams/myprojects, the following "breadcrumb" will be shown: Mercurial > myteams > myprojects Clicking on "myprojects" reloads the page. Clicking on "myteams" goes up one folder. Clicking on the leftmost "Mercurial" goes to the server root. This "breadcrumb" also appears on all repository pages. For example on the summary page of the repository at http://myserver/myteams/myprojects/myrepo the following will be shown: Mercurial > myteams > myprojects > myrepo / summary This change has been applied to all templates that already had a link to the main repository page (i.e. gitweb, monoblue, paper and coal) plus to the index page of the spartan template. In order to make the breadcumb links stand out the some of the template styles have been customized.
author Angel Ezquerra <angel.ezquerra at gmail.com>
date Wed, 28 Nov 2012 20:21:26 +0100
parents 2c1276825e93
children bf8bbbf4aa45
comparison
equal deleted inserted replaced
18257:a35d0128545e 18258:bebb05a7e249
10 from mercurial.i18n import _ 10 from mercurial.i18n import _
11 from mercurial import ui, hg, scmutil, util, templater 11 from mercurial import ui, hg, scmutil, util, templater
12 from mercurial import error, encoding 12 from mercurial import error, encoding
13 from common import ErrorResponse, get_mtime, staticfile, paritygen, \ 13 from common import ErrorResponse, get_mtime, staticfile, paritygen, \
14 get_contact, HTTP_OK, HTTP_NOT_FOUND, HTTP_SERVER_ERROR 14 get_contact, HTTP_OK, HTTP_NOT_FOUND, HTTP_SERVER_ERROR
15 from hgweb_mod import hgweb 15 from hgweb_mod import hgweb, makebreadcrumb
16 from request import wsgirequest 16 from request import wsgirequest
17 import webutil 17 import webutil
18 18
19 def cleannames(items): 19 def cleannames(items):
20 return [(util.pconvert(name).strip('/'), path) for name, path in items] 20 return [(util.pconvert(name).strip('/'), path) for name, path in items]
393 393
394 self.refresh() 394 self.refresh()
395 self.updatereqenv(req.env) 395 self.updatereqenv(req.env)
396 396
397 return tmpl("index", entries=entries, subdir=subdir, 397 return tmpl("index", entries=entries, subdir=subdir,
398 pathdef=makebreadcrumb('/' + subdir),
398 sortcolumn=sortcolumn, descending=descending, 399 sortcolumn=sortcolumn, descending=descending,
399 **dict(sort)) 400 **dict(sort))
400 401
401 def templater(self, req): 402 def templater(self, req):
402 403