Skip to content

Commit a548d85

Browse files
[IMP] howto/website: update navigation page
This commit updates current navigation page, by adding new anchor links to the sections and by adding updated information. Task-4316611 closes #12191 Signed-off-by: Carlos Valverde (cvs) <[email protected]>
1 parent 88301e2 commit a548d85

File tree

1 file changed

+74
-15
lines changed

1 file changed

+74
-15
lines changed

content/developer/howtos/website_themes/navigation.rst

+74-15
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ In this chapter, you will learn how to:
1010
- Create a dropdown menu.
1111
- Create a mega menu.
1212

13+
.. _website_themes/navigation/default:
14+
1315
Default
1416
=======
1517

@@ -30,6 +32,8 @@ Delete default menu items.
3032
<delete model="website.menu" search="[('url','in', ['/', '/shop']),
3133
('website_id', '=', 1)]"/>
3234
35+
.. _website_themes/navigation/menu:
36+
3337
Menu item
3438
=========
3539

@@ -66,6 +70,8 @@ Menu item
6670
* - sequence
6771
- Defines the link's position in the top menu.
6872

73+
.. _website_themes/navigation/menu/new_window:
74+
6975
New window
7076
----------
7177

@@ -77,6 +83,8 @@ Open the link's URL in a new tab.
7783
<field name="new_window" eval="True"/>
7884
</record>
7985
86+
.. _website_themes/navigation/menu/external_links:
87+
8088
External Links
8189
--------------
8290

@@ -88,6 +96,8 @@ Add a link to an external website.
8896
<field name="url">https://www.odoo.com</field>
8997
</record>
9098
99+
.. _website_themes/navigation/menu/anchor:
100+
91101
Anchor
92102
------
93103

@@ -99,6 +109,8 @@ Link to a specific section of a page.
99109
<field name="url">/about-us#our-team</field>
100110
</record>
101111
112+
.. _website_themes/navigation/dropdown:
113+
102114
Dropdown menu
103115
=============
104116

@@ -138,31 +150,72 @@ Add an item to a dropdown menu.
138150
* - parent_id
139151
- The dropdown in which the item will be added.
140152

153+
.. _website_themes/navigation/mega_menu:
154+
141155
Mega menu
142156
=========
143157

144158
A mega menu is a dropdown menu with additional possibilities and not just a list of links. In a
145159
mega menu, you can use any kind of content (text, images, icons, ...).
146160

161+
In Odoo, you can select a mega-menu template in the list. If you don't need a custom layout, you
162+
can re-use the template structure in the `mega_menu_content` field like any static content.
163+
147164
**Declaration**
148165

149166
.. code-block:: xml
150167
:caption: ``/website_airproof/data/menu.xml``
151168
152-
<record id="menu_mega_menu" model="website.menu">
153-
<field name="name">Mega Menu</field>
154-
<field name="url">/mega-menu</field>
155-
<field name="parent_id" search="[
156-
('url', '=', '/default-main-menu'),
157-
('website_id', '=', 1)]"/>
158-
<field name="website_id">1</field>
159-
<field name="sequence" type="int">..</field>
160-
<field name="is_mega_menu" eval="True"/>
161-
<field name="mega_menu_classes">...</field>
162-
<field name="mega_menu_content" type="html">
163-
<!-- Content -->
164-
</field>
165-
</record>
169+
<record id="menu_mega_menu" model="website.menu">
170+
<field name="name">Mega Menu</field>
171+
<field name="parent_id" search="[
172+
('url', '=', '/default-main-menu'),
173+
('website_id', '=', 1)]"/>
174+
<field name="website_id">1</field>
175+
<field name="sequence" type="int">..</field>
176+
<field name="is_mega_menu" eval="True"/>
177+
<field name="mega_menu_classes">...</field>
178+
<field name="mega_menu_content" type="html">
179+
<section class="s_mega_menu_multi_menus py-4 o_colored_level o_cc o_cc1">
180+
<div class="container">
181+
<div class="row">
182+
<div class="col-12 col-sm py-2 text-center">
183+
<h4 class="o_default_snippet_text">First Menu</h4>
184+
<nav class="nav flex-column">
185+
<a href="#" class="nav-link o_default_snippet_text" data-name="Menu Item">Menu Item 1</a>
186+
<a href="#" class="nav-link o_default_snippet_text" data-name="Menu Item">Menu Item 2</a>
187+
<a href="#" class="nav-link o_default_snippet_text" data-name="Menu Item">Menu Item 3</a>
188+
</nav>
189+
</div>
190+
<div class="col-12 col-sm py-2 text-center">
191+
<h4 class="o_default_snippet_text">Second Menu</h4>
192+
<nav class="nav flex-column">
193+
<a href="#" class="nav-link o_default_snippet_text" data-name="Menu Item">Menu Item 1</a>
194+
<a href="#" class="nav-link o_default_snippet_text" data-name="Menu Item">Menu Item 2</a>
195+
<a href="#" class="nav-link o_default_snippet_text" data-name="Menu Item">Menu Item 3</a>
196+
</nav>
197+
</div>
198+
<div class="col-12 col-sm py-2 text-center">
199+
<h4 class="o_default_snippet_text">Third Menu</h4>
200+
<nav class="nav flex-column">
201+
<a href="#" class="nav-link o_default_snippet_text" data-name="Menu Item">Menu Item 1</a>
202+
<a href="#" class="nav-link o_default_snippet_text" data-name="Menu Item">Menu Item 2</a>
203+
<a href="#" class="nav-link o_default_snippet_text" data-name="Menu Item">Menu Item 3</a>
204+
</nav>
205+
</div>
206+
<div class="col-12 col-sm py-2 text-center">
207+
<h4 class="o_default_snippet_text">Last Menu</h4>
208+
<nav class="nav flex-column">
209+
<a href="#" class="nav-link o_default_snippet_text" data-name="Menu Item">Menu Item 1</a>
210+
<a href="#" class="nav-link o_default_snippet_text" data-name="Menu Item">Menu Item 2</a>
211+
<a href="#" class="nav-link o_default_snippet_text" data-name="Menu Item">Menu Item 3</a>
212+
</nav>
213+
</div>
214+
</div>
215+
</div>
216+
</section>
217+
</field>
218+
</record>
166219
167220
.. list-table::
168221
:header-rows: 1
@@ -178,6 +231,12 @@ mega menu, you can use any kind of content (text, images, icons, ...).
178231
* - mega_menu_content
179232
- The default content of the mega menu
180233

234+
Beside that, you might need to create something more visually advanced with a custom template.
235+
Feel free to check how the `standard templates <{GITHUB_PATH}/addons/website/views/snippets/s_mega_menu_odoo_menu.xml>`_
236+
are built in the Odoo source code.
237+
238+
.. _website_themes/navigation/mega_menu/custom:
239+
181240
Custom template
182241
---------------
183242

@@ -205,7 +264,7 @@ Use the following code to add an option for your new custom mega menu on the Web
205264
<xpath expr="//*[@data-name='mega_menu_template_opt']/*" position="before">
206265
<t t-set="_label">Airproof</t>
207266
<we-button t-att-data-select-label="_label"
208-
data-select-template="website_website_airproof.s_mega_menu_airproof"
267+
data-select-template="website_airproof.s_mega_menu_airproof"
209268
data-img="/website_airproof/static/src/img/builder/header_opt.svg"
210269
t-out="_label"/>
211270
</xpath>

0 commit comments

Comments
 (0)