Misc. tweaks for App Details / Configure Menus

This commit is contained in:
Lance Edgar 2023-01-16 21:55:52 -06:00
parent 9b21d52206
commit 98fa6eea05
7 changed files with 68 additions and 22 deletions

View file

@ -2,7 +2,7 @@
################################################################################
#
# Rattail -- Retail Software Framework
# Copyright © 2010-2022 Lance Edgar
# Copyright © 2010-2023 Lance Edgar
#
# This file is part of Rattail.
#
@ -63,8 +63,8 @@ class MenuConfigView(View):
context = {
'config_title': "Menus",
'use_buefy': True,
'index_title': "App Settings",
'index_url': self.request.route_url('appsettings'),
'index_title': "App Details",
'index_url': self.request.route_url('appinfo'),
}
possible_index_options = sorted(
@ -173,9 +173,7 @@ class MenuConfigView(View):
'/configure-menus')
config.add_view(cls, attr='configure',
route_name='configure_menus',
# nb. must be root to configure menus! b/c
# otherwise some route options may be hidden
permission='admin',
permission='appinfo.configure',
renderer='/configure-menus.mako')
config.add_tailbone_config_page('configure_menus', "Menus", 'admin')

View file

@ -54,7 +54,7 @@ class AppInfoView(MasterView):
route_prefix = 'appinfo'
model_key = 'UNUSED'
model_title = "UNUSED"
model_title_plural = "App Info"
model_title_plural = "App Details"
creatable = False
viewable = False
editable = False
@ -70,7 +70,8 @@ class AppInfoView(MasterView):
]
def get_index_title(self):
return "App Info for {}".format(self.rattail_config.app_title())
return "{} for {}".format(self.get_model_title_plural(),
self.rattail_config.app_title())
def get_data(self, session=None):
pip = os.path.join(sys.prefix, 'bin', 'pip')
@ -95,6 +96,11 @@ class AppInfoView(MasterView):
'editable_project_location', foldcase=True)
g.set_searchable('editable_project_location')
def template_kwargs_index(self, **kwargs):
kwargs = super(AppInfoView, self).template_kwargs_index(**kwargs)
kwargs['configure_button_title'] = "Configure App"
return kwargs
def configure_get_context(self, **kwargs):
context = super(AppInfoView, self).configure_get_context(**kwargs)

View file

@ -86,6 +86,7 @@ class ModelViewView(MasterView):
g.sorters['label'] = g.make_simple_sorter('label')
g.set_sort_defaults('label')
g.set_link('label')
g.set_searchable('label')
# model_name
g.sorters['model_name'] = g.make_simple_sorter('model_name', foldcase=True)
@ -93,12 +94,14 @@ class ModelViewView(MasterView):
# route
g.sorters['route'] = g.make_simple_sorter('route')
g.set_searchable('route')
# permission
g.sorters['permission'] = g.make_simple_sorter('permission')
g.set_searchable('permission')
def default_view_url(self, view, i=None):
return self.request.route_url(view['route_prefix'])
def default_view_url(self):
return lambda view, i: self.request.route_url(view['route_prefix'])
def make_form_schema(self):
return ModelViewSchema()