diff --git a/website_search_header/README.rst b/website_search_header/README.rst new file mode 100644 index 0000000000..2a0c36af18 --- /dev/null +++ b/website_search_header/README.rst @@ -0,0 +1,85 @@ +======================== +Website Search in Header +======================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:0190640b3113a806206eba0406254bfdb594eb50e99f4f870b3815401ff7621f + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png + :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fwebsite-lightgray.png?logo=github + :target: https://github.com/OCA/website/tree/17.0/website_search_header + :alt: OCA/website +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/website-17-0/website-17-0-website_search_header + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/website&target_branch=17.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module adds a search bar in the header of your website + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +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. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* ForgeFlow +* Ooops + +Contributors +------------ + +- ForgeFlow +- Kencove + +Maintainers +----------- + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/website `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/website_search_header/__init__.py b/website_search_header/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/website_search_header/__manifest__.py b/website_search_header/__manifest__.py new file mode 100644 index 0000000000..4912a25e43 --- /dev/null +++ b/website_search_header/__manifest__.py @@ -0,0 +1,23 @@ +# Copyright 2023 ForgeFlow, S.L. +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl-3.0). + +{ + "name": "Website Search in Header", + "category": "Website", + "version": "17.0.1.1.0", + "author": "ForgeFlow, Ooops, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/website", + "license": "LGPL-3", + "depends": [ + "website", + ], + "data": [ + "views/templates.xml", + ], + "assets": { + "website_search_header.assets_frontend": [ + "website_search_header/static/src/js/website.js", + ], + }, + "installable": True, +} diff --git a/website_search_header/pyproject.toml b/website_search_header/pyproject.toml new file mode 100644 index 0000000000..4231d0cccb --- /dev/null +++ b/website_search_header/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/website_search_header/readme/CONTRIBUTORS.md b/website_search_header/readme/CONTRIBUTORS.md new file mode 100644 index 0000000000..9651e0b4ff --- /dev/null +++ b/website_search_header/readme/CONTRIBUTORS.md @@ -0,0 +1,2 @@ +- ForgeFlow \<\> +- Kencove \<\> diff --git a/website_search_header/readme/DESCRIPTION.md b/website_search_header/readme/DESCRIPTION.md new file mode 100644 index 0000000000..fcd13a9805 --- /dev/null +++ b/website_search_header/readme/DESCRIPTION.md @@ -0,0 +1 @@ +This module adds a search bar in the header of your website diff --git a/website_search_header/readme/USAGE.md b/website_search_header/readme/USAGE.md new file mode 100644 index 0000000000..189ee53c4c --- /dev/null +++ b/website_search_header/readme/USAGE.md @@ -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. diff --git a/website_search_header/static/description/icon.png b/website_search_header/static/description/icon.png new file mode 100644 index 0000000000..3a0328b516 Binary files /dev/null and b/website_search_header/static/description/icon.png differ diff --git a/website_search_header/static/description/index.html b/website_search_header/static/description/index.html new file mode 100644 index 0000000000..2a6c001b07 --- /dev/null +++ b/website_search_header/static/description/index.html @@ -0,0 +1,432 @@ + + + + + +Website Search in Header + + + +
+

Website Search in Header

+ + +

Beta License: LGPL-3 OCA/website Translate me on Weblate Try me on Runboat

+

This module adds a search bar in the header of your website

+

Table of contents

+ +
+

Usage

+

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.

+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • ForgeFlow
  • +
  • Ooops
  • +
+
+ +
+

Maintainers

+

This module is maintained by the OCA.

+ +Odoo Community Association + +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

This module is part of the OCA/website project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/website_search_header/static/src/js/website.js b/website_search_header/static/src/js/website.js new file mode 100644 index 0000000000..9eedbe717e --- /dev/null +++ b/website_search_header/static/src/js/website.js @@ -0,0 +1,43 @@ +(function () { + "use strict"; + 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; +})(); diff --git a/website_search_header/static/src/scss/website_search_header.scss b/website_search_header/static/src/scss/website_search_header.scss new file mode 100644 index 0000000000..e69de29bb2 diff --git a/website_search_header/views/templates.xml b/website_search_header/views/templates.xml new file mode 100644 index 0000000000..26fcada53e --- /dev/null +++ b/website_search_header/views/templates.xml @@ -0,0 +1,160 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +