Fix product view template for oruga/butterball

This commit is contained in:
Lance Edgar 2024-06-01 19:07:07 -05:00
parent 77eeb63b62
commit 1bf28eb286
3 changed files with 29 additions and 19 deletions

View file

@ -1157,6 +1157,10 @@ class Form(object):
return HTML.tag('div', class_='field-wrapper {}'.format(field_name), c=contents)
# nb. for some reason we must wrap once more for oruga,
# otherwise it splits up the field?!
value = HTML.tag('span', c=[value])
# oruga uses <o-field>
return HTML.tag('o-field', label=label, c=[value], **{':horizontal': 'true'})

View file

@ -4,6 +4,9 @@
<%def name="extra_styles()">
${parent.extra_styles()}
<style type="text/css">
nav.item-panel {
min-width: 600px;
}
#main-product-panel {
margin-right: 2em;
margin-top: 1em;
@ -22,18 +25,18 @@
</%def>
<%def name="left_column()">
<nav class="panel" id="pricing-panel">
<nav class="panel item-panel" id="pricing-panel">
<p class="panel-heading">Pricing</p>
<div class="panel-block">
<div>
<div style="width: 100%;">
${self.render_price_fields(form)}
</div>
</div>
</nav>
<nav class="panel">
<nav class="panel item-panel">
<p class="panel-heading">Flags</p>
<div class="panel-block">
<div>
<div style="width: 100%;">
${self.render_flag_fields(form)}
</div>
</div>
@ -54,10 +57,10 @@
<%def name="extra_main_fields(form)"></%def>
<%def name="organization_panel()">
<nav class="panel">
<nav class="panel item-panel">
<p class="panel-heading">Organization</p>
<div class="panel-block">
<div>
<div style="width: 100%;">
${self.render_organization_fields(form)}
</div>
</div>
@ -93,10 +96,10 @@
</%def>
<%def name="movement_panel()">
<nav class="panel">
<nav class="panel item-panel">
<p class="panel-heading">Movement</p>
<div class="panel-block">
<div>
<div style="width: 100%;">
${self.render_movement_fields(form)}
</div>
</div>
@ -112,7 +115,7 @@
</%def>
<%def name="lookup_codes_panel()">
<nav class="panel">
<nav class="panel item-panel">
<p class="panel-heading">Additional Lookup Codes</p>
<div class="panel-block">
${self.lookup_codes_grid()}
@ -125,7 +128,7 @@
</%def>
<%def name="sources_panel()">
<nav class="panel">
<nav class="panel item-panel">
<p class="panel-heading">
Vendor Sources
% if request.rattail_config.versioning_enabled() and master.has_perm('versions'):
@ -141,7 +144,7 @@
</%def>
<%def name="notes_panel()">
<nav class="panel">
<nav class="panel item-panel">
<p class="panel-heading">Notes</p>
<div class="panel-block">
<div class="field">${form.render_field_readonly('notes')}</div>
@ -150,7 +153,7 @@
</%def>
<%def name="ingredients_panel()">
<nav class="panel">
<nav class="panel item-panel">
<p class="panel-heading">Ingredients</p>
<div class="panel-block">
${form.render_field_readonly('ingredients')}
@ -247,11 +250,11 @@
<%def name="page_content()">
<div style="display: flex; flex-direction: column;">
<nav class="panel" id="main-product-panel">
<nav class="panel item-panel" id="main-product-panel">
<p class="panel-heading">Product</p>
<div class="panel-block">
<div style="display: flex; justify-content: space-between; width: 100%;">
<div>
<div style="display: flex; gap: 2rem; width: 100%;">
<div style="flex-grow: 1;">
${self.render_main_fields(form)}
</div>
<div>

View file

@ -445,9 +445,12 @@ class ProductView(MasterView):
if not text:
return history
text = HTML.tag('span', c=[text])
br = HTML.tag('br')
return HTML.tag('div', c=[text, br, history])
text = HTML.tag('p', c=[text])
history = HTML.tag('p', c=[history])
div = HTML.tag('div', c=[text, history])
# nb. for some reason we must wrap once more for oruga,
# otherwise it splits up the field?!
return HTML.tag('div', c=[div])
def show_price_effective_dates(self):
if not self.rattail_config.versioning_enabled():