* Creating a new structure by transforming all the plugins in the
library using the odoo inheritance system. Plugins are easier to
implement with the AbstractPlugin to add Odoo behaviors.
* From now on, the methods of the library (in this case Summernote) can
no longer be called by other modules or files. Only the wysiwyg
widgets can access it, to simplify the updating process. The wysiwyg
object serves as an interface.
* Depending on the options the snippets will be loaded or not, the
editor will be in an iframe or not... all of this is transparent from
the outside.
* Regarding iframes, all controllers related to editing have been
removed: the new API no longer needs them. This speeds up loading,
eases testing and removes complexity for the same
features.
PUBLIC FEATURES
There are several public methods on the Wysiwyg class:
* Wysiwyg.prepare (WidgetParent): returns a deferred resolved when the
library (xml, lazy, assets...) is loaded.
* Wysiwyg.getRange (DOM): returns the range (selection in the dom)
* Wysiwyg.setRange (startNode, startOffset, endNode, endOffset): creates
a range (selection in the dom)
* Wysiwyg.setRangeFromNode (DOM, options) that creates a range from an
element (option available to select all, start or end)
A jQuery selector was added: :o_editable, which indicates whether the
current element is editable. That is, if it is contained in a tag with
the attribute 'contentEditable = "true"' or in a tag with the class
o_editable.
Several methods are also present:
* focusIn: makes a focus and places the cursor at the beginning of the
element
* focusInEnd: makes a focus and places the cursor at the end of the
element
* selectContent: makes a focus and selects the content
HTML FIELD
The HTML field can receive different options:
* style-inline: {boolean} transforms a class into an inline style when
saving and vice versa when reading.
* no-attachment: {boolean} prevents the use of attachments (in media
dialog)
* cssEdit: {xml_id} to use a template containing the css to loaded in
an iframe when editing
* cssReadonly: {xml_id} to use a template containing the css to load
into an iframe when viewing in readonly
* snippets: {xml_id} snippets template (can be used with or without
cssEdit)
* wrapper: {template} qweb static template (containing a tag:
id = "wrapper") that will include the content during editing (removed
on save)
MASS MAILING
A widget was created for mass mailing. There are now two fields:
body_html and body_arch.
body_arch contains the code with the class without conversion into
inline style, useful when editing and one with the inline style that is
visible in readonly mode and sent by email.
Advantage: no spreading errors, able to update css/theme, able to do
more changes when converting to inline style so that a maximum of mail
clients have an impeccable rendering.
Co-authored-by: Antoine Guenet <age@odoo.com>
152 lines
7.1 KiB
XML
152 lines
7.1 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<odoo>
|
|
<template id="iframe_css_assets_edit" name="CSS assets for wysiwyg iframe content for popup">
|
|
<t t-call-assets="web.assets_common" t-js="false"/>
|
|
<t t-call-assets="web.assets_frontend" t-js="false"/>
|
|
<link rel="stylesheet" href="/website_mass_mailing/static/src/css/website_mass_mailing_popup.css" type="text/css"/>
|
|
</template>
|
|
|
|
<template id="remove_external_snippets" inherit_id="website.external_snippets">
|
|
<xpath expr="//t[@t-install='mass_mailing']" position="replace"/>
|
|
</template>
|
|
|
|
<template id="snippets" inherit_id="website.snippets">
|
|
<xpath expr="//div[@id='snippet_feature']//t[@t-snippet][last()]" position="after">
|
|
<t groups="website_mass_mailing.group_website_popup_on_exit">
|
|
<t t-snippet="website_mass_mailing.s_newsletter_subscribe_popup" t-thumbnail="/website_mass_mailing/static/src/img/blocks/newsletter_subscribe_popup.png"/>
|
|
</t>
|
|
</xpath>
|
|
|
|
<xpath expr="//div[@id='snippet_content']//t[@t-snippet][last()]" position="after">
|
|
<t t-snippet="website_mass_mailing.s_newsletter_subscribe_form" t-thumbnail="/website/static/src/img/snippets_thumbs/s_newsletter_subscribe_form.png"/>
|
|
</xpath>
|
|
</template>
|
|
|
|
<template id="s_newsletter_subscribe_form" name="Newsletter">
|
|
<div class="oe_snippet_body input-group js_subscribe" data-list-id="0">
|
|
<input type="email" name="email" class="js_subscribe_email form-control" placeholder="your email..."/>
|
|
<span class="input-group-append">
|
|
<a role="button" href="#" class="btn btn-primary js_subscribe_btn">Subscribe</a>
|
|
<a role="button" href="#" class="btn btn-success js_subscribed_btn d-none" disabled="disabled">Thanks</a>
|
|
</span>
|
|
<div class="alert alert-success d-none" role="status">Thanks for your subscription!</div>
|
|
</div>
|
|
</template>
|
|
|
|
<template id="s_newsletter_subscribe_popup" name="Newsletter Popup">
|
|
<div class="o_newsletter_popup" data-list-id="0">
|
|
<div class="alert alert-warning alert-dismissible fade show css_non_editable_mode_hidden o_not_editable" role="status">
|
|
<strong>Newsletter Popup!</strong> The newsletter popup snippet effect is active on this page. Click <a id="edit_dialog" href="#">Here To Edit Dialog Content</a>
|
|
</div>
|
|
<div role="dialog" class="modal modal-dialog modal-md fade-custom" id="o_newsletter_popup" tabindex="-1">
|
|
<div class="modal-content o_popup_modal_content">
|
|
<a role="button" href="#" class="o_popup_btn_close o_not_editable" data-dismiss="modal">&times;</a>
|
|
|
|
<div class="o_popup_modal_body text-center">
|
|
<div class="o_popup_content_dev" data-oe-placeholder="Type Here ..."/>
|
|
<div class="input-group o_not_editable o_popup_animated o_popup_bounce_del500ms o_popup_bounce_small" >
|
|
<input type="email" name="email" class="popup_subscribe_email form-control" placeholder="your email..." autofocus="autofocus"/>
|
|
<div class="input-group-append">
|
|
<a role="button" href="#" class="btn btn-success popup_subscribe_btn">Subscribe</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<template id="newsletter_subscribe_options" name="Newsletter Subscribe Options" inherit_id="website.snippet_options">
|
|
<xpath expr="//*[@id='so_snippet_addition']" position="attributes">
|
|
<attribute name="data-selector" add=".o_newsletter_popup" separator=","/>
|
|
</xpath>
|
|
<xpath expr="//div" position="after">
|
|
<div data-js="mailing_list_subscribe"
|
|
data-selector=".js_subscribe"
|
|
data-drop-near="p, h1, h2, h3, blockquote, .card">
|
|
<a tabindex="-1" href="#" class="dropdown-item" data-select_mailing_list="" data-no-preview="true">Change Newsletter</a>
|
|
</div>
|
|
<div data-js="newsletter_popup"
|
|
data-selector=".o_newsletter_popup">
|
|
<a tabindex="-1" href="#" class="dropdown-item" data-select_mailing_list="" data-no-preview="true">Change Newsletter</a>
|
|
</div>
|
|
</xpath>
|
|
</template>
|
|
|
|
<!-- Extend default mass_mailing snippets with website feature -->
|
|
<template id="social_links">
|
|
<t t-if="not website">
|
|
<t t-set="website" t-value="request.env['website'].search([], limit=1)"/>
|
|
</t>
|
|
<t t-if="website.social_facebook">
|
|
<a t-att-href="website.social_facebook" aria-label="Facebook" title="Facebook">
|
|
<span class="fa fa-facebook"></span>
|
|
</a>
|
|
</t>
|
|
<t t-if="website.social_googleplus">
|
|
<a t-att-href="website.social_googleplus" style="margin-left:10px" aria-label="Google Plus" title="Google Plus">
|
|
<span class="fa fa-google-plus"></span>
|
|
</a>
|
|
</t>
|
|
<t t-if="website.social_linkedin">
|
|
<a t-att-href="website.social_linkedin" style="margin-left:10px" aria-label="LinkedIn" title="LinkedIn">
|
|
<span class="fa fa-linkedin"></span>
|
|
</a>
|
|
</t>
|
|
<t t-if="website.social_twitter">
|
|
<a t-att-href="website.social_twitter" style="margin-left:10px" aria-label="Twitter" title="Twitter">
|
|
<span class="fa fa-twitter"></span>
|
|
</a>
|
|
</t>
|
|
<t t-if="website.social_instagram">
|
|
<a t-att-href="website.social_instagram" style="margin-left:10px" aria-label="Instagram" title="Instagram">
|
|
<span class="fa fa-instagram"></span>
|
|
</a>
|
|
</t>
|
|
</template>
|
|
|
|
<template id="s_mail_block_header_social" inherit_id="mass_mailing.s_mail_block_header_social">
|
|
<xpath expr="//td[hasclass('o_mail_logo_container')]" position="after">
|
|
<td width="30%" class="text-right o_mail_no_resize">
|
|
<div class="o_mail_header_social">
|
|
<t t-call="website_mass_mailing.social_links"/>
|
|
</div>
|
|
</td>
|
|
</xpath>
|
|
</template>
|
|
|
|
<template id="s_mail_block_header_text_social" inherit_id="mass_mailing.s_mail_block_header_text_social">
|
|
<xpath expr="//table//td" position="after">
|
|
<td width="30%" class="text-right o_mail_no_resize">
|
|
<div class="o_mail_header_social">
|
|
<t t-call="website_mass_mailing.social_links"/>
|
|
</div>
|
|
</td>
|
|
</xpath>
|
|
</template>
|
|
|
|
<template id="s_mail_block_footer_social" inherit_id="mass_mailing.s_mail_block_footer_social">
|
|
<xpath expr="//td[hasclass('o_mail_footer_links')]" position="inside">
|
|
<t> | <a role="button" href="/contactus" class="btn btn-link">Contact</a></t>
|
|
</xpath>
|
|
<xpath expr="//tr" position="before">
|
|
<tr>
|
|
<td class="o_mail_footer_social">
|
|
<t t-call="website_mass_mailing.social_links"/>
|
|
</td>
|
|
</tr>
|
|
</xpath>
|
|
</template>
|
|
|
|
<template id="s_mail_block_footer_social_left" inherit_id="mass_mailing.s_mail_block_footer_social_left">
|
|
<xpath expr="//div[hasclass('o_mail_footer_links')]" position="inside">
|
|
<t> | <a role="button" href="/contactus" class="btn btn-link">Contact</a></t>
|
|
</xpath>
|
|
<xpath expr="//td" position="after">
|
|
<td class="o_mail_footer_social">
|
|
<t t-call="website_mass_mailing.social_links"/>
|
|
</td>
|
|
</xpath>
|
|
</template>
|
|
</odoo>
|