Skip to content

Commit

Permalink
login/register to use build_nav_menu()
Browse files Browse the repository at this point in the history
  • Loading branch information
tobes committed May 17, 2012
1 parent a8d6424 commit 12c79ec
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 6 additions & 1 deletion ckan/lib/helpers.py
Expand Up @@ -363,10 +363,13 @@ def _make_menu_item(menu_item, title):
if menu_item not in _menu_items:
log.error('menu item `%s` cannot be found' % menu_item)
return literal('<li><a href="#">') + title + literal('</a></li>')
item = copy.copy(_menu_items[menu_item])
item = _menu_items[menu_item]
if 'name' in item:
link = nav_named_link(title, **item)
elif 'url' in item:
return literal('<li><a href="%s">' % item.url) + title + literal('</a></li>')
else:
item = copy.copy(_menu_items[menu_item])
controller = item.pop('controller')
link = nav_link(title, controller, **item)
return literal('<li>') + link + literal('</li>')
Expand All @@ -382,6 +385,8 @@ def default_group_type():
highlight_actions = 'new index search'),
'default_group': dict(name='%s_index' % default_group_type()),
'about' : dict(controller='home', action='about'),
'login' : dict(controller='user', action='login'),
'register' : dict(controller='user', action='register'),
}


Expand Down
3 changes: 1 addition & 2 deletions ckan/templates/header.html
Expand Up @@ -22,8 +22,7 @@ <h1><a href="${h.url('home')}">${g.site_title}</a></h1>
</div>
<nav class="account" py:if="not c.userobj">
<ul class="unstyled">
<li><a href="${h.url_for(controller='user',action='login')}">Login</a></li>
<li><a href="${h.url_for(controller='user',action='register')}">Register</a></li>
${h.build_nav_main(('login', _('Login')),('register', _('Register')))}
</ul>
</nav>
<nav>
Expand Down

0 comments on commit 12c79ec

Please sign in to comment.