Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IMP] website_sale: Enhance category header & footer #162394

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 22 additions & 0 deletions addons/website_sale/models/product_public_category.py
Expand Up @@ -55,6 +55,28 @@ def _default_sequence(self):
translate=html_translate,
)

website_wide_header = fields.Html(
string="Category Wide Header",
sanitize_attributes=False, # required for the `data-editor-message` attribute.
sanitize_form=False,
translate=html_translate,
)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change


website_footer = fields.Html(
string="Category Footer",
sanitize_attributes=False, # required for the `data-editor-message` attribute.
sanitize_form=False,
translate=html_translate,
)

website_wide_footer = fields.Html(
string="Category Wide Footer",
sanitize_attributes=False, # required for the `data-editor-message` attribute.
sanitize_form=False,
translate=html_translate,
)

#=== COMPUTE METHODS ===#

def _compute_parents_and_self(self):
Expand Down
36 changes: 36 additions & 0 deletions addons/website_sale/views/templates.xml
Expand Up @@ -323,6 +323,18 @@
<div id="wrap" class="js_sale o_wsale_products_page">
<div class="oe_structure oe_empty oe_structure_not_nearest" id="oe_structure_website_sale_products_1"/>
<div class="container oe_website_sale pt-2">
<t t-if="category">
<t t-set='wide_header_editor_message'>
Drag building blocks here to customize the wide header for
"<t t-esc='category.name'/>" category.
</t>
<div
class="mb16"
id="category_wide_header"
t-att-data-editor-message="wide_header_editor_message"
t-field="category.website_wide_header"
/>
</t>
<div class="row o_wsale_products_main_row align-items-start flex-nowrap">
<aside t-if="hasLeftColumn" id="products_grid_before" class="d-none d-lg-block position-sticky col-3 px-3 clearfix">
<div class="o_wsale_products_grid_before_rail vh-100 ms-n2 mt-n2 pt-2 pe-lg-2 pb-lg-5 ps-2 overflow-y-scroll">
Expand Down Expand Up @@ -430,9 +442,33 @@
<div class="products_pager d-flex justify-content-center pt-5 pb-3">
<t t-call="website.pager"/>
</div>
<t t-if="category">
<t t-set='footer_editor_message'>
Drag building blocks here to customize the footer for
"<t t-esc='category.name'/>" category.
</t>
<div
class="mb16"
id="category_wide_footer"
t-att-data-editor-message="footer_editor_message"
t-field="category.website_footer"
/>
</t>
</div>
</div>

<t t-if="category">
<t t-set='wide_footer_editor_message'>
Drag building blocks here to customize the wide footer for
"<t t-esc='category.name'/>" category.
</t>
<div
class="mb16"
id="category_wide_footer"
t-att-data-editor-message="wide_footer_editor_message"
t-field="category.website_wide_footer"
/>
</t>
<t t-call="website_sale.o_wsale_offcanvas"/>
</div>
<div class="oe_structure oe_empty oe_structure_not_nearest" id="oe_structure_website_sale_products_2"/>
Expand Down