Add basic config page for Products
This commit is contained in:
parent
1fbe429a08
commit
16bc3076ad
69
tailbone/templates/products/configure.mako
Normal file
69
tailbone/templates/products/configure.mako
Normal file
|
@ -0,0 +1,69 @@
|
|||
## -*- coding: utf-8; -*-
|
||||
<%inherit file="/configure.mako" />
|
||||
|
||||
<%def name="page_content()">
|
||||
${parent.page_content()}
|
||||
|
||||
<h3 class="block is-size-3">Key Field</h3>
|
||||
<div class="block" style="padding-left: 2rem;">
|
||||
|
||||
<b-field grouped>
|
||||
|
||||
<b-field label="Key Field">
|
||||
<b-select v-model="simpleSettings['rattail.product.key']"
|
||||
@input="updateKeyTitle()">
|
||||
<option value="upc">upc</option>
|
||||
<option value="item_id">item_id</option>
|
||||
<option value="scancode">scancode</option>
|
||||
</b-select>
|
||||
</b-field>
|
||||
|
||||
<b-field label="Key Field Label">
|
||||
<b-input v-model="simpleSettings['rattail.product.key_title']"
|
||||
@input="settingsNeedSaved = true">
|
||||
</b-input>
|
||||
</b-field>
|
||||
|
||||
</b-field>
|
||||
|
||||
</div>
|
||||
|
||||
<h3 class="block is-size-3">Display</h3>
|
||||
<div class="block" style="padding-left: 2rem;">
|
||||
|
||||
<b-field message="If a product has an image in the DB, that will still be preferred.">
|
||||
<b-checkbox v-model="simpleSettings['tailbone.products.show_pod_image']"
|
||||
@input="settingsNeedSaved = true">
|
||||
Show "POD" Images as fallback
|
||||
</b-checkbox>
|
||||
</b-field>
|
||||
|
||||
</div>
|
||||
</%def>
|
||||
|
||||
<%def name="modify_this_page_vars()">
|
||||
${parent.modify_this_page_vars()}
|
||||
<script type="text/javascript">
|
||||
|
||||
ThisPage.methods.getTitleForKey = function(key) {
|
||||
switch (key) {
|
||||
case 'item_id':
|
||||
return "Item ID"
|
||||
case 'scancode':
|
||||
return "Scancode"
|
||||
default:
|
||||
return "UPC"
|
||||
}
|
||||
}
|
||||
|
||||
ThisPage.methods.updateKeyTitle = function() {
|
||||
this.simpleSettings['rattail.product.key_title'] = this.getTitleForKey(
|
||||
this.simpleSettings['rattail.product.key'])
|
||||
this.settingsNeedSaved = true
|
||||
}
|
||||
|
||||
</script>
|
||||
</%def>
|
||||
|
||||
|
||||
${parent.body()}
|
|
@ -85,6 +85,7 @@ class ProductView(MasterView):
|
|||
has_versions = True
|
||||
results_downloadable_xlsx = True
|
||||
supports_autocomplete = True
|
||||
configurable = True
|
||||
|
||||
labels = {
|
||||
'item_id': "Item ID",
|
||||
|
@ -1906,6 +1907,22 @@ class ProductView(MasterView):
|
|||
if batch.batch_key == 'delproduct':
|
||||
return self.request.route_url('batch.delproduct.view', uuid=batch.uuid)
|
||||
|
||||
def configure_get_simple_settings(self):
|
||||
config = self.rattail_config
|
||||
return [
|
||||
|
||||
# key field
|
||||
{'section': 'rattail',
|
||||
'option': 'product.key'},
|
||||
{'section': 'rattail',
|
||||
'option': 'product.key_title'},
|
||||
|
||||
# display
|
||||
{'section': 'tailbone',
|
||||
'option': 'products.show_pod_image',
|
||||
'type': bool},
|
||||
]
|
||||
|
||||
@classmethod
|
||||
def defaults(cls, config):
|
||||
cls._product_defaults(config)
|
||||
|
|
Loading…
Reference in a new issue