[IMP] test_themes, theme_test_custo: add new test theme for tests

This commit introduces a new theme for tests purpose.
The goal is to be able to create records and simulate a real use case
without only testing through unit tests in python.
For instance, with this commit, we now fully test:
- menu creation
- page creation
- new header & footer template
- new image shape & background shape

This will be extended later to be able to test other stuff too, maybe
like changing the website logo (not supported yet). Also, our existing
standalone test in themes should use this theme instead of nano to not
rely on a real theme that might change.

Courtesy of NMI as this theme is partly based on his job.

closes odoo/design-themes#586

Related: odoo/odoo#99099
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
This commit is contained in:
Romain Derie
2022-08-29 21:55:51 +00:00
parent ca449f01f8
commit 0e2497b8e8
23 changed files with 530 additions and 6 deletions
+10
View File
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="logo" model="theme.ir.attachment">
<field name="name">Test Theme Custom Logo</field>
<field name="url">/theme_test_custo/static/src/img/logo.jpg</field>
<field name="key">theme_test_custo.logo</field>
</record>
</odoo>
+19
View File
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="theme_test_custo.bootstrap_overridden_scss" model="theme.ir.asset">
<field name="key">theme_test_custo.bootstrap_overridden_scss</field>
<field name="name">Bootstrap overridden SCSS</field>
<field name="bundle">web._assets_frontend_helpers</field>
<field name="directive">prepend</field>
<field name="path">theme_test_custo/static/src/scss/bootstrap_overridden.scss</field>
</record>
<record id="theme_test_custo.primary_variables_scss" model="theme.ir.asset">
<field name="key">theme_test_custo.primary_variables_scss</field>
<field name="name">Primary variables SCSS</field>
<field name="bundle">web._assets_primary_variables</field>
<field name="path">theme_test_custo/static/src/scss/primary_variables.scss</field>
</record>
</odoo>
+80
View File
@@ -0,0 +1,80 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Case 1: Create a new navbar menu -->
<record id="menu_example_1" model="theme.website.menu">
<field name="name">Example 1</field>
<field name="sequence" type="int">20</field>
</record>
<!-- Case 2: Create child menu below a theme.website.menu -->
<record id="menu_example_1_item_1" model="theme.website.menu">
<field name="name">Item 1</field>
<field name="url">/example</field>
<field name="parent_id" ref="menu_example_1"/>
<field name="sequence" type="int">21</field>
</record>
<record id="menu_example_1_item_2" model="theme.website.menu">
<field name="name">Item 2</field>
<field name="url">/example/item-2</field>
<field name="parent_id" ref="menu_example_1"/>
<field name="sequence" type="int">22</field>
</record>
<record id="menu_example_1_item_3" model="theme.website.menu">
<field name="name">Item 3</field>
<field name="url">/example/item-3</field>
<field name="parent_id" ref="menu_example_1"/>
<field name="sequence" type="int">23</field>
</record>
<!-- Case 3: Create a mega menu -->
<record id="menu_products" model="theme.website.menu">
<field name="name">Mega Menu</field>
<field name="url">/mega-menu</field>
<field name="sequence" type="int">30</field>
<field name="mega_menu_content" type="html">
<section class="o_cc o_cc2 pt32 pb32">
<div class="container">
<div class="row">
<div class="col-lg-3">
<i class="fa fa-cube"/>
<p>Text</p>
</div>
<div class="col-lg-3">
<i class="fa fa-cube"/>
<p>Text</p>
</div>
<div class="col-lg-3">
<i class="fa fa-cube"/>
<p>Text</p>
</div>
<div class="col-lg-3">
<i class="fa fa-cube"/>
<p>Text</p>
</div>
</div>
</div>
</section>
</field>
</record>
<!-- Case 4: Create a new whole menu hierarchy (to be put elsewhere) -->
<record id="main_menu_animals" model="theme.website.menu">
<field name="name">Main Menu Animals</field>
<field name="use_main_menu_as_parent" eval="False"/>
<field name="url">/main-menu-animals</field>
</record>
<record id="menu_dogs" model="theme.website.menu">
<field name="name">Dogs</field>
<field name="url">/dogs</field>
<field name="parent_id" ref="main_menu_animals"/>
<field name="sequence" type="int">10</field>
</record>
<record id="menu_cats" model="theme.website.menu">
<field name="name">Cats</field>
<field name="url">/cats</field>
<field name="parent_id" ref="main_menu_animals"/>
<field name="sequence" type="int">20</field>
</record>
</odoo>
+44
View File
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="view_example" name="Example">
<t t-set="additional_title" t-valuef="Example"/>
<t t-call="website.layout">
<div id="wrap" class="oe_structure">
<!-- Image Shape -->
<section class="s_text_image pt80 pb80">
<div class="container">
<div class="row align-items-center">
<div class="col-lg-6 pt16 pb16">
<h2>A Section Subtitle</h2>
<p>Write one or two paragraphs describing your product or services. To be successful your content needs to be useful to your readers.</p>
<p>Start with the customer - find out what they want and give it to them.</p>
<p><a href="#" class="btn btn-primary mb-2">Learn more</a></p>
</div>
<div class="col-lg-6 pt16 pb16">
<img src="/web_editor/image_shape/website.s_text_image_default_image/theme_test_custo/blob/01.svg" class="img img-fluid mx-auto" alt="" data-original-mimetype="image/jpeg" data-file-name="01.svg" data-shape="theme_test_custo/blob/01" data-shape-colors=";;;;"/>
</div>
</div>
</div>
</section>
<!-- Background Shape -->
<section class="s_text_block pt80 pb200" data-name="Text" data-oe-shape-data="{'shape': 'theme_test_custo/curves/01','flip':[]}">
<div class="o_we_shape o_theme_test_custo_curves_01"/>
<div class="s_allow_columns container">
<p class="o_default_snippet_text">Great stories have a <b class="o_default_snippet_text">personality</b>. Consider telling a great story that provides personality. Writing a story with personality for potential clients will assist with making a relationship connection. This shows up in small quirks like word choices or phrases. Write from your point of view, not from someone else's experience.</p>
</div>
</section>
</div>
</t>
</template>
<record id="page_example" model="theme.website.page">
<field name="view_id" ref="view_example"/>
<field name="is_published" eval="True"/>
<field name="url">/example</field>
</record>
</odoo>
+38
View File
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Background Shape -->
<template id="snippet_options_background_options" inherit_id="web_editor.snippet_options_background_options" name="Background Shape Custom Option">
<xpath expr="//we-select-pager[hasclass('o_we_shape_menu')]/we-select-page[last()]" position="after">
<we-select-page string="Custom Shapes">
<we-button data-shape="theme_test_custo/hexagons/01" data-select-label="Hexagon 01"/>
<we-button data-shape="theme_test_custo/curves/01" data-select-label="Curve 01"/>
</we-select-page>
</xpath>
</template>
<record id="shape_hexagon_01" model="theme.ir.attachment">
<field name="name">Hexagon Shape 01</field>
<field name="key">theme_test_custo.shape_hexagon_01</field>
<field name="url">/web_editor/shape/illustration/hexagons/01.svg</field>
</record>
<record id="shape_curve_01" model="theme.ir.attachment">
<field name="name">Curve Shape 01</field>
<field name="key">theme_test_custo.shape_curve_01</field>
<field name="url">/web_editor/shape/illustration/curves/01.svg</field>
</record>
<!-- Image Shape -->
<template id="snippet_options" inherit_id="web_editor.snippet_options" name="Image Shape Custom Option">
<xpath expr="//we-select-pager[@data-name='shape_img_opt']/we-select-page[last()]" position="after">
<we-select-page string="Custom Shapes">
<we-button data-set-img-shape="theme_test_custo/blob/01" data-select-label="Blob 01"/>
</we-select-page>
</xpath>
</template>
<record id="img_shape_blob_01" model="theme.ir.attachment">
<field name="name">Blob Shape 01</field>
<field name="key">theme_test_custo.img_shape_blob_01</field>
<field name="url">/web_editor/image_shape/blob/01.svg</field>
</record>
</odoo>