-
-
Notifications
You must be signed in to change notification settings - Fork 697
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[17.0][MIG] website_search_header: Migration to 17.0
- Loading branch information
1 parent
ff6f870
commit 5292cf4
Showing
11 changed files
with
96 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[build-system] | ||
requires = ["whool"] | ||
build-backend = "whool.buildapi" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
- ForgeFlow \<<https://www.forgeflow.com>\> | ||
- Kencove \<<https://www.kencove.com/>\> |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
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. |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,43 @@ | ||
odoo.define("website_search_header.search_header", function (require) { | ||
(function () { | ||
"use strict"; | ||
|
||
const publicWidget = require("web.public.widget"); | ||
|
||
publicWidget.registry.SearchHeader = publicWidget.Widget.extend({ | ||
selector: "#div_search_button", | ||
|
||
events: { | ||
"click #search_btn_toggle_search": "_onClickSearchBtn", | ||
}, | ||
|
||
start: function () { | ||
const def = this._super.apply(this, arguments); | ||
this.$boxInput = this.$el.find(".o_search_header"); | ||
return def; | ||
}, | ||
|
||
mobileSearch: function () { | ||
if (!this.$boxInput.hasClass("d-none")) { | ||
this.$boxInput.addClass("d-none"); | ||
} | ||
var searchQuery = document.querySelector("input[name='search']").value; | ||
var encodedQuery = encodeURIComponent(searchQuery); | ||
var searchURL = this._getSearchUrl(encodedQuery); | ||
window.location.href = searchURL; | ||
}, | ||
|
||
desktopSearch: function () { | ||
if (!$(".o_search_header").hasClass("d-lg-none")) { | ||
$(".o_search_header").addClass("d-lg-none"); | ||
$("#search_btn_toggle_search i").removeClass("oi-close"); | ||
$("#search_btn_toggle_search i").addClass("oi-search"); | ||
$("#div_search_header").addClass("ms-lg-0"); | ||
$("#div_search_button").addClass("ms-lg-2"); | ||
} else { | ||
$(".o_search_header").removeClass("d-lg-none"); | ||
$("#search_btn_toggle_search i").removeClass("oi-search"); | ||
$("#search_btn_toggle_search i").addClass("oi-close"); | ||
$("#div_search_header").removeClass("ms-lg-0"); | ||
$("#div_search_button").removeClass("ms-lg-2"); | ||
$("input.oe_search_box").focus(); | ||
} | ||
}, | ||
|
||
_onClickSearchBtn: function () { | ||
var screenWidth = | ||
window.innerWidth || | ||
document.documentElement.clientWidth || | ||
document.body.clientWidth; | ||
if (screenWidth < 992) { | ||
this.mobileSearch(); | ||
} else { | ||
this.desktopSearch(); | ||
} | ||
}, | ||
|
||
_getSearchUrl: function (encodedQuery) { | ||
return "/website/search?search=" + encodedQuery + "&order=name+asc"; | ||
}, | ||
}); | ||
}); | ||
function mobileSearch() { | ||
if (!this.$boxInput.hasClass("d-none")) { | ||
this.$boxInput.addClass("d-none"); | ||
} | ||
var searchQuery = document.querySelector("input[name='search']").value; | ||
var encodedQuery = encodeURIComponent(searchQuery); | ||
var searchURL = this._getSearchUrl(encodedQuery); | ||
window.location.href = searchURL; | ||
} | ||
|
||
function desktopSearch() { | ||
if ($(".o_search_header").hasClass("d-lg-none")) { | ||
$(".o_search_header").removeClass("d-lg-none"); | ||
$("#search_btn_toggle_search i").removeClass("oi-search"); | ||
$("#search_btn_toggle_search i").addClass("oi-close"); | ||
$("#div_search_header").removeClass("ms-lg-0"); | ||
$("#div_search_button").removeClass("ms-lg-2"); | ||
$("input.oe_search_box").focus(); | ||
} else { | ||
$(".o_search_header").addClass("d-lg-none"); | ||
$("#search_btn_toggle_search i").removeClass("oi-close"); | ||
$("#search_btn_toggle_search i").addClass("oi-search"); | ||
$("#div_search_header").addClass("ms-lg-0"); | ||
$("#div_search_button").addClass("ms-lg-2"); | ||
} | ||
} | ||
|
||
function searchHeader() { | ||
var screenWidth = | ||
window.innerWidth || | ||
document.documentElement.clientWidth || | ||
document.body.clientWidth; | ||
if (screenWidth < 992) { | ||
mobileSearch(); | ||
} else { | ||
desktopSearch(); | ||
} | ||
} | ||
|
||
window.searchHeader = searchHeader; | ||
})(); |
Oops, something went wrong.