From 5ebe3a001af867bf6a737dab947b04744ea4cec5 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Tue, 2 Apr 2019 21:47:10 -0500 Subject: [PATCH] Update simple menus per newer conventions --- rattail_demo/web/menus.py | 17 +++++++++++++ rattail_demo/web/templates/menu.mako | 37 ++-------------------------- rattail_demo/web/views/__init__.py | 1 + rattail_demo/web/views/email.py | 1 + rattail_demo/web/views/settings.py | 3 ++- 5 files changed, 23 insertions(+), 36 deletions(-) diff --git a/rattail_demo/web/menus.py b/rattail_demo/web/menus.py index 48777fa..ecaa89c 100644 --- a/rattail_demo/web/menus.py +++ b/rattail_demo/web/menus.py @@ -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'), diff --git a/rattail_demo/web/templates/menu.mako b/rattail_demo/web/templates/menu.mako index 966e724..1b599a0 100644 --- a/rattail_demo/web/templates/menu.mako +++ b/rattail_demo/web/templates/menu.mako @@ -1,43 +1,10 @@ ## -*- coding: utf-8; -*- - -<%def name="make_simple_menu()"> - - % for topitem in menus: -
  • - ${topitem.title} - -
  • - % endfor - - ## User Menu - % if request.user: -
  • - ${request.user}${" ({})".format(inbox_count) if inbox_count else ''} -
      - % if request.is_root: -
    • ${h.link_to("Stop being root", url('stop_root'))}
    • - % elif request.is_admin: -
    • ${h.link_to("Become root", url('become_root'))}
    • - % endif -
    • ${h.link_to("Messages{}".format(" ({})".format(inbox_count) if inbox_count else ''), url('messages.inbox'))}
    • -
    • ${h.link_to("Change Password", url('change_password'))}
    • -
    • ${h.link_to("Logout", url('logout'))}
    • -
    -
  • - % else: -
  • ${h.link_to("Login", url('login'))}
  • - % endif - - +<%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'): diff --git a/rattail_demo/web/views/__init__.py b/rattail_demo/web/views/__init__.py index f32d45f..71f9d83 100644 --- a/rattail_demo/web/views/__init__.py +++ b/rattail_demo/web/views/__init__.py @@ -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') diff --git a/rattail_demo/web/views/email.py b/rattail_demo/web/views/email.py index 4343a5b..03d9a5b 100644 --- a/rattail_demo/web/views/email.py +++ b/rattail_demo/web/views/email.py @@ -29,3 +29,4 @@ class ProfilesView(base.ProfilesView): def includeme(config): ProfilesView.defaults(config) base.EmailPreview.defaults(config) + base.EmailAttemptView.defaults(config) diff --git a/rattail_demo/web/views/settings.py b/rattail_demo/web/views/settings.py index 42bf9b1..b7082a9 100644 --- a/rattail_demo/web/views/settings.py +++ b/rattail_demo/web/views/settings.py @@ -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)