Skip to content

Commit

Permalink
[UPDATE] Refine search bar styling and adjust parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
ElmerGForgeFlow committed Oct 24, 2023
1 parent 68eb500 commit 2263153
Showing 1 changed file with 3 additions and 43 deletions.
46 changes: 3 additions & 43 deletions website_search_header/views/templates.xml
Original file line number Diff line number Diff line change
@@ -1,59 +1,19 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>

<template
id="global_product_search_box"
inherit_id="website.website_search_box_input"
>
<xpath expr="//form//button" position="attributes">
<attribute name="t-attf-class" add="d-none" separator=" " />
</xpath>
</template>

<template id="global_product_search_box_input" name="Global Products search box">
<t t-call="website_search_header.global_product_search_box">
<t t-set="_form_classes" t-valuef="float-end d-none o_search_header" />
<t t-call="website.website_search_box_input">
<t t-set="_form_classes" t-valuef="float-end o_search_header ms-lg-2" />
<t t-set="search_type" t-valuef="all" />
<t t-set="action" t-valuef="/website/search" />
</t>
</template>

<template id="header_search_link" name="Header Search Link">
<div t-attf-class="#{_item_class} ms-auto">
<div t-attf-class="#{_item_class} ms-lg-auto">
<a t-attf-class="d-none #{_link_class}">
</a>
<t t-call="website_search_header.global_product_search_box_input" />
</div>
<div id="div_search_button" t-attf-class="#{_item_class} ms-2">
<a t-attf-class="d-none #{_link_class}">
</a>
<script type="text/javascript">
function test() {
if ($(".o_search_header").hasClass('d-none')) {
$(".o_search_header").removeClass('d-none');
$(".o_search_header").addClass('ms-2');
$("#search_btn_toggle_search i").removeClass('oi-search');
$("#div_search_button").removeClass('ms-2');
$("#search_btn_toggle_search i").addClass('oi-close');
} else {
$(".o_search_header").addClass('d-none');
$(".o_search_header").removeClass('ms-2');
$("#search_btn_toggle_search i").removeClass('oi-close');
$("#search_btn_toggle_search i").addClass('oi-search');
$("#div_search_button").addClass('ms-2');
}
}
</script>
<button
id="search_btn_toggle_search"
aria-label="Search"
t-attf-class="btn oe_search_button btn-primary"
title="Search"
onclick="test()"
>
<i class="oi oi-search" />
</button>
</div>
</template>

<template id="template_header_default" inherit_id="website.template_header_default">
Expand Down

0 comments on commit 2263153

Please sign in to comment.