diff --git a/setup/_metapackage/VERSION.txt b/setup/_metapackage/VERSION.txt index eec2e9a3..169c8c11 100644 --- a/setup/_metapackage/VERSION.txt +++ b/setup/_metapackage/VERSION.txt @@ -1 +1 @@ -12.0.20190625.0 \ No newline at end of file +12.0.20190710.0 \ No newline at end of file diff --git a/setup/_metapackage/setup.py b/setup/_metapackage/setup.py index 37a501b9..21b918c5 100644 --- a/setup/_metapackage/setup.py +++ b/setup/_metapackage/setup.py @@ -14,6 +14,7 @@ setuptools.setup( 'odoo12-addon-web_dialog_size', 'odoo12-addon-web_disable_export_group', 'odoo12-addon-web_edit_user_filter', + 'odoo12-addon-web_editor_background_color', 'odoo12-addon-web_environment_ribbon', 'odoo12-addon-web_export_view', 'odoo12-addon-web_favicon', diff --git a/setup/web_editor_background_color/odoo/addons/web_editor_background_color b/setup/web_editor_background_color/odoo/addons/web_editor_background_color new file mode 120000 index 00000000..c3c5fcfd --- /dev/null +++ b/setup/web_editor_background_color/odoo/addons/web_editor_background_color @@ -0,0 +1 @@ +../../../../web_editor_background_color \ No newline at end of file diff --git a/setup/web_editor_background_color/setup.py b/setup/web_editor_background_color/setup.py new file mode 100644 index 00000000..28c57bb6 --- /dev/null +++ b/setup/web_editor_background_color/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/web_editor_background_color/README.rst b/web_editor_background_color/README.rst new file mode 100644 index 00000000..bd166b3b --- /dev/null +++ b/web_editor_background_color/README.rst @@ -0,0 +1,107 @@ +================================== +Web Editor Background Color Picker +================================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png + :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github + :target: https://github.com/OCA/web/tree/12.0/web_editor_background_color + :alt: OCA/web +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/web-12-0/web-12-0-web_editor_background_color + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/162/12.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module extends the functionality of the web editor to support +setting a custom background color to any snippet allowing you to customize it. + +.. figure:: https://user-images.githubusercontent.com/973709/46802401-1c915180-cd55-11e8-9397-f198548a690c.gif + :alt: Screenshot of color picker in mass mailing editor + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +To use this module, you need to: + +#. Install any module that makes use of the web editor, such as + ``mass_mailing`` or ``website``. +#. Use that module's facilities to edit some web content. +#. Drag & drop any snippet into the web editor body. +#. Click on *Customize > Text-Image > Background Color > icon*. +#. Choose a custom color by either: + * Writing any valid HTML color code in the text input. + * Selecting a color from the color picker. + +Known issues / Roadmap +====================== + +* Preview when user plays with colors. + See https://github.com/OCA/web/pull/1327#issuecomment-509621572 to understand + the (co/i)mplications. +* When (& if) Odoo merges https://github.com/odoo/odoo/pull/34687, this + module will no longer be needed. + +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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Tecnativa + +Contributors +~~~~~~~~~~~~ + +* Jairo Llopis - https://www.tecnativa.com + +Other credits +~~~~~~~~~~~~~ + +* This addon includes code copied from bootstrap-colorpicker_ + +.. _bootstrap-colorpicker: https://github.com/itsjavi/bootstrap-colorpicker/tree/2.5.3 + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +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. + +This module is part of the `OCA/web `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/web_editor_background_color/__init__.py b/web_editor_background_color/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/web_editor_background_color/__manifest__.py b/web_editor_background_color/__manifest__.py new file mode 100644 index 00000000..3b719bf7 --- /dev/null +++ b/web_editor_background_color/__manifest__.py @@ -0,0 +1,23 @@ +# Copyright 2017 Jairo Llopis +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). +{ + "name": "Web Editor Background Color Picker", + "summary": "Set any background color for web editor snippets", + "version": "12.0.1.0.0", + "category": "Website", + "website": "https://github.com/OCA/web", + "author": "Tecnativa, Odoo Community Association (OCA)", + "license": "LGPL-3", + "application": False, + "installable": True, + "images": [ + "static/description/mass_mailing_editor.png", + ], + "depends": [ + "web_editor", + ], + "data": [ + "templates/assets.xml", + "templates/editor.xml", + ], +} diff --git a/web_editor_background_color/i18n/ca.po b/web_editor_background_color/i18n/ca.po new file mode 100644 index 00000000..5e97c583 --- /dev/null +++ b/web_editor_background_color/i18n/ca.po @@ -0,0 +1,22 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_editor_background_color +# +# Translators: +# Marc Tormo i Bochaca , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-03-30 08:28+0000\n" +"PO-Revision-Date: 2017-03-30 08:28+0000\n" +"Last-Translator: Marc Tormo i Bochaca , 2017\n" +"Language-Team: Catalan (https://www.transifex.com/oca/teams/23907/ca/)\n" +"Language: ca\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#~ msgid "Color" +#~ msgstr "Color" diff --git a/web_editor_background_color/i18n/es.po b/web_editor_background_color/i18n/es.po new file mode 100644 index 00000000..bab232fc --- /dev/null +++ b/web_editor_background_color/i18n/es.po @@ -0,0 +1,21 @@ +# 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" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: \n" +"X-Generator: Poedit 1.8.6\n" + +#~ msgid "Pick Background Color" +#~ msgstr "Escoger el color de fondo" diff --git a/web_editor_background_color/i18n/fr.po b/web_editor_background_color/i18n/fr.po new file mode 100644 index 00000000..0a3d95a3 --- /dev/null +++ b/web_editor_background_color/i18n/fr.po @@ -0,0 +1,23 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * website_mail_snippet_bg_color +# +# Translators: +# Christophe CHAUVET , 2016 +msgid "" +msgstr "" +"Project-Id-Version: social (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-06-30 01:07+0000\n" +"PO-Revision-Date: 2016-06-17 14:52+0000\n" +"Last-Translator: Christophe CHAUVET \n" +"Language-Team: French (http://www.transifex.com/oca/OCA-social-8-0/language/" +"fr/)\n" +"Language: fr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#~ msgid "Pick Background Color" +#~ msgstr "Mettre la couleur de fond" diff --git a/web_editor_background_color/i18n/sl.po b/web_editor_background_color/i18n/sl.po new file mode 100644 index 00000000..a06a2d19 --- /dev/null +++ b/web_editor_background_color/i18n/sl.po @@ -0,0 +1,24 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * website_mail_snippet_bg_color +# +# Translators: +# Matjaž Mozetič , 2016 +msgid "" +msgstr "" +"Project-Id-Version: social (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-02-27 01:40+0000\n" +"PO-Revision-Date: 2016-02-27 16:56+0000\n" +"Last-Translator: Matjaž Mozetič \n" +"Language-Team: Slovenian (http://www.transifex.com/oca/OCA-social-8-0/" +"language/sl/)\n" +"Language: sl\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n" +"%100==4 ? 2 : 3);\n" + +#~ msgid "Pick Background Color" +#~ msgstr "Izbira barve ozadja" diff --git a/web_editor_background_color/i18n/web_editor_background_color.pot b/web_editor_background_color/i18n/web_editor_background_color.pot new file mode 100644 index 00000000..d2e396f1 --- /dev/null +++ b/web_editor_background_color/i18n/web_editor_background_color.pot @@ -0,0 +1,14 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + diff --git a/web_editor_background_color/readme/CONTRIBUTORS.rst b/web_editor_background_color/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000..bf93c78d --- /dev/null +++ b/web_editor_background_color/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Jairo Llopis - https://www.tecnativa.com diff --git a/web_editor_background_color/readme/CREDITS.rst b/web_editor_background_color/readme/CREDITS.rst new file mode 100644 index 00000000..7c81b130 --- /dev/null +++ b/web_editor_background_color/readme/CREDITS.rst @@ -0,0 +1,3 @@ +* This addon includes code copied from bootstrap-colorpicker_ + +.. _bootstrap-colorpicker: https://github.com/itsjavi/bootstrap-colorpicker/tree/2.5.3 diff --git a/web_editor_background_color/readme/DESCRIPTION.rst b/web_editor_background_color/readme/DESCRIPTION.rst new file mode 100644 index 00000000..76576d15 --- /dev/null +++ b/web_editor_background_color/readme/DESCRIPTION.rst @@ -0,0 +1,5 @@ +This module extends the functionality of the web editor to support +setting a custom background color to any snippet allowing you to customize it. + +.. figure:: https://user-images.githubusercontent.com/973709/46802401-1c915180-cd55-11e8-9397-f198548a690c.gif + :alt: Screenshot of color picker in mass mailing editor diff --git a/web_editor_background_color/readme/ROADMAP.rst b/web_editor_background_color/readme/ROADMAP.rst new file mode 100644 index 00000000..e04cb524 --- /dev/null +++ b/web_editor_background_color/readme/ROADMAP.rst @@ -0,0 +1,5 @@ +* Preview when user plays with colors. + See https://github.com/OCA/web/pull/1327#issuecomment-509621572 to understand + the (co/i)mplications. +* When (& if) Odoo merges https://github.com/odoo/odoo/pull/34687, this + module will no longer be needed. diff --git a/web_editor_background_color/readme/USAGE.rst b/web_editor_background_color/readme/USAGE.rst new file mode 100644 index 00000000..6046c99f --- /dev/null +++ b/web_editor_background_color/readme/USAGE.rst @@ -0,0 +1,10 @@ +To use this module, you need to: + +#. Install any module that makes use of the web editor, such as + ``mass_mailing`` or ``website``. +#. Use that module's facilities to edit some web content. +#. Drag & drop any snippet into the web editor body. +#. Click on *Customize > Text-Image > Background Color > icon*. +#. Choose a custom color by either: + * Writing any valid HTML color code in the text input. + * Selecting a color from the color picker. diff --git a/web_editor_background_color/static/description/icon.png b/web_editor_background_color/static/description/icon.png new file mode 100644 index 00000000..794e8ef5 Binary files /dev/null and b/web_editor_background_color/static/description/icon.png differ diff --git a/web_editor_background_color/static/description/index.html b/web_editor_background_color/static/description/index.html new file mode 100644 index 00000000..94d5a9e3 --- /dev/null +++ b/web_editor_background_color/static/description/index.html @@ -0,0 +1,456 @@ + + + + + + +Web Editor Background Color Picker + + + +
+

Web Editor Background Color Picker

+ + +

Beta License: LGPL-3 OCA/web Translate me on Weblate Try me on Runbot

+

This module extends the functionality of the web editor to support +setting a custom background color to any snippet allowing you to customize it.

+
+Screenshot of color picker in mass mailing editor +
+

Table of contents

+ +
+

Usage

+

To use this module, you need to:

+
    +
  1. Install any module that makes use of the web editor, such as +mass_mailing or website.
  2. +
  3. Use that module’s facilities to edit some web content.
  4. +
  5. Drag & drop any snippet into the web editor body.
  6. +
  7. Click on Customize > Text-Image > Background Color > </> icon.
  8. +
  9. Choose a custom color by either: +* Writing any valid HTML color code in the text input. +* Selecting a color from the color picker.
  10. +
+
+
+

Known issues / Roadmap

+ +
+
+

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.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Tecnativa
  • +
+
+ +
+

Other credits

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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.

+

This module is part of the OCA/web project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/web_editor_background_color/static/src/css/background_color.scss b/web_editor_background_color/static/src/css/background_color.scss new file mode 100644 index 00000000..52b7bda8 --- /dev/null +++ b/web_editor_background_color/static/src/css/background_color.scss @@ -0,0 +1,14 @@ +/* Copyright 2017-2019 Jairo Llopis + * License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). */ + +.snippet-option-colorpicker { + .o_colorpicker_section[data-name="custom"] > .text-muted { + cursor: pointer; + border-radius: 5px; + + &:hover { + background-color: gray("400"); + color: $black; + } + } +} diff --git a/web_editor_background_color/static/src/js/background_color.js b/web_editor_background_color/static/src/js/background_color.js new file mode 100644 index 00000000..0e9763e6 --- /dev/null +++ b/web_editor_background_color/static/src/js/background_color.js @@ -0,0 +1,49 @@ +/* Copyright 2016-2019 Jairo Llopis + * License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). */ + +odoo.define("web_editor_background_color.colorpicker", function (require) { + "use strict"; + var ColorpickerDialog = require('web.colorpicker'); + var options = require("web_editor.snippets.options"); + var colorpicker = options.registry.colorpicker; + + colorpicker.include({ + custom_events: _.extend({}, colorpicker.prototype.custom_events, { + "colorpicker:saved": "_onCustomColorSave", + }), + events: _.extend({}, colorpicker.prototype.events, { + "click .o_colorpicker_section[data-name=custom]>.text-muted": + "_onCustomColorAsk", + }), + + /** + * Called when the user clicks on "Custom color" section header + */ + _onCustomColorAsk: function () { + var dialog = new ColorpickerDialog(this, { + defaultColor: this.$target.css("background-color"), + }); + dialog.open(); + }, + + /** + * Called when the user saves a custom color + * + * @param {Event} event + */ + _onCustomColorSave: function (event) { + // Add a button to remind recent choices + var $button = $("