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

@ -24,6 +24,7 @@
<ul class="block">
<li class="is-family-monospace">/datasync/configure.mako</li>
<li class="is-family-monospace">/importing/configure.mako</li>
<li class="is-family-monospace">/products/configure.mako</li>
<li class="is-family-monospace">/receiving/configure.mako</li>
</ul>

View file

@ -0,0 +1,21 @@
## -*- coding: utf-8; -*-
<%inherit file="/configure.mako" />
<%def name="page_content()">
${parent.page_content()}
<h3 class="block is-size-3">Generating</h3>
<div class="block" style="padding-left: 2rem;">
<b-field message="If not set, reports are shown as simple list of hyperlinks.">
<b-checkbox v-model="simpleSettings['tailbone.reporting.choosing_uses_form']"
@input="settingsNeedSaved = true">
Show report chooser as form, with dropdown
</b-checkbox>
</b-field>
</div>
</%def>
${parent.body()}

View file

@ -0,0 +1,21 @@
## -*- coding: utf-8; -*-
<%inherit file="/configure.mako" />
<%def name="page_content()">
${parent.page_content()}
<h3 class="block is-size-3">Sending</h3>
<div class="block" style="padding-left: 2rem;">
<b-field>
<b-checkbox v-model="simpleSettings['rattail.mail.record_attempts']"
@input="settingsNeedSaved = true">
Make record of all attempts to send email
</b-checkbox>
</b-field>
</div>
</%def>
${parent.body()}

View file

@ -0,0 +1,21 @@
## -*- coding: utf-8; -*-
<%inherit file="/configure.mako" />
<%def name="page_content()">
${parent.page_content()}
<h3 class="block is-size-3">Display</h3>
<div class="block" style="padding-left: 2rem;">
<b-field message="If not set, vendor chooser is a dropdown field.">
<b-checkbox v-model="simpleSettings['rattail.vendor.use_autocomplete']"
@input="settingsNeedSaved = true">
Show vendor chooser as autocomplete field
</b-checkbox>
</b-field>
</div>
</%def>
${parent.body()}

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)