Add "jump to" chooser in App Settings, for various "configure" pages

This commit is contained in:
Lance Edgar 2021-12-13 22:32:10 -06:00
parent 1244659064
commit 197d3de74a
2 changed files with 68 additions and 12 deletions

View file

@ -66,8 +66,11 @@
<div class="app-wrapper">
<div class="field-wrapper">
<label for="settings-group">Showing Group</label>
<div class="level">
<div class="level-left">
<div class="level-item">
<b-field label="Showing Group">
<b-select name="settings-group"
v-model="showingGroup">
<option value="">(All)</option>
@ -77,6 +80,26 @@
{{ group.label }}
</option>
</b-select>
</b-field>
</div>
</div>
<div class="level-right"
v-if="configOptions.length">
<div class="level-item">
<b-field label="Go To Configure...">
<b-select v-model="gotoConfigureURL"
@input="gotoConfigure()">
<option v-for="option in configOptions"
:key="option.url"
:value="option.url">
{{ option.label }}
</option>
</b-select>
</b-field>
</div>
</div>
</div>
<div v-for="group in groups"
@ -186,13 +209,20 @@
return {
formSubmitting: false,
formButtonText: ${json.dumps(getattr(form, 'submit_label', getattr(form, 'save_label', "Submit")))|n},
configOptions: ${json.dumps(config_options)|n},
gotoConfigureURL: null,
}
},
methods: {
submitForm() {
this.formSubmitting = true
this.formButtonText = "Working, please wait..."
},
gotoConfigure() {
if (this.gotoConfigureURL) {
location.href = this.gotoConfigureURL
}
},
}
})

View file

@ -125,6 +125,31 @@ class AppSettingsView(View):
if not current_group:
current_group = self.request.session.get('appsettings.current_group')
# TODO: this should come from somewhere else
possible_config_options = [
{'label': "DataSync",
'route': 'datasync.configure'},
{'label': "Email",
'route': 'emailprofiles.configure'},
{'label': "Importing / Exporting",
'route': 'importing.configure'},
{'label': "Products",
'route': 'products.configure'},
{'label': "Receiving",
'route': 'receiving.configure'},
{'label': "Reporting",
'route': 'report_output.configure'},
{'label': "Vendors",
'route': 'vendors.configure'},
]
config_options = []
for option in possible_config_options:
perm = option.get('perm', option['route'])
if self.request.has_perm(perm):
option['url'] = self.request.route_url(option['route'])
config_options.append(option)
use_buefy = self.get_use_buefy()
context = {
'index_title': "App Settings",
@ -133,6 +158,7 @@ class AppSettingsView(View):
'groups': groups,
'settings': settings,
'use_buefy': use_buefy,
'config_options': config_options,
}
if use_buefy:
context['buefy_data'] = self.get_buefy_data(form, groups, settings)