Skip to content

Commit

Permalink
Render breadcrumbs using bootstrap.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Howitz authored and dwt committed Jun 12, 2018
1 parent 7172f07 commit 0ad2f9f
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 22 deletions.
20 changes: 11 additions & 9 deletions src/App/Management.py
Expand Up @@ -89,20 +89,22 @@ def manage_workspace(self, REQUEST):
def tabs_path_default(self, REQUEST):
steps = REQUEST._steps[:-1]
script = REQUEST['BASEPATH1']
linkpat = '<a href="%s/manage_workspace">%s</a>'
out = []
url = linkpat % (escape(script, True), '&nbsp;/')
linkpat = '{}/manage_workspace'
yield {'url': linkpat.format(escape(script, True)),
'title': 'Root',
'last': not bool(steps)}
if not steps:
return url
return
last = steps.pop()
for step in steps:
script = '%s/%s' % (script, step)
out.append(linkpat % (escape(script, True), escape(unquote(step))))
yield {'url': linkpat.format(escape(script, True)),
'title': escape(unquote(step)),
'last': False}
script = '%s/%s' % (script, last)
out.append(
'<a class="strong-link" href="%s/manage_workspace">%s</a>' %
(escape(script, True), escape(unquote(last), False)))
return '%s%s' % (url, '/'.join(out))
yield {'url': linkpat.format(escape(script, True)),
'title': escape(unquote(last)),
'last': True}

def tabs_path_info(self, script, path):
out = []
Expand Down
35 changes: 22 additions & 13 deletions src/App/dtml/manage_tabs.dtml
Expand Up @@ -32,19 +32,28 @@
</dtml-if>

<dtml-unless MANAGE_TABS_NO_BANNER>
<p>
<strong>
<dtml-if meta_type>
&dtml-meta_type;
<dtml-else>
Object
</dtml-if>
</strong>
at <dtml-var expr="tabs_path_default(REQUEST)">
<dtml-if wl_isLocked>
<span class="badge badge-warning">Locked</span>
</dtml-if wl_isLocked>
</p>
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<dtml-in expr="tabs_path_default(REQUEST)" mapping>
<li class="breadcrumb-item<dtml-if last> active</dtml-if>"
<dtml-if last> aria-current="page"</dtml-if>>
<dtml-if last>
&dtml-title;
<strong class="ml-1">
<span class="&dtml-zmi_icon;"
title="&dtml-meta_type;"></span>
<dtml-if meta_type>&dtml-meta_type;<dtml-else>Object</dtml-if>
</strong>
<dtml-if wl_isLocked>
<span class="badge badge-warning">Locked</span>
</dtml-if wl_isLocked>
<dtml-else>
<a href="&dtml-url;">&dtml-title;</a>
</dtml-if>
</li>
</dtml-in>
</ol>
</nav>
</dtml-unless>

<dtml-if manage_tabs_message>
Expand Down

0 comments on commit 0ad2f9f

Please sign in to comment.