Browse Source

Complete module renaming, prepare for OCA

pull/47/head
Jairo Llopis 9 years ago
parent
commit
42c215ee1e
  1. 29
      website_mail_snippet_fixed/README.rst
  2. 5
      website_mail_snippet_fixed/__openerp__.py
  3. 58
      website_mail_snippet_fixed/i18n/es.po
  4. 38
      website_mail_snippet_fixed/static/src/js/vertical_resize.js
  5. 16
      website_mail_snippet_fixed/views/assets.xml
  6. 6
      website_mail_snippet_fixed/views/snippet_1_col.xml
  7. 6
      website_mail_snippet_fixed/views/snippet_2_cols.xml
  8. 6
      website_mail_snippet_fixed/views/snippet_3_cols.xml
  9. 18
      website_mail_snippet_fixed/views/snippet_hr.xml
  10. 6
      website_mail_snippet_fixed/views/snippet_img_text.xml
  11. 6
      website_mail_snippet_fixed/views/snippet_text_img.xml
  12. 23
      website_mail_snippet_fixed/views/templates.xml

29
website_mail_snippet_fixed/README.rst

@ -2,18 +2,13 @@
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3 :alt: License: AGPL-3
=============================================
Responsive Layout Snippets for Writing Emails
=============================================
==============================================
Fixed-Width Layout Snippets for Writing Emails
==============================================
This module extends the functionality of the website mail designer to support a
responsive layout and allow you to read those mails comfortably in a mobile
mail client.
Well... actually this is not really responsive. It is pseudo-responsive.
Responsiveness in current mail clients is years behind browsers', so these
templates are very verbose to ensure compatibility in most scenarios. Ideas are
taken from https://css-tricks.com/ideas-behind-responsive-emails/.
This module extends the functionality of the website mail designer with new
snippets with a fixed-width layout that works fine across any mail client,
including MS Outlook.
Installation Installation
============ ============
@ -30,8 +25,8 @@ To use this module, you need to:
#. Install any module that makes use of the website mail designer, such as #. Install any module that makes use of the website mail designer, such as
``mass_mailing``. ``mass_mailing``.
#. Edit an email with the website mail designer. #. Edit an email with the website mail designer.
#. You have a new collection of snippets under *Email Design* section. Use them
as usual.
#. You have a new collection of snippets under *Fixed 560px Width* section.
Use them as usual.
If you choose the *Horizontal Separator* snippet, you will be able to set its If you choose the *Horizontal Separator* snippet, you will be able to set its
height too. For that, you will have to aim carefully to click inside the green height too. For that, you will have to aim carefully to click inside the green
@ -44,9 +39,9 @@ line, and then use the option that will float above it.
Known issues / Roadmap Known issues / Roadmap
====================== ======================
* Snippet is ugly, but that's because mail client HTML engines usually lack
many of the modern CSS and HTML features. I hope we will be able to improve
this as mail clients keep improving.
* Snippet code is ugly, but that's because mail client HTML engines usually
lack many of the modern CSS and HTML features. I hope we will be able to
improve this as mail clients keep improving.
* To set the *Horizontal Separator* height, you have to click inside it, which * To set the *Horizontal Separator* height, you have to click inside it, which
will insert a ``<br type="_moz"/>`` in Firefox, that will make it seem like will insert a ``<br type="_moz"/>`` in Firefox, that will make it seem like
its height is at least like a caret, even if you set a lower value. Do not its height is at least like a caret, even if you set a lower value. Do not
@ -61,7 +56,7 @@ check there if your issue has already been reported. If you spotted it first,
help us smashing it by providing a detailed and welcomed `feedback help us smashing it by providing a detailed and welcomed `feedback
<https://github.com/OCA/ <https://github.com/OCA/
social/issues/new?body=module:%20 social/issues/new?body=module:%20
website_mail_snippet_responsive%0Aversion:%20
website_mail_snippet_fixed%0Aversion:%20
8.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. 8.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Credits Credits

5
website_mail_snippet_fixed/__openerp__.py

