Update simple menus per newer conventions

This commit is contained in:
Lance Edgar 2019-04-02 21:47:10 -05:00
parent b0b7fc42b9
commit 5ebe3a001a
5 changed files with 23 additions and 36 deletions

View file

@ -215,21 +215,38 @@ def simple_menus(request):
'url': url('roles'),
'perm': 'roles.list',
},
{'type': 'sep'},
{
'title': "App Settings",
'url': url('appsettings'),
'perm': 'settings.list',
},
{
'title': "Email Settings",
'url': url('emailprofiles'),
'perm': 'emailprofiles.list',
},
{
'title': "Email Attempts",
'url': url('email_attempts'),
'perm': 'email_attempts.list',
},
{
'title': "Raw Settings",
'url': url('settings'),
'perm': 'settings.list',
},
{'type': 'sep'},
{
'title': "DataSync Changes",
'url': url('datasyncchanges'),
'perm': 'datasync.list',
},
{
'title': "Tables",
'url': url('tables'),
'perm': 'tables.list',
},
{
'title': "Rattail Demo Upgrades",
'url': url('upgrades'),

View file

@ -1,43 +1,10 @@
## -*- 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>
<%inherit file="tailbone:templates/menu.mako" />
<%def name="main_menu_items()">
% if request.rattail_config.getbool('tailbone', 'menus.simple', default=False):
${self.make_simple_menu()}
${parent.main_menu_items()}
% else:
% if request.has_any_perm('users.list', 'roles.list', 'settings.list', 'upgrades.list'):

View file

@ -12,6 +12,7 @@ def includeme(config):
config.include('rattail_demo.web.views.common')
config.include('rattail_demo.web.views.auth')
config.include('tailbone.views.progress')
config.include('tailbone.views.tables')
# main table views
config.include('tailbone.views.brands')

View file

@ -29,3 +29,4 @@ class ProfilesView(base.ProfilesView):
def includeme(config):
ProfilesView.defaults(config)
base.EmailPreview.defaults(config)
base.EmailAttemptView.defaults(config)

View file

@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
# -*- coding: utf-8; -*-
"""
Settings views
"""
@ -34,4 +34,5 @@ class SettingsView(base.SettingsView):
def includeme(config):
base.AppSettingsView.defaults(config)
SettingsView.defaults(config)