[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:
@@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
|
||||
<!-- Theme Footer - Option -->
|
||||
<template id="template_footer_opt" inherit_id="website.snippet_options" name="Test Theme Custom Footer Template - Option">
|
||||
<xpath expr="//we-select[@data-variable='footer-template']" position="inside">
|
||||
<we-button title="Custom Theme"
|
||||
data-customize-website-views="theme_test_custo.template_footer_custom"
|
||||
data-customize-website-variable="'custom-theme'"
|
||||
data-img="/theme_test_custo/static/src/img/template_footer_opt.svg"/>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
<!-- Theme Footer - Layout -->
|
||||
<template id="template_footer_custom" inherit_id="website.layout" name="Test Theme Custom Footer Template">
|
||||
<xpath expr="//div[@id='footer']" position="replace">
|
||||
<div id="footer" class="oe_structure oe_structure_solo" t-ignore="true" t-if="not no_footer">
|
||||
<section class="s_text_block pt24 pb24" data-snippet="s_text_block" data-name="Text">
|
||||
<div class="container-fluid px-lg-5">
|
||||
<div class="row">
|
||||
<div class="col-lg-1 offset-lg-2 pt24 pb24">
|
||||
<img src="/web/image/theme_test_custo.logo" class="img-fluid rounded-circle" alt=""/>
|
||||
</div>
|
||||
<div class="col-lg-6 pt24 pb24 text-center">
|
||||
<h5 class="mb-4">Useful Links</h5>
|
||||
<ul class="list-unstyled">
|
||||
<li t-foreach="request.env['website.menu'].search([('url', '=', '/main-menu-animals'), ('website_id', '=', request.website.id)]).child_id" t-as="menu">
|
||||
<a t-att-href="menu.url" t-esc="menu.name"/>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-lg-1 pt24 pb24">
|
||||
<img src="/web/image/theme_test_custo.logo" class="img-fluid rounded-circle" alt=""/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
</odoo>
|
||||
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
|
||||
<!-- Theme Header - Option -->
|
||||
<template id="template_header_opt" inherit_id="website.snippet_options" name="Test Theme Custom Header Template - Option">
|
||||
<xpath expr="//we-select[@data-variable='header-template']" position="inside">
|
||||
<we-button title="Custom Theme"
|
||||
data-customize-website-views="theme_test_custo.template_header_custom"
|
||||
data-customize-website-variable="'custom-theme'"
|
||||
data-img="/theme_test_custo/static/src/img/template_header_opt.svg"/>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
<!-- Theme Header - Layout -->
|
||||
<template id="template_header_custom" inherit_id="website.layout" name="Test Theme Custom Header Template">
|
||||
<xpath expr="//header//nav" position="replace">
|
||||
<nav data-name="Navbar" class="navbar navbar-expand-lg">
|
||||
<div class="container">
|
||||
<t t-call="website.placeholder_header_brand"/>
|
||||
<t t-call="website.navbar_nav">
|
||||
<!-- Menu -->
|
||||
<t t-foreach="website.menu_id.child_id" t-as="submenu">
|
||||
<t t-call="website.submenu">
|
||||
<t t-set="item_class" t-valuef="nav-item"/>
|
||||
<t t-set="link_class" t-valuef="nav-link"/>
|
||||
</t>
|
||||
</t>
|
||||
<!-- Sign In -->
|
||||
<t t-call="portal.placeholder_user_sign_in">
|
||||
<t t-set="_item_class" t-valuef="nav-item"/>
|
||||
<t t-set="_link_class" t-valuef="nav-link text-900"/>
|
||||
</t>
|
||||
<!-- User Dropdown -->
|
||||
<t t-call="portal.user_dropdown">
|
||||
<t t-set="_user_name" t-value="true"/>
|
||||
<t t-set="_item_class" t-valuef="nav-item dropdown ml-auto"/>
|
||||
<t t-set="_link_class" t-valuef="nav-link text-900"/>
|
||||
</t>
|
||||
</t>
|
||||
</div>
|
||||
</nav>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user