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) 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> # oruga uses <o-field>
return HTML.tag('o-field', label=label, c=[value], **{':horizontal': 'true'}) return HTML.tag('o-field', label=label, c=[value], **{':horizontal': 'true'})

View file

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

View file

@ -445,9 +445,12 @@ class ProductView(MasterView):
if not text: if not text:
return history return history
text = HTML.tag('span', c=[text]) text = HTML.tag('p', c=[text])
br = HTML.tag('br') history = HTML.tag('p', c=[history])
return HTML.tag('div', c=[text, br, 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): def show_price_effective_dates(self):
if not self.rattail_config.versioning_enabled(): if not self.rattail_config.versioning_enabled():