From 1bbbca357dd93222c762a7adf1a35fe76aec0cc2 Mon Sep 17 00:00:00 2001 From: Jairo Llopis Date: Tue, 17 Nov 2015 12:19:14 +0100 Subject: [PATCH 01/20] [ADD] website_snippet_big_button. --- website_snippet_big_button/README.rst | 74 +++++++++++++ website_snippet_big_button/__init__.py | 0 website_snippet_big_button/__openerp__.py | 26 +++++ website_snippet_big_button/i18n/es.po | 43 ++++++++ website_snippet_big_button/i18n/sl.po | 44 ++++++++ .../static/description/icon.png | Bin 0 -> 2297 bytes .../static/description/icon.svg | 101 ++++++++++++++++++ .../src/css/website_snippet_big_button.css | 9 ++ .../css/website_snippet_big_button.css.map | 7 ++ .../src/css/website_snippet_big_button.sass | 9 ++ .../src/js/website_snippet_big_button.js | 26 +++++ website_snippet_big_button/views/assets.xml | 21 ++++ website_snippet_big_button/views/snippets.xml | 48 +++++++++ 13 files changed, 408 insertions(+) create mode 100644 website_snippet_big_button/README.rst create mode 100644 website_snippet_big_button/__init__.py create mode 100644 website_snippet_big_button/__openerp__.py create mode 100644 website_snippet_big_button/i18n/es.po create mode 100644 website_snippet_big_button/i18n/sl.po create mode 100644 website_snippet_big_button/static/description/icon.png create mode 100644 website_snippet_big_button/static/description/icon.svg create mode 100644 website_snippet_big_button/static/src/css/website_snippet_big_button.css create mode 100644 website_snippet_big_button/static/src/css/website_snippet_big_button.css.map create mode 100644 website_snippet_big_button/static/src/css/website_snippet_big_button.sass create mode 100644 website_snippet_big_button/static/src/js/website_snippet_big_button.js create mode 100644 website_snippet_big_button/views/assets.xml create mode 100644 website_snippet_big_button/views/snippets.xml diff --git a/website_snippet_big_button/README.rst b/website_snippet_big_button/README.rst new file mode 100644 index 0000000000..85a08ba8d6 --- /dev/null +++ b/website_snippet_big_button/README.rst @@ -0,0 +1,74 @@ +.. 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 + +=================== +Big Buttons Snippet +=================== + +This module was written to extend the functionality of website to support +inserting a block with a "like" and "not like" button and allow you to +customize their links, to provide a better UX for your visitors. + +Usage +===== + +To use this module, you need to: + +* Edit any web page. +* Go to *Insert Blocks > Big Buttons*. +* Drag it anywhere. + +The link that the button will follow is located in the big text part. You can +change it and the whole button action will change too. If there are more than 1 +link inside the button, clicking on the outer button will trigger the action +found in the first link + +Theming +======= + +This section has class ``big-buttons``. Use it to style it. + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/186/8.0 + +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 +------ + +* FontAwesome: `Some parts of the icon `_. + +Contributors +------------ + +* 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 http://odoo-community.org. diff --git a/website_snippet_big_button/__init__.py b/website_snippet_big_button/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/website_snippet_big_button/__openerp__.py b/website_snippet_big_button/__openerp__.py new file mode 100644 index 0000000000..6f407f18ae --- /dev/null +++ b/website_snippet_big_button/__openerp__.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +# © 2015 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +{ + "name": "Big Buttons Snippet", + "summary": "A snippet that adds two big buttons", + "version": "8.0.1.0.0", + "category": "Website", + "website": "https://odoo-community.org/", + "author": "Grupo ESOC Ingeniería de Servicios, S.L.U., " + "Odoo Community Association (OCA)", + "license": "AGPL-3", + "application": False, + "installable": True, + "external_dependencies": { + "python": [], + "bin": [], + }, + "depends": [ + "website", + ], + "data": [ + "views/assets.xml", + "views/snippets.xml", + ], +} diff --git a/website_snippet_big_button/i18n/es.po b/website_snippet_big_button/i18n/es.po new file mode 100644 index 0000000000..b5ed40ac4b --- /dev/null +++ b/website_snippet_big_button/i18n/es.po @@ -0,0 +1,43 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * website_snippet_big_button +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-11-17 12:17+0100\n" +"PO-Revision-Date: 2015-11-17 12:18+0100\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Poedit 1.8.5\n" +"Last-Translator: Jairo Llopis \n" +"Language: es_ES\n" + +#. module: website_snippet_big_button +#: view:website:website.snippets +msgid "Big Buttons" +msgstr "Botones grandes" + +#. module: website_snippet_big_button +#: view:website:website.snippets +msgid "Continue searching" +msgstr "Seguir buscando" + +#. module: website_snippet_big_button +#: view:website:website.snippets +msgid "I want another thing" +msgstr "Quiero otra cosa" + +#. module: website_snippet_big_button +#: view:website:website.snippets +msgid "I want this" +msgstr "Quiero esto" + +#. module: website_snippet_big_button +#: view:website:website.snippets +msgid "Request budget" +msgstr "Solicitar presupuesto" diff --git a/website_snippet_big_button/i18n/sl.po b/website_snippet_big_button/i18n/sl.po new file mode 100644 index 0000000000..3e5325b032 --- /dev/null +++ b/website_snippet_big_button/i18n/sl.po @@ -0,0 +1,44 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * website_snippet_big_button +# +# Translators: +# Matjaž Mozetič , 2016 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-06-23 03:09+0000\n" +"PO-Revision-Date: 2016-06-23 03:09+0000\n" +"Last-Translator: Matjaž Mozetič , 2016\n" +"Language-Team: Slovenian (https://www.transifex.com/oca/teams/23907/sl/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: sl\n" +"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n" + +#. module: website_snippet_big_button +#: view:website:website.snippets +msgid "Big Buttons" +msgstr "Veliki gumbi" + +#. module: website_snippet_big_button +#: view:website:website.snippets +msgid "Continue searching" +msgstr "Nadaljuj z iskanjem" + +#. module: website_snippet_big_button +#: view:website:website.snippets +msgid "I want another thing" +msgstr "Želim nekaj drugega" + +#. module: website_snippet_big_button +#: view:website:website.snippets +msgid "I want this" +msgstr "Želim to" + +#. module: website_snippet_big_button +#: view:website:website.snippets +msgid "Request budget" +msgstr "Zahtevaj proračun" diff --git a/website_snippet_big_button/static/description/icon.png b/website_snippet_big_button/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..1291ca45bb557999ebbfb1a7b557ee5eeab12d9c GIT binary patch literal 2297 zcmaJ@XHb*N8V(kkv{0p!2nbS?9Hn;x1`E9-MGS-zdT60}P#|;+iXb2&K@bF_pB#D% zL`n!KhzLkk-~tkn5+L5sx%d9Kb7$_(?CyN~?(V$v?DIa)mttXdos(UJ9Rvb#nj+v< zz>EaCIV&?Til?}j0MnUJLsJ`8pvABvalkiQ5W+DO*gy5VGa1SiL;{P#7-I*Fb)Xj} z;%sbgEirD%WQqj=2P#jhU&fnuIjo^k~CP<~?r4k0!%Bl$or`RUy%kveQAN&6G z#3@v1iZ|@26PJJLaSb?l3#+gvCj4R?QNB7=Jr$w~$C_VPRqPTw8wrAE-=|eMo=Bc`HXp^5#rSd%Uxvps$~w zypobDFxwh2 zF+H6^^@dm5u{e`(L7GKZRaM8w#=6pkE;EQVQM6??wZJ(-W8>rL2Gr4qh%rtTkqi)_ ztPJvWh$&A!7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Y8MBh~fd8OuupSzWa*6n);uK7k${ z(8R<!3X0UE6ch$a$Hq&eG~JV3_e_}Rs{SO6hH(s$PY zT$eDKDJd!7#*y!8J&fa>e2e%6ne+6^u5CEGs-GINIb`*aWmW*Nge9(5ZZ_wP>grJx z2~AB+Z!}t3Te~po$7zpDwhLB)!C+rz@ZBD7_q&Z;e%%K{RhkhKuK#iA|7+p@ d8%+PjlvHlPTryu%2mGdhOpVRpHHPj9{{+bhQRn~w literal 0 HcmV?d00001 diff --git a/website_snippet_big_button/static/description/icon.svg b/website_snippet_big_button/static/description/icon.svg new file mode 100644 index 0000000000..494fe4e084 --- /dev/null +++ b/website_snippet_big_button/static/description/icon.svg @@ -0,0 +1,101 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + diff --git a/website_snippet_big_button/static/src/css/website_snippet_big_button.css b/website_snippet_big_button/static/src/css/website_snippet_big_button.css new file mode 100644 index 0000000000..6345a3dc03 --- /dev/null +++ b/website_snippet_big_button/static/src/css/website_snippet_big_button.css @@ -0,0 +1,9 @@ +@charset "UTF-8"; +/* © 2015 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis + * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + */ +.big-buttons .btn { + width: 100%; + white-space: normal; } + +/*# sourceMappingURL=website_snippet_big_button.css.map */ diff --git a/website_snippet_big_button/static/src/css/website_snippet_big_button.css.map b/website_snippet_big_button/static/src/css/website_snippet_big_button.css.map new file mode 100644 index 0000000000..1611d93292 --- /dev/null +++ b/website_snippet_big_button/static/src/css/website_snippet_big_button.css.map @@ -0,0 +1,7 @@ +{ +"version": 3, +"mappings": ";;;;AAMI,iBAAI;EACA,KAAK,EAAE,IAAI;EACX,WAAW,EAAE,MAAM", +"sources": ["website_snippet_big_button.sass"], +"names": [], +"file": "website_snippet_big_button.css" +} \ No newline at end of file diff --git a/website_snippet_big_button/static/src/css/website_snippet_big_button.sass b/website_snippet_big_button/static/src/css/website_snippet_big_button.sass new file mode 100644 index 0000000000..0a1a525cb5 --- /dev/null +++ b/website_snippet_big_button/static/src/css/website_snippet_big_button.sass @@ -0,0 +1,9 @@ +@charset "UTF-8" +/* © 2015 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis + * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + */ + +.big-buttons + .btn + width: 100% + white-space: normal diff --git a/website_snippet_big_button/static/src/js/website_snippet_big_button.js b/website_snippet_big_button/static/src/js/website_snippet_big_button.js new file mode 100644 index 0000000000..74b2927ae5 --- /dev/null +++ b/website_snippet_big_button/static/src/js/website_snippet_big_button.js @@ -0,0 +1,26 @@ +/* © 2015 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis + * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + */ + +(function ($) { + 'use strict'; + + var snippet = openerp.website.snippet; + + snippet.animationRegistry.big_button = snippet.Animation.extend({ + selector: ".js_big_button", + start: function(editable_mode) { + if (!editable_mode) { + this.$target.click(this.on_click); + } + }, + /** + * Make the whole button element be clickable. It would have been much + * easier to make the button an tag, but website editor would + * break the layout, so this hack is needed. + */ + on_click: function (event) { + $(event.currentTarget).find("a")[0].click(); + }, + }); +})(jQuery); diff --git a/website_snippet_big_button/views/assets.xml b/website_snippet_big_button/views/assets.xml new file mode 100644 index 0000000000..3cca8747eb --- /dev/null +++ b/website_snippet_big_button/views/assets.xml @@ -0,0 +1,21 @@ + + + + + + +