342
342
[navigation.scan_url, next_page_revno], **params)
345
def directory_breadcrumbs(path, is_root, view):
347
Generate breadcrumb information from the directory path given
349
The path given should be a path up to any branch that is currently being
353
path -- The path to convert into breadcrumbs
354
is_root -- Whether or not loggerhead is serving a branch at its root
355
view -- The type of view we are showing (files, changes etc)
357
# Is our root directory itself a branch?
359
if view == 'directory':
367
# Create breadcrumb trail for the path leading up to the branch
369
'dir_name': "(root)",
374
dir_parts = path.strip('/').split('/')
375
for index, dir_name in enumerate(dir_parts):
377
'dir_name': dir_name,
378
'path': '/'.join(dir_parts[:index + 1]),
381
# If we are not in the directory view, the last crumb is a branch,
382
# so we need to specify a view
383
if view != 'directory':
384
breadcrumbs[-1]['suffix'] = '/' + view
388
def branch_breadcrumbs(path, inv, view):
390
Generate breadcrumb information from the branch path given
392
The path given should be a path that exists within a branch
395
path -- The path to convert into breadcrumbs
396
inv -- Inventory to get file information from
397
view -- The type of view we are showing (files, changes etc)
399
dir_parts = path.strip('/').split('/')
400
inner_breadcrumbs = []
401
for index, dir_name in enumerate(dir_parts):
402
inner_breadcrumbs.append({
403
'dir_name': dir_name,
404
'file_id': inv.path2id('/'.join(dir_parts[:index + 1])),
405
'suffix': '/' + view ,
407
return inner_breadcrumbs
345
410
def decorator(unbound):
346
411
def new_decorator(f):