2017-08-13 22:37:38 -05:00
|
|
|
## -*- coding: utf-8; -*-
|
2016-12-07 20:24:11 -06:00
|
|
|
|
2018-11-29 01:40:18 -06:00
|
|
|
<%def name="make_simple_menu()">
|
2016-12-07 20:24:11 -06:00
|
|
|
|
2018-11-29 01:40:18 -06:00
|
|
|
% 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
|
2016-12-10 16:04:34 -06:00
|
|
|
|
2018-11-29 01:40:18 -06:00
|
|
|
## 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
|
2016-12-07 20:24:11 -06:00
|
|
|
|
2018-11-29 01:40:18 -06:00
|
|
|
</%def>
|
2018-11-22 11:16:59 -06:00
|
|
|
|
2018-11-29 01:40:18 -06:00
|
|
|
<%def name="main_menu_items()">
|
2016-12-07 20:24:11 -06:00
|
|
|
|
2018-11-29 01:40:18 -06:00
|
|
|
% if request.rattail_config.getbool('tailbone', 'menus.simple', default=False):
|
|
|
|
${self.make_simple_menu()}
|
|
|
|
% else:
|
2016-12-10 11:24:01 -06:00
|
|
|
|
2018-11-29 01:40:18 -06:00
|
|
|
% if request.has_any_perm('users.list', 'roles.list', 'settings.list', 'upgrades.list'):
|
2016-12-07 20:24:11 -06:00
|
|
|
<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
|
2018-11-26 22:08:41 -06:00
|
|
|
% if request.has_perm('settings.list'):
|
|
|
|
<li>${h.link_to("Raw Settings", url('settings'))}</li>
|
2016-12-10 14:16:37 -06:00
|
|
|
% endif
|
2017-08-13 22:37:38 -05:00
|
|
|
% if request.has_perm('upgrades.list'):
|
|
|
|
<li>${h.link_to("Rattail Demo Upgrades", url('upgrades'))}</li>
|
|
|
|
% endif
|
2016-12-07 20:24:11 -06:00
|
|
|
</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
|
2016-12-10 15:40:21 -06:00
|
|
|
<li>${h.link_to("Messages{}".format(" ({})".format(inbox_count) if inbox_count else ''), url('messages.inbox'))}</li>
|
2016-12-07 20:24:11 -06:00
|
|
|
<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
|
|
|
|
|
2018-11-29 01:40:18 -06:00
|
|
|
% endif
|
2016-12-07 20:24:11 -06:00
|
|
|
</%def>
|