Files
odoo_source/addons/web_editor/views/snippets.xml
T
fja-odoo 11c60739e4 [IMP] website, *: warn user about outdated blocks
* = mass_mailing, web_editor, website_crm, website_event, website_form,
website_forum, website_hr_recruitment, website_mail_channel,
website_mass_mailing, website_sale, website_slides

When an outdated snippet's option are activated we display a warning
in the left panel that inform the user about the potential
malfunctions.

To do so the snippet's template key is added to the snippet as
data-snippet.
If a snippet is "t-call" inside another snippet, it will need to use
t-snippet-call instead of t-call to have the key on himself.

Those unique keys are used on snippet selection to retrieve the
snippet's version in the left panel and compare it with the currently
selected snippet's version. Versions are describe with data-vcss,
data-vjs and data-vxml. If a snippet's key is not in the left panel we
consider that snippet as outdated.

Added some tests to ensure that t-snippet and t-snippet-call really have
their template key as data-snippet

Adapted the views to the data-snippet changes adding
data-snippet="tmpl_key".

Part of: https://github.com/odoo/odoo/pull/44569
task-2189669

closes odoo/odoo#50254

X-original-commit: 28a6cd49b6e87b75c2e70771e241c41778bf9e87
Related: odoo/enterprise#10236
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-04-27 16:36:31 +00:00

62 lines
1.9 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="snippets">
<div id="snippets_menu">
<button type="button" class="o_we_add_snippet_btn active" accesskey="1">
Blocks
</button>
<t t-set="customize_title">Click in the page to customize</t>
<button type="button" class="o_we_customize_snippet_btn"
t-att-data-title="customize_title"
disabled="disabled">
Style
</button>
</div>
<div id="o_scroll">
<div id="snippet_custom" class="o_panel d-none">
<div class="o_panel_header">
<i class="fa fa-fw fa-save"/> Custom
</div>
<div id="snippet_custom_body" class="o_panel_body"/>
</div>
<t id="default_snippets">
<div id="snippet_structure" class="o_panel">
<div class="o_panel_header">
<i class="fa fa-th-large"/> First Panel
</div>
<div class="o_panel_body">
<t t-snippet="web_editor.s_hr" t-thumbnail="/website/static/src/img/snippets_thumbs/s_separator.png"/>
</div>
</div>
</t>
</div>
<div id="snippet_options" class="d-none">
<t t-call="web_editor.snippet_options"/>
</div>
</template>
<!-- options (data-selector, data-drop-in, data-drop-near, data-js to link js object ) -->
<template id="snippet_options">
<!-- t-field -->
<div data-js='many2one'
data-selector="[data-oe-many2one-model]:not([data-oe-readonly])"
data-no-check="true"/>
<div data-selector=".s_hr"
data-drop-near="p, h1, h2, h3, blockquote, .s_hr"/>
<div data-js="VersionControl"
data-selector="[data-snippet]"/>
</template>
<!-- default block -->
<template id="s_hr" name="Separator">
<div class="s_hr pt32 pb32">
<hr class="s_hr_1px s_hr_solid w-100 mx-auto"/>
</div>
</template>
</odoo>