599bf7cc32
for sake of sharing between themes
83 lines
2.8 KiB
Mako
83 lines
2.8 KiB
Mako
## -*- coding: utf-8; -*-
|
|
|
|
<%def name="make_simple_menu()">
|
|
|
|
% for topitem in menus:
|
|
<li>
|
|
<a>${topitem.title}</a>
|
|
<ul>
|
|
% for subitem in topitem.items:
|
|
<li>${h.link_to(subitem.title, subitem.url)}</li>
|
|
% endfor
|
|
</ul>
|
|
</li>
|
|
% endfor
|
|
|
|
## User Menu
|
|
% if request.user:
|
|
<li>
|
|
<a${' class="root-user"' if request.is_root else ''|n}>${request.user}${" ({})".format(inbox_count) if inbox_count else ''}</a>
|
|
<ul>
|
|
% if request.is_root:
|
|
<li class="root-user">${h.link_to("Stop being root", url('stop_root'))}</li>
|
|
% elif request.is_admin:
|
|
<li class="root-user">${h.link_to("Become root", url('become_root'))}</li>
|
|
% endif
|
|
<li>${h.link_to("Messages{}".format(" ({})".format(inbox_count) if inbox_count else ''), url('messages.inbox'))}</li>
|
|
<li>${h.link_to("Change Password", url('change_password'))}</li>
|
|
<li>${h.link_to("Logout", url('logout'))}</li>
|
|
</ul>
|
|
</li>
|
|
% else:
|
|
<li>${h.link_to("Login", url('login'))}</li>
|
|
% endif
|
|
|
|
</%def>
|
|
|
|
<%def name="main_menu_items()">
|
|
|
|
% if request.rattail_config.getbool('tailbone', 'menus.simple', default=False):
|
|
${self.make_simple_menu()}
|
|
% else:
|
|
|
|
% if request.has_any_perm('users.list', 'roles.list', 'settings.list', 'upgrades.list'):
|
|
<li>
|
|
<a>Admin</a>
|
|
<ul>
|
|
% if request.has_perm('users.list'):
|
|
<li>${h.link_to("Users", url('users'))}</li>
|
|
% endif
|
|
% if request.has_perm('roles.list'):
|
|
<li>${h.link_to("Roles", url('roles'))}</li>
|
|
% endif
|
|
% if request.has_perm('settings.list'):
|
|
<li>${h.link_to("Raw Settings", url('settings'))}</li>
|
|
% endif
|
|
% if request.has_perm('upgrades.list'):
|
|
<li>${h.link_to("Rattail Demo Upgrades", url('upgrades'))}</li>
|
|
% endif
|
|
</ul>
|
|
</li>
|
|
% endif
|
|
|
|
% if request.user:
|
|
<li>
|
|
<a${' class="root-user"' if request.is_root else ''|n}>${request.user}${" ({})".format(inbox_count) if inbox_count else ''}</a>
|
|
<ul>
|
|
% if request.is_root:
|
|
<li class="root-user">${h.link_to("Stop being root", url('stop_root'))}</li>
|
|
% elif request.is_admin:
|
|
<li class="root-user">${h.link_to("Become root", url('become_root'))}</li>
|
|
% endif
|
|
<li>${h.link_to("Messages{}".format(" ({})".format(inbox_count) if inbox_count else ''), url('messages.inbox'))}</li>
|
|
<li>${h.link_to("Change Password", url('change_password'))}</li>
|
|
<li>${h.link_to("Logout", url('logout'))}</li>
|
|
</ul>
|
|
</li>
|
|
% else:
|
|
<li>${h.link_to("Login", url('login'))}</li>
|
|
% endif
|
|
|
|
% endif
|
|
</%def>
|
|
|