Add more basic config views, obviating some App Settings

This commit is contained in:
Lance Edgar 2021-12-13 21:33:10 -06:00
parent 16bc3076ad
commit 1244659064
8 changed files with 107 additions and 1 deletions

View file

@ -54,6 +54,8 @@ class EmailSettingView(MasterView):
pageable = False
creatable = False
deletable = False
configurable = True
config_title = "Email"
grid_columns = [
'key',
@ -224,6 +226,16 @@ class EmailSettingView(MasterView):
kwargs['email'] = self.handler.get_email(key)
return kwargs
def configure_get_simple_settings(self):
config = self.rattail_config
return [
# sending
{'section': 'rattail.mail',
'option': 'record_attempts',
'type': bool},
]
# TODO: deprecate / remove this
ProfilesView = EmailSettingView

View file

@ -287,6 +287,12 @@ class MasterView(View):
return self.request.has_perm('{}.{}'.format(
self.get_permission_prefix(), name))
@classmethod
def get_config_url(cls):
if hasattr(cls, 'config_url'):
return cls.config_url
return '{}/configure'.format(cls.get_url_prefix())
##############################
# Available Views
##############################
@ -4265,7 +4271,7 @@ class MasterView(View):
'{}.configure'.format(permission_prefix),
label="Configure {}".format(config_title))
config.add_route('{}.configure'.format(route_prefix),
'{}/configure'.format(url_prefix))
cls.get_config_url())
config.add_view(cls, attr='configure',
route_name='{}.configure'.format(route_prefix),
permission='{}.configure'.format(permission_prefix))

View file

@ -213,6 +213,9 @@ class ReportOutputView(ExportMasterView):
route_prefix = 'report_output'
url_prefix = '/reports/generated'
downloadable = True
configurable = True
config_title = "Reporting"
config_url = '/reports/configure'
grid_columns = [
'id',
@ -295,6 +298,16 @@ class ReportOutputView(ExportMasterView):
path = report.filepath(self.rattail_config)
return self.file_response(path)
def configure_get_simple_settings(self):
config = self.rattail_config
return [
# generating
{'section': 'tailbone',
'option': 'reporting.choosing_uses_form',
'type': bool},
]
class GenerateReport(View):
"""

View file

@ -43,6 +43,7 @@ class VendorView(MasterView):
has_versions = True
touchable = True
supports_autocomplete = True
configurable = True
labels = {
'id': "ID",
@ -168,6 +169,16 @@ class VendorView(MasterView):
(model.VendorContact, 'vendor_uuid'),
]
def configure_get_simple_settings(self):
config = self.rattail_config
return [
# display
{'section': 'rattail',
'option': 'vendor.use_autocomplete',
'type': bool},
]
def includeme(config):
VendorView.defaults(config)