@ -2,7 +2,7 @@
# © 2016 Antiun Ingeniería S.L. - Jairo Llopis # © 2016 Antiun Ingeniería S.L. - Jairo Llopis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{ {
"name": "Extra Layout Snippets for Writing Emails",
"name": "Fixed-Width Layout Snippets for Writing Emails",
"summary": "560px width extra building blocks", "summary": "560px width extra building blocks",
"version": "8.0.1.0.0", "version": "8.0.1.0.0",
"category": "Marketing", "category": "Marketing",
@ -15,10 +15,9 @@
"images/snippets.png", "images/snippets.png",
], ],
"depends": [ "depends": [
"website_mail",
"website_mail_snippet_vertical_resize_base",
], ],
"data": [ "data": [
"views/assets.xml",
"views/templates.xml", "views/templates.xml",
"views/snippet_1_col.xml", "views/snippet_1_col.xml",
"views/snippet_2_cols.xml", "views/snippet_2_cols.xml",

58
website_mail_snippet_fixed/i18n/es.po

@ -1,6 +1,6 @@
# Translation of Odoo Server. # Translation of Odoo Server.
# This file contains the translation of the following modules: # This file contains the translation of the following modules:
# * website_mail_snippet_responsive
# * website_mail_snippet_fixed
# #
msgid "" msgid ""
msgstr "" msgstr ""
@ -17,60 +17,60 @@ msgstr ""
"Plural-Forms: \n" "Plural-Forms: \n"
"X-Generator: Poedit 1.8.6\n" "X-Generator: Poedit 1.8.6\n"
#. module: website_mail_snippet_responsive
#: view:website:website_mail.email_designer_snippets
#. module: website_mail_snippet_fixed
#: view:website:560px_section
msgid "Big image + Text + Button (1 column)" msgid "Big image + Text + Button (1 column)"
msgstr "Imagen grande + texto + botón (1 columna)" msgstr "Imagen grande + texto + botón (1 columna)"
#. module: website_mail_snippet_responsive
#: view:website:website_mail.email_designer_snippets
#. module: website_mail_snippet_fixed
#: view:website:560px_section
msgid "Change Height" msgid "Change Height"
msgstr "Cambiar altura" msgstr "Cambiar altura"
#. module: website_mail_snippet_responsive
#. module: website_mail_snippet_fixed
#. openerp-web #. openerp-web
#: code:addons/website_mail_snippet_responsive/static/src/js/vertical_resize.js:23
#: code:addons/website_mail_snippet_fixed/static/src/js/vertical_resize.js:23
#, python-format #, python-format
msgid "Element height in pixels" msgid "Element height in pixels"
msgstr "Altura del elemento en píxeles" msgstr "Altura del elemento en píxeles"
#. module: website_mail_snippet_responsive
#: view:website:website_mail.email_designer_snippets
#. module: website_mail_snippet_fixed
#: view:website:560px_section
msgid "Horizontal Separator" msgid "Horizontal Separator"
msgstr "Separador horizontal" msgstr "Separador horizontal"
#. module: website_mail_snippet_responsive
#: view:website:website_mail.email_designer_snippets
#. module: website_mail_snippet_fixed
#: view:website:560px_section
msgid "Image + Text + Button (2 columns)" msgid "Image + Text + Button (2 columns)"
msgstr "Imagen + texto + botón (2 columnas)" msgstr "Imagen + texto + botón (2 columnas)"
#. module: website_mail_snippet_responsive
#: view:website:website_mail.email_designer_snippets
#. module: website_mail_snippet_fixed
#: view:website:560px_section
msgid "Image + Text + Button (3 columns)" msgid "Image + Text + Button (3 columns)"
msgstr "Imagen + texto + botón (3 columnas)" msgstr "Imagen + texto + botón (3 columnas)"
#. module: website_mail_snippet_responsive
#: view:website:website_mail.email_designer_snippets
#. module: website_mail_snippet_fixed
#: view:website:560px_section
msgid "Integer ut tempor lectus. Vivamus at gravida arcu." msgid "Integer ut tempor lectus. Vivamus at gravida arcu."
msgstr "Integer ut tempor lectus. Vivamus at gravida arcu." msgstr "Integer ut tempor lectus. Vivamus at gravida arcu."
#. module: website_mail_snippet_responsive
#: view:website:website_mail.email_designer_snippets
#. module: website_mail_snippet_fixed
#: view:website:560px_section
msgid "Learn more" msgid "Learn more"
msgstr "Aprenda más" msgstr "Aprenda más"
#. module: website_mail_snippet_responsive
#: view:website:website_mail.email_designer_snippets
#. module: website_mail_snippet_fixed
#: view:website:560px_section
msgid "Left Image, Right Text + Button" msgid "Left Image, Right Text + Button"
msgstr "Imagen a la izquierda, texto + botón a la derecha" msgstr "Imagen a la izquierda, texto + botón a la derecha"
#. module: website_mail_snippet_responsive
#: view:website:website_mail.email_designer_snippets
#. module: website_mail_snippet_fixed
#: view:website:560px_section
msgid "Left Text and Button, Right Image" msgid "Left Text and Button, Right Image"
msgstr "Texto + botón a la izquierda, imagen a la derecha" msgstr "Texto + botón a la izquierda, imagen a la derecha"
#. module: website_mail_snippet_responsive
#: view:website:website_mail.email_designer_snippets
#. module: website_mail_snippet_fixed
#: view:website:560px_section
msgid "" msgid ""
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed varius, leo a " "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed varius, leo a "
"ullamcorper feugiat, ante purus sodales justo, a faucibus libero lacus a " "ullamcorper feugiat, ante purus sodales justo, a faucibus libero lacus a "
@ -80,19 +80,19 @@ msgstr ""
"ullamcorper feugiat, ante purus sodales justo, a faucibus libero lacus a " "ullamcorper feugiat, ante purus sodales justo, a faucibus libero lacus a "
"est. Aenean at mollis ipsum." "est. Aenean at mollis ipsum."
#. module: website_mail_snippet_responsive
#: view:website:website_mail.email_designer_snippets
#. module: website_mail_snippet_fixed
#: view:website:560px_section
msgid "News Item" msgid "News Item"
msgstr "Noticia del boletín" msgstr "Noticia del boletín"
#. module: website_mail_snippet_responsive
#. module: website_mail_snippet_fixed
#. openerp-web #. openerp-web
#: code:addons/website_mail_snippet_responsive/static/src/js/vertical_resize.js:22
#: code:addons/website_mail_snippet_fixed/static/src/js/vertical_resize.js:22
#, python-format #, python-format
msgid "Set element height" msgid "Set element height"
msgstr "" msgstr ""
#. module: website_mail_snippet_responsive
#: view:website:website_mail.email_designer_snippets
#. module: website_mail_snippet_fixed
#: view:website:560px_section
msgid "Title" msgid "Title"
msgstr "Título" msgstr "Título"

38
website_mail_snippet_fixed/static/src/js/vertical_resize.js

@ -1,38 +0,0 @@
/* © 2016 Antiun Ingeniería S.L. - Jairo Llopis
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). */
"use strict";
(function ($) {
var _t = openerp._t,
prompt = openerp.website.prompt,
snippet = openerp.website.snippet;
snippet.options.vertical_resize = snippet.Option.extend({
start: function () {
var self = this;
self._super();
return self.$el.find(".js_vertical_resize").click(function(){
return self.ask();
});
},
ask: function() {
var self = this;
return prompt({
window_title: _t("Set element height"),
input: _t("Element height in pixels"),
}).then(function (answer) {
return self.resize(answer);
});
},
resize: function(size) {
this.$target.css("height", String(size) + "px");
// Old-school height attribute changed too if needed
if (this.$target.attr("height")) {
this.$target.attr("height", size);
}
},
});
})(jQuery);

16
website_mail_snippet_fixed/views/assets.xml

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- © 2016 Antiun Ingeniería S.L. - Jairo Llopis
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -->
<openerp>
<data>
<template id="assets_editor" inherit_id="website.assets_editor">
<xpath expr=".">
<script type="text/javascript"
src="/website_mail_snippet_responsive/static/src/js/vertical_resize.js"/>
</xpath>
</template>
</data>
</openerp>

6
website_mail_snippet_fixed/views/snippet_1_col.xml

@ -6,9 +6,9 @@
<data> <data>
<template id="snippet_1_col" <template id="snippet_1_col"
inherit_id="website_mail.email_designer_snippets">
<xpath expr="//div[@id='snippet_email_structure']">
<t t-call="website_mail_snippet_responsive.snippet">
inherit_id="560px_section">
<xpath expr=".">
<t t-call="website_mail_snippet_fixed.snippet">
<t t-set="image" t-value="'snippet_1_col'"/> <t t-set="image" t-value="'snippet_1_col'"/>
<t t-set="title">Big image + Text + Button (1 column)</t> <t t-set="title">Big image + Text + Button (1 column)</t>
<tbody> <tbody>

6
website_mail_snippet_fixed/views/snippet_2_cols.xml

@ -6,9 +6,9 @@
<data> <data>
<template id="snippet_2_cols" <template id="snippet_2_cols"
inherit_id="website_mail.email_designer_snippets">
<xpath expr="//div[@id='snippet_email_structure']">
<t t-call="website_mail_snippet_responsive.snippet">
inherit_id="560px_section">
<xpath expr=".">
<t t-call="website_mail_snippet_fixed.snippet">
<t t-set="image" t-value="'snippet_2_cols'"/> <t t-set="image" t-value="'snippet_2_cols'"/>
<t t-set="title">Image + Text + Button (2 columns)</t> <t t-set="title">Image + Text + Button (2 columns)</t>
<tbody> <tbody>

6
website_mail_snippet_fixed/views/snippet_3_cols.xml

@ -6,9 +6,9 @@
<data> <data>
<template id="snippet_3_cols" <template id="snippet_3_cols"
inherit_id="website_mail.email_designer_snippets">
<xpath expr="//div[@id='snippet_email_structure']">
<t t-call="website_mail_snippet_responsive.snippet">
inherit_id="560px_section">
<xpath expr=".">
<t t-call="website_mail_snippet_fixed.snippet">
<t t-set="image" t-value="'snippet_3_cols'"/> <t t-set="image" t-value="'snippet_3_cols'"/>
<t t-set="title">Image + Text + Button (3 columns)</t> <t t-set="title">Image + Text + Button (3 columns)</t>
<tbody> <tbody>

18
website_mail_snippet_fixed/views/snippet_hr.xml

@ -6,21 +6,9 @@
<data> <data>
<template id="snippet_hr" <template id="snippet_hr"
inherit_id="website_mail.email_designer_snippets">
<xpath expr="//div[@id='snippet_options']">
<div
data-snippet-option-id='vertical_resize'
data-selector=".vertical_resizable">
<li>
<a href="#" class="button js_vertical_resize">
Change Height
</a>
</li>
</div>
</xpath>
<xpath expr="//div[@id='snippet_email_structure']">
<t t-call="website_mail_snippet_responsive.snippet">
inherit_id="560px_section">
<xpath expr=".">
<t t-call="website_mail_snippet_fixed.snippet">
<t t-set="image" t-value="'snippet_hr'"/> <t t-set="image" t-value="'snippet_hr'"/>
<t t-set="title">Horizontal Separator</t> <t t-set="title">Horizontal Separator</t>
<tbody> <tbody>

6
website_mail_snippet_fixed/views/snippet_img_text.xml

@ -6,9 +6,9 @@
<data> <data>
<template id="snippet_img_text" <template id="snippet_img_text"
inherit_id="website_mail.email_designer_snippets">
<xpath expr="//div[@id='snippet_email_structure']">
<t t-call="website_mail_snippet_responsive.snippet">
inherit_id="560px_section">
<xpath expr=".">
<t t-call="website_mail_snippet_fixed.snippet">
<t t-set="image" t-value="'snippet_img_text'"/> <t t-set="image" t-value="'snippet_img_text'"/>
<t t-set="title">Left Image, Right Text + Button</t> <t t-set="title">Left Image, Right Text + Button</t>
<tbody> <tbody>

6
website_mail_snippet_fixed/views/snippet_text_img.xml

@ -6,9 +6,9 @@
<data> <data>
<template id="snippet_text_img" <template id="snippet_text_img"
inherit_id="website_mail.email_designer_snippets">
<xpath expr="//div[@id='snippet_email_structure']">
<t t-call="website_mail_snippet_responsive.snippet">
inherit_id="560px_section">
<xpath expr=".">
<t t-call="website_mail_snippet_fixed.snippet">
<t t-set="image" t-value="'snippet_text_img'"/> <t t-set="image" t-value="'snippet_text_img'"/>
<t t-set="title">Left Text and Button, Right Image</t> <t t-set="title">Left Text and Button, Right Image</t>
<tbody> <tbody>

23
website_mail_snippet_fixed/views/templates.xml

@ -5,12 +5,33 @@
<openerp> <openerp>
<data> <data>
<!-- Section with 560px width snippets -->
<template id="560px_section_add"
inherit_id="website_mail.email_designer_snippets">
<xpath expr="//a[@href='#snippet_email_structure']/.." position="after">
<li>
<a href="#snippet_email_560px" data-toggle="tab">
Fixed 560px Width
</a>
</li>
</xpath>
<xpath expr="//div[@id='snippet_email_structure']" position="after">
<div id="snippet_email_560px" class="tab-pane fade">
<t t-call="website_mail_snippet_fixed.560px_section"/>
</div>
</xpath>
</template>
<template id="560px_section"/>
<!-- Base structure for all snippets -->
<template id="snippet"> <template id="snippet">
<div> <div>
<div class="oe_snippet_thumbnail"> <div class="oe_snippet_thumbnail">
<img <img
class="oe_snippet_thumbnail_img" class="oe_snippet_thumbnail_img"
t-attf-src="/website_mail_snippet_responsive/static/src/img/#{image}.png"/>
t-attf-src="/website_mail_snippet_fixed/static/src/img/#{image}.png"/>
<span <span
t-esc="title" t-esc="title"
class="oe_snippet_thumbnail_title"/> class="oe_snippet_thumbnail_title"/>

Loading…
Cancel
Save