Skip to content

Commit 5b8c4d2

Browse files
ElmerGForgeFlowReyes4711-S73
authored andcommitted
[MODIFY] website_search_header: Fixed issues in desktopSearch JavaScript function
1 parent dc2c08f commit 5b8c4d2

4 files changed

Lines changed: 29 additions & 22 deletions

File tree

‎website_search_header/README.rst‎

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Website Search in Header
77
!! This file is generated by oca-gen-addon-readme !!
88
!! changes will be overwritten. !!
99
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10-
!! source digest: sha256:d16cfb3e2bf08f7b6803f08d17d302e2ee86b04c1e4296db2ea051d1cb3dec43
10+
!! source digest: sha256:0190640b3113a806206eba0406254bfdb594eb50e99f4f870b3815401ff7621f
1111
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1212
1313
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
@@ -28,7 +28,7 @@ Website Search in Header
2828

2929
|badge1| |badge2| |badge3| |badge4| |badge5|
3030

31-
This module adds a search bar in the header of your website.
31+
This module adds a search bar in the header of your website
3232

3333
**Table of contents**
3434

@@ -40,18 +40,28 @@ Usage
4040

4141
On desktop, the user will be able to show and hide the search input in the website header. While on mobile our searchbox will behave by default.
4242

43+
Bug Tracker
44+
===========
45+
46+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/website/issues>`_.
47+
In case of trouble, please check there if your issue has already been reported.
48+
If you spotted it first, help us to smash it by providing a detailed and welcomed
49+
`feedback <https://github.com/OCA/website/issues/new?body=module:%20website_search_header%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
50+
51+
Do not contact contributors directly about support or help with technical issues.
52+
4353
Credits
4454
=======
4555

4656
Authors
4757
~~~~~~~
4858

4959
* ForgeFlow
50-
* Ooops
5160

5261
Contributors
5362
~~~~~~~~~~~~
5463

64+
5565
* Jordi Ballester <jordi.ballester@forgeflow.com>
5666
* Elmer García <elmer.garcia@forgeflow.com>
5767

‎website_search_header/static/description/index.html‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -367,10 +367,10 @@ <h1 class="title">Website Search in Header</h1>
367367
!! This file is generated by oca-gen-addon-readme !!
368368
!! changes will be overwritten. !!
369369
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
370-
!! source digest: sha256:d16cfb3e2bf08f7b6803f08d17d302e2ee86b04c1e4296db2ea051d1cb3dec43
370+
!! source digest: sha256:0190640b3113a806206eba0406254bfdb594eb50e99f4f870b3815401ff7621f
371371
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
372372
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/website/tree/16.0/website_search_header"><img alt="OCA/website" src="https://img.shields.io/badge/github-OCA%2Fwebsite-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/website-16-0/website-16-0-website_search_header"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/website&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
373-
<p>This module allows to restrict access to specific website pages to logged users.</p>
373+
<p>This module adds a search bar in the header of your website</p>
374374
<p><strong>Table of contents</strong></p>
375375
<div class="contents local topic" id="contents">
376376
<ul class="simple">
@@ -386,8 +386,7 @@ <h1 class="title">Website Search in Header</h1>
386386
</div>
387387
<div class="section" id="usage">
388388
<h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
389-
<p>Website &gt; Configuration &gt;&nbsp;Authorization required URLs: select a website and enter a relative path, eg: /shop</p>
390-
<p>When public user will try to access mywebsite.com/shop or any of its child pages, they will be requested to login.</p>
389+
<p>On desktop, the user will be able to show and hide the search input in the website header. While on mobile our searchbox will behave by default.</p>
391390
</div>
392391
<div class="section" id="bug-tracker">
393392
<h1><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h1>
@@ -409,7 +408,7 @@ <h2><a class="toc-backref" href="#toc-entry-4">Authors</a></h2>
409408
<div class="section" id="contributors">
410409
<h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
411410
<ul class="simple">
412-
<li>Ooops404 &lt;<a class="reference external" href="https://ooops404.com">https://ooops404.com</a>&gt;</li>
411+
<li>ForgeFlow &lt;<a class="reference external" href="https://www.forgeflow.com">https://www.forgeflow.com</a>&gt;</li>
413412
</ul>
414413
</div>
415414
<div class="section" id="maintainers">

‎website_search_header/static/src/js/website.js‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,19 @@ odoo.define("website_search_header.search_header", function (require) {
2727
},
2828

2929
desktopSearch: function () {
30-
if ($(".o_search_header").hasClass("d-lg-none")) {
31-
$(".o_search_header").removeClass("d-lg-none");
32-
$("#search_btn_toggle_search i").removeClass("oi-search");
33-
$("#search_btn_toggle_search i").addClass("oi-close");
34-
$("#div_search_header").removeClass("ms-lg-0");
35-
$("#div_search_button").removeClass("ms-lg-2");
36-
} else {
30+
if (!$(".o_search_header").hasClass("d-lg-none")) {
3731
$(".o_search_header").addClass("d-lg-none");
3832
$("#search_btn_toggle_search i").removeClass("oi-close");
3933
$("#search_btn_toggle_search i").addClass("oi-search");
4034
$("#div_search_header").addClass("ms-lg-0");
4135
$("#div_search_button").addClass("ms-lg-2");
36+
} else {
37+
$(".o_search_header").removeClass("d-lg-none");
38+
$("#search_btn_toggle_search i").removeClass("oi-search");
39+
$("#search_btn_toggle_search i").addClass("oi-close");
40+
$("#div_search_header").removeClass("ms-lg-0");
41+
$("#div_search_button").removeClass("ms-lg-2");
42+
$("input.oe_search_box").focus();
4243
}
4344
},
4445

‎website_search_header/views/templates.xml‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,19 @@
1212

1313
<template id="global_product_search_box_input" name="Global Products search box">
1414
<t t-call="website_search_header.global_product_search_box">
15-
<t
16-
t-set="_form_classes"
17-
t-valuef="float-end d-block d-lg-none o_search_header"
18-
/>
15+
<t t-set="_form_classes" t-valuef="float-end d-block o_search_header" />
1916
<t t-set="search_type" t-valuef="all" />
2017
<t t-set="action" t-valuef="/website/search" />
2118
</t>
2219
</template>
2320

2421
<template id="header_search_link" name="Header Search Link">
25-
<div id="div_search_header" t-attf-class="#{_item_class} ms-md-2 ms-lg-0">
22+
<div id="div_search_header" t-attf-class="#{_item_class} ms-md-2">
2623
<a t-attf-class="d-none #{_link_class}">
2724
</a>
2825
<t t-call="website_search_header.global_product_search_box_input" />
2926
</div>
30-
<div id="div_search_button" t-attf-class="#{_item_class} ms-lg-2">
27+
<div id="div_search_button" t-attf-class="#{_item_class}">
3128
<a t-attf-class="d-none #{_link_class}">
3229
</a>
3330
<button
@@ -36,7 +33,7 @@
3633
t-attf-class="btn oe_search_button btn-primary"
3734
title="Search"
3835
>
39-
<i class="oi oi-search" />
36+
<i class="oi oi-close" />
4037
</button>
4138
</div>
4239
</template>

0 commit comments

Comments
 (0)