diff --git a/website_mail_snippet_bg_color/README.rst b/website_mail_snippet_bg_color/README.rst new file mode 100644 index 00000000..31d4c322 --- /dev/null +++ b/website_mail_snippet_bg_color/README.rst @@ -0,0 +1,75 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +======================================= +Email Snippets Background Color Chooser +======================================= + +This module extends the functionality of the website mail designer to support +setting a custom background color to any snippet and allow you to customize it. + +Usage +===== + +To use this module, you need to: + +#. Install any module that makes use of the website mail designer, such as + ``mass_mailing``. +#. Edit an email with the website mail designer. +#. Drag & drop any snippet into the mail body. +#. Choose *Customize > Choose Background Color*. +#. Pick any color, or enter its HTML code in the box, or press *Clear* to + remove it. +#. Press OK. + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/205/8.0 + +Known issues / Roadmap +====================== + +* Add the same functionality to all website snipppets. It would not be very + hard, just another XML template. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues +`_. In case of trouble, please +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 +`_. + +Credits +======= + +Images +------ + +* Odoo Community Association: `Icon `_. + +Contributors +------------ + +* Rafael Blasco +* Jairo Llopis + +Maintainer +---------- + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +This module is maintained by the OCA. + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +To contribute to this module, please visit https://odoo-community.org. diff --git a/website_mail_snippet_bg_color/__init__.py b/website_mail_snippet_bg_color/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/website_mail_snippet_bg_color/__openerp__.py b/website_mail_snippet_bg_color/__openerp__.py new file mode 100644 index 00000000..fce5d974 --- /dev/null +++ b/website_mail_snippet_bg_color/__openerp__.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +# © 2016 Antiun Ingeniería S.L. - Jairo Llopis +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +{ + "name": "Email Snippets Background Color Chooser", + "summary": "Set any background color for any mail editor snippet", + "version": "8.0.1.0.0", + "category": "Marketing", + "website": "http://www.antiun.com", + "author": "Antiun Ingeniería S.L., Odoo Community Association (OCA)", + "license": "AGPL-3", + "application": False, + "installable": True, + "images": [ + "images/click_option.png", + "images/color_chooser.png", + "images/color_set.png", + ], + "depends": [ + "website_mail", + ], + "data": [ + "views/assets.xml", + "views/snippets.xml", + ], +} diff --git a/website_mail_snippet_bg_color/i18n/es.po b/website_mail_snippet_bg_color/i18n/es.po new file mode 100644 index 00000000..3523cf06 --- /dev/null +++ b/website_mail_snippet_bg_color/i18n/es.po @@ -0,0 +1,23 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * website_mail_snippet_bg_color +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-02-09 16:32+0000\n" +"PO-Revision-Date: 2016-02-09 17:33+0100\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: \n" +"Language: es\n" +"X-Generator: Poedit 1.8.6\n" + +#. module: website_mail_snippet_bg_color +#: view:website:website_mail.email_designer_snippets +msgid "Choose Background Color" +msgstr "Escoger el color de fondo" diff --git a/website_mail_snippet_bg_color/images/click_option.png b/website_mail_snippet_bg_color/images/click_option.png new file mode 100644 index 00000000..c01ec931 Binary files /dev/null and b/website_mail_snippet_bg_color/images/click_option.png differ diff --git a/website_mail_snippet_bg_color/images/color_chooser.png b/website_mail_snippet_bg_color/images/color_chooser.png new file mode 100644 index 00000000..0c9073e1 Binary files /dev/null and b/website_mail_snippet_bg_color/images/color_chooser.png differ diff --git a/website_mail_snippet_bg_color/images/color_set.png b/website_mail_snippet_bg_color/images/color_set.png new file mode 100644 index 00000000..8617d9cd Binary files /dev/null and b/website_mail_snippet_bg_color/images/color_set.png differ diff --git a/website_mail_snippet_bg_color/static/description/icon.png b/website_mail_snippet_bg_color/static/description/icon.png new file mode 100644 index 00000000..3a0328b5 Binary files /dev/null and b/website_mail_snippet_bg_color/static/description/icon.png differ diff --git a/website_mail_snippet_bg_color/static/src/js/bg_color_chooser.js b/website_mail_snippet_bg_color/static/src/js/bg_color_chooser.js new file mode 100644 index 00000000..c0368a00 --- /dev/null +++ b/website_mail_snippet_bg_color/static/src/js/bg_color_chooser.js @@ -0,0 +1,35 @@ +/* © 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 snippet = openerp.website.snippet; + + snippet.options.bg_color_chooser = snippet.Option.extend({ + start: function () { + var self = this; + self._super(); + return self.$el.find(".js_bg_color_chooser").click(function(){ + return self.choose(); + }); + }, + + choose: function() { + var self = this; + return CKEDITOR.instances.wrapwrap.getColorFromDialog( + function(color){ + return self.change(color); + } + ); + }, + + change: function(color) { + this.$target.css("background-color", color); + + // Old-school bgcolor attribute if the element already had one + if (this.$target.attr("bgcolor")) { + this.$target.attr("bgcolor", color); + } + }, + }); +})(jQuery); diff --git a/website_mail_snippet_bg_color/views/assets.xml b/website_mail_snippet_bg_color/views/assets.xml new file mode 100644 index 00000000..209016fd --- /dev/null +++ b/website_mail_snippet_bg_color/views/assets.xml @@ -0,0 +1,16 @@ + + + + + + +