Add "jump to" chooser in App Settings, for various "configure" pages
This commit is contained in:
parent
1244659064
commit
197d3de74a
|
@ -66,17 +66,40 @@
|
||||||
|
|
||||||
<div class="app-wrapper">
|
<div class="app-wrapper">
|
||||||
|
|
||||||
<div class="field-wrapper">
|
<div class="level">
|
||||||
<label for="settings-group">Showing Group</label>
|
|
||||||
<b-select name="settings-group"
|
<div class="level-left">
|
||||||
v-model="showingGroup">
|
<div class="level-item">
|
||||||
<option value="">(All)</option>
|
<b-field label="Showing Group">
|
||||||
<option v-for="group in groups"
|
<b-select name="settings-group"
|
||||||
:key="group.label"
|
v-model="showingGroup">
|
||||||
:value="group.label">
|
<option value="">(All)</option>
|
||||||
{{ group.label }}
|
<option v-for="group in groups"
|
||||||
</option>
|
:key="group.label"
|
||||||
</b-select>
|
:value="group.label">
|
||||||
|
{{ 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>
|
||||||
|
|
||||||
<div v-for="group in groups"
|
<div v-for="group in groups"
|
||||||
|
@ -186,13 +209,20 @@
|
||||||
return {
|
return {
|
||||||
formSubmitting: false,
|
formSubmitting: false,
|
||||||
formButtonText: ${json.dumps(getattr(form, 'submit_label', getattr(form, 'save_label', "Submit")))|n},
|
formButtonText: ${json.dumps(getattr(form, 'submit_label', getattr(form, 'save_label', "Submit")))|n},
|
||||||
|
configOptions: ${json.dumps(config_options)|n},
|
||||||
|
gotoConfigureURL: null,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
submitForm() {
|
submitForm() {
|
||||||
this.formSubmitting = true
|
this.formSubmitting = true
|
||||||
this.formButtonText = "Working, please wait..."
|
this.formButtonText = "Working, please wait..."
|
||||||
}
|
},
|
||||||
|
gotoConfigure() {
|
||||||
|
if (this.gotoConfigureURL) {
|
||||||
|
location.href = this.gotoConfigureURL
|
||||||
|
}
|
||||||
|
},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -125,6 +125,31 @@ class AppSettingsView(View):
|
||||||
if not current_group:
|
if not current_group:
|
||||||
current_group = self.request.session.get('appsettings.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()
|
use_buefy = self.get_use_buefy()
|
||||||
context = {
|
context = {
|
||||||
'index_title': "App Settings",
|
'index_title': "App Settings",
|
||||||
|
@ -133,6 +158,7 @@ class AppSettingsView(View):
|
||||||
'groups': groups,
|
'groups': groups,
|
||||||
'settings': settings,
|
'settings': settings,
|
||||||
'use_buefy': use_buefy,
|
'use_buefy': use_buefy,
|
||||||
|
'config_options': config_options,
|
||||||
}
|
}
|
||||||
if use_buefy:
|
if use_buefy:
|
||||||
context['buefy_data'] = self.get_buefy_data(form, groups, settings)
|
context['buefy_data'] = self.get_buefy_data(form, groups, settings)
|
||||||
|
|
Loading…
Reference in a new issue