From 1410cbd280a26df3231be51841c3453bd7280fe9 Mon Sep 17 00:00:00 2001 From: Jairo Llopis Date: Tue, 28 Jul 2015 10:47:28 +0200 Subject: [PATCH 01/17] Add module website_marginless_gallery. Update roadmap. --- website_snippet_marginless_gallery/README.rst | 80 +++++++++ .../__init__.py | 0 .../__openerp__.py | 22 +++ website_snippet_marginless_gallery/i18n/es.po | 77 +++++++++ .../static/description/icon.png | Bin 0 -> 5768 bytes .../static/description/icon.svg | 87 ++++++++++ .../website_snippet_marginless_gallery.css | 14 ++ ...website_snippet_marginless_gallery.css.map | 7 + .../website_snippet_marginless_gallery.sass | 20 +++ ...bsite_snippet_marginless_gallery.editor.js | 48 ++++++ ...website_snippet_marginless_gallery.tour.js | 91 +++++++++++ .../tests/__init__.py | 5 + .../tests/test_ui.py | 14 ++ .../views/assets.xml | 24 +++ .../views/snippets.xml | 154 ++++++++++++++++++ 15 files changed, 643 insertions(+) create mode 100644 website_snippet_marginless_gallery/README.rst create mode 100644 website_snippet_marginless_gallery/__init__.py create mode 100644 website_snippet_marginless_gallery/__openerp__.py create mode 100644 website_snippet_marginless_gallery/i18n/es.po create mode 100644 website_snippet_marginless_gallery/static/description/icon.png create mode 100644 website_snippet_marginless_gallery/static/description/icon.svg create mode 100644 website_snippet_marginless_gallery/static/src/css/website_snippet_marginless_gallery.css create mode 100644 website_snippet_marginless_gallery/static/src/css/website_snippet_marginless_gallery.css.map create mode 100644 website_snippet_marginless_gallery/static/src/css/website_snippet_marginless_gallery.sass create mode 100644 website_snippet_marginless_gallery/static/src/js/website_snippet_marginless_gallery.editor.js create mode 100644 website_snippet_marginless_gallery/static/src/js/website_snippet_marginless_gallery.tour.js create mode 100644 website_snippet_marginless_gallery/tests/__init__.py create mode 100644 website_snippet_marginless_gallery/tests/test_ui.py create mode 100644 website_snippet_marginless_gallery/views/assets.xml create mode 100644 website_snippet_marginless_gallery/views/snippets.xml diff --git a/website_snippet_marginless_gallery/README.rst b/website_snippet_marginless_gallery/README.rst new file mode 100644 index 0000000000..0dba7652f3 --- /dev/null +++ b/website_snippet_marginless_gallery/README.rst @@ -0,0 +1,80 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :alt: License: AGPL-3 + +========================== +Marginless Gallery Snippet +========================== + +This module extends the functionality of the website module to add a new +snippet that forms a marginless gallery and allow you to create a grid of +photos that have no spaces between themselves. + +Usage +===== + +To use this module, you need to: + +* Edit any page in your website. +* Go to *Insert blocks > Features*. +* Drag the *Marginless Gallery* snippet anywhere in your page. +* Choose a fixed height for all your images. This is required to maintain a + solid layout. Must be a number. + * If you still do not want the fixed height (maybe because your theme + applies it), just leave blank and press *Continue*. + +To change images, you need to: + +* Select any image block in the snippet you just created. +* Go to *Customize > Background* and choose any background you want. + * Backgrounds will be centered and cover the whole element in any layout. + +To change the images height, you need to: + +* Select any block inside the snippet you just created. +* Go to the top parent. +* Go to *Customize > Change Images Height*. +* Input a number and press *Continue*. + +Known issues / Roadmap +====================== + +* If you do not set a fixed height to all your images in the snippet, it will + get an ugly layout. Right now we manually set the height, but whenever + Bootstrap 4 starts being used in Odoo with its flexbox support, this will not + be needed anymore. + +* Improve it using `Masonry `_ like the + `Graphene theme `_ does. It + should allow to set arbitrary heights to images with a beautiful layout. + +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 `here +`_. + +Credits +======= + +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 https://odoo-community.org. diff --git a/website_snippet_marginless_gallery/__init__.py b/website_snippet_marginless_gallery/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/website_snippet_marginless_gallery/__openerp__.py b/website_snippet_marginless_gallery/__openerp__.py new file mode 100644 index 0000000000..9302d9941f --- /dev/null +++ b/website_snippet_marginless_gallery/__openerp__.py @@ -0,0 +1,22 @@ +# -*- encoding: utf-8 -*- +{ + "name": "Marginless Gallery Snippet", + "summary": "Add a snippet to have a marginless image gallery", + "version": "8.0.1.0.1", + "category": "Website", + "license": "AGPL-3", + + "website": "https://odoo-community.org/project/website-maintainers-79", + "author": "Grupo ESOC, Odoo Community Association (OCA)", + + "application": False, + "installable": True, + + "depends": [ + "website", + ], + "data": [ + "views/assets.xml", + "views/snippets.xml", + ], +} diff --git a/website_snippet_marginless_gallery/i18n/es.po b/website_snippet_marginless_gallery/i18n/es.po new file mode 100644 index 0000000000..7ae9480aae --- /dev/null +++ b/website_snippet_marginless_gallery/i18n/es.po @@ -0,0 +1,77 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * website_snippet_marginless_gallery +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-12-02 12:50+0000\n" +"PO-Revision-Date: 2015-12-02 13:52+0100\n" +"Last-Translator: Jairo Llopis \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.5\n" + +#. module: website_snippet_marginless_gallery +#: view:website:website.snippets +msgid "" +"All photos must have the same height or the\n" +" gallery layout will be broken" +msgstr "Todas las fotos deben tener la misma altura o la maquetación de la galería se estropeará" + +#. module: website_snippet_marginless_gallery +#: view:website:website.snippet_options +msgid "Change Images Height" +msgstr "Cambiar la altura de las imágenes" + +#. module: website_snippet_marginless_gallery +#. openerp-web +#: code:addons/website_snippet_marginless_gallery/static/src/js/website_snippet_marginless_gallery.editor.js:32 +#, python-format +msgid "Height for all images in gallery" +msgstr "Altura para todas las imágenes de la galería" + +#. module: website_snippet_marginless_gallery +#. openerp-web +#: code:addons/website_snippet_marginless_gallery/static/src/js/website_snippet_marginless_gallery.editor.js:33 +#, python-format +msgid "Image height in pixels" +msgstr "Altura de imagen en píxeles" + +#. module: website_snippet_marginless_gallery +#: view:website:website.snippets +msgid "Lorem ipsum" +msgstr "Lorem ipsum" + +#. module: website_snippet_marginless_gallery +#: view:website:website.snippets +msgid "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna." +msgstr "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna." + +#. module: website_snippet_marginless_gallery +#: view:website:website.snippets +msgid "Marginless Gallery" +msgstr "Galería sin margenes" + +#. module: website_snippet_marginless_gallery +#: view:website:website.snippets +msgid "Our Gallery" +msgstr "Nuestra galería" + +#. module: website_snippet_marginless_gallery +#: view:website:website.snippet_options +msgid "" +"section,\n" +" .carousel,\n" +" .parallax,\n" +" .marginless-gallery .img" +msgstr "" +"section,\n" +" .carousel,\n" +" .parallax,\n" +" .marginless-gallery .img" diff --git a/website_snippet_marginless_gallery/static/description/icon.png b/website_snippet_marginless_gallery/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..b4dc7ca917c0ad4465b33a54f2652080f764447a GIT binary patch literal 5768 zcmXAt1yoee+s7BArKL+klu%kg1Y}_)1t}#ZmXz+Lgmqb9X^@6h+Le%6k#Iq}S>T7# z0t?dJCHP+d?>%SkoI7Xk%z0*>`ONouV)XSiXs9@-Kp+r}mL|jysO^FBoPrE^bH~^e z02PU^s+KVY@Pty>qkwNpFHJLFp#Q|bLZm8`8wfPA`#m-FGxBuwgW38xfM76~*lQ10 zUpreb2Qg0{r`#Py4iJciR0{$&4n%LidTnZKk`v|%4lpxTQ5k`ABp4JL$i%pAO}aoA z8B_ff;-)fp?u?D4epo-3R2m+`9u<%MN=?+P;Y^6-MJ`Tmyk!?H%8#U1>`WqC{O(W6)6PIgdY%H_ z2!;M|?o2N?87(rrd65r?uLt_I5g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CI-pdrn{DUl41WO#LM$&C^P=zU8IcNHOkrtw%0WPVnG)jU}U=9BT z-siuI=or{qahyni`eDaY;@;(j#LyZN0My9nvDwZ?{gka=8Qmsy#A|6KKAfgkQKUb$1Tol6EAJz%Q}36yu;NYehSu4>3Qq@xp~ii-5# zZq&T9$aT%a{5Td|U{cgp53rO{<7jApKF@o`tn~t6C@sY{Q3xo`$SG*|z_);!*mmXw z9KfQ4W%*-n^&*D8($|5odF8>R1Y2At@h-}?N<9Mihu8vB39RoE1G4vt=hC!*#XYsP zLC3;!+MWs(L!wPD<8h%)Y)pWYr}PS3I096CpX$1)24u+?Q;oRVDe(s^6ECj0bNVIMz%M*GNk!T&zt>wwds8!5#be? zS8@X$gwDQH`nayZ&DAH-AD?$jN})%~NAo{^r5#qRi`rK>CI&$LPbvJWpKnhYd}dYt zr7|<4*5e(uB5Ik9nv6}I#uVqwU^kHev(Fi_J|v|#wrohhiZ`};k?{Co9paAc4D90% zA4$GI;cvQE9HraP$c3*-KE&h9ZBM%d5rV0xPNZ0lH!`%f17s(^_(E&ga%J7T;#fia0&5-ny(lkmL$)%1wNDq7xxzYxfk!#_ zP(hczMw0|PrSRny4{P+Yx3|X&IAY4a4hy8pfOORG%`exTb78qdj)Mt_-Lq@X;KtIX zsy7#}!GWJ=S-SVgu0-7*JrZg@haIKMVy9$J{{G!dm(AfF-(_Pd&}fa!2C@V6a1B;5 zIIanZx?ATZxsoDGpETZCfKfLqGSvGCb8zI63^fy1gt)s~e*bW?R7`n5A8w&I>+(k< fDjM;pcQ1UJ9z-s(%1i*V#vrYydXP$08^r$sdHD6w literal 0 HcmV?d00001 diff --git a/website_snippet_marginless_gallery/static/description/icon.svg b/website_snippet_marginless_gallery/static/description/icon.svg new file mode 100644 index 0000000000..9c79e97aba --- /dev/null +++ b/website_snippet_marginless_gallery/static/description/icon.svg @@ -0,0 +1,87 @@ + + + + + + + + + + + + image/svg+xml + + + + + + +  + + diff --git a/website_snippet_marginless_gallery/static/src/css/website_snippet_marginless_gallery.css b/website_snippet_marginless_gallery/static/src/css/website_snippet_marginless_gallery.css new file mode 100644 index 0000000000..d91c83c7e1 --- /dev/null +++ b/website_snippet_marginless_gallery/static/src/css/website_snippet_marginless_gallery.css @@ -0,0 +1,14 @@ +@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). */ +.marginless-gallery .row .img { + margin: 0px; + background-size: cover; + background-position: center; + display: table; + text-align: center; } + .marginless-gallery .row .img > div { + display: table-cell; + vertical-align: middle; } + +/*# sourceMappingURL=website_snippet_marginless_gallery.css.map */ diff --git a/website_snippet_marginless_gallery/static/src/css/website_snippet_marginless_gallery.css.map b/website_snippet_marginless_gallery/static/src/css/website_snippet_marginless_gallery.css.map new file mode 100644 index 0000000000..cc8339ad1a --- /dev/null +++ b/website_snippet_marginless_gallery/static/src/css/website_snippet_marginless_gallery.css.map @@ -0,0 +1,7 @@ +{ +"version": 3, +"mappings": ";;;AAMA,6BAA6B;EAEzB,MAAM,EAAE,GAAG;EAGX,eAAe,EAAE,KAAK;EACtB,mBAAmB,EAAE,MAAM;EAG3B,OAAO,EAAE,KAAK;EACd,UAAU,EAAE,MAAM;EAClB,mCAAK;IACD,OAAO,EAAE,UAAU;IACnB,cAAc,EAAE,MAAM", +"sources": ["website_snippet_marginless_gallery.sass"], +"names": [], +"file": "website_snippet_marginless_gallery.css" +} \ No newline at end of file diff --git a/website_snippet_marginless_gallery/static/src/css/website_snippet_marginless_gallery.sass b/website_snippet_marginless_gallery/static/src/css/website_snippet_marginless_gallery.sass new file mode 100644 index 0000000000..dafe77e411 --- /dev/null +++ b/website_snippet_marginless_gallery/static/src/css/website_snippet_marginless_gallery.sass @@ -0,0 +1,20 @@ +@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). + +@import "compass/css3/flexbox" + +.marginless-gallery .row .img + // As the name of the module says... + margin: 0px + + // Background changes depending on div and layout size + background-size: cover + background-position: center + + // Center inner text + display: table + text-align: center + > div + display: table-cell + vertical-align: middle diff --git a/website_snippet_marginless_gallery/static/src/js/website_snippet_marginless_gallery.editor.js b/website_snippet_marginless_gallery/static/src/js/website_snippet_marginless_gallery.editor.js new file mode 100644 index 0000000000..2eee554821 --- /dev/null +++ b/website_snippet_marginless_gallery/static/src/js/website_snippet_marginless_gallery.editor.js @@ -0,0 +1,48 @@ +/* © 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). + */ + +"use strict"; +(function ($) { + var prompt = openerp.website.prompt, + snippet = openerp.website.snippet, + _t = openerp._t; + + snippet.options.marginless_gallery = snippet.Option.extend({ + start: function () { + var self = this; + self._super(); + self.$el.find(".js_change_height").click(function () { + return self.change_images_height(); + }); + }, + + drop_and_build_snippet: function () { + var self = this; + self._super(); + self.change_images_height().fail(function () { + self.$target.data("overlay") + .find(".oe_snippet_remove").click() + }); + }, + + change_images_height: function () { + var self = this; + return prompt({ + window_title: _t("Height for all images in gallery"), + input: _t("Image height in pixels"), + + }).then(function (answer) { + // Must be a number + answer = Number(answer); + if (isNaN(answer)) { + return failure(); + } + + self.$target + .find(".row > .img") + .css("height", answer ? answer + "px" : ""); + }); + }, + }); +})(jQuery); diff --git a/website_snippet_marginless_gallery/static/src/js/website_snippet_marginless_gallery.tour.js b/website_snippet_marginless_gallery/static/src/js/website_snippet_marginless_gallery.tour.js new file mode 100644 index 0000000000..19778e9182 --- /dev/null +++ b/website_snippet_marginless_gallery/static/src/js/website_snippet_marginless_gallery.tour.js @@ -0,0 +1,91 @@ +/* © 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). + */ + +"use strict"; +(function ($) { + openerp.Tour.register({ + id: "marginless_gallery", + name: "Insert a marginless gallery snippet", + path: "/page/homepage", + mode: "test", + steps: [ + { + title: "Edit the homepage (1)", + waitFor: "button[data-action=edit]", + element: "button[data-action=edit]", + }, + { + title: "Click on Insert Blocks (1)", + waitFor: "button[data-action=snippet]", + element: "button[data-action=snippet]", + }, + { + title: "Click on Features (1)", + waitFor: "a[href='#snippet_feature']", + element: "a[href='#snippet_feature']", + }, + { + title: "Drag and drop a marginless gallery snippet (1)", + waitFor: ".oe_snippet:contains('Marginless Gallery'):visible", + snippet: ".oe_snippet:contains('Marginless Gallery')", + }, + { + title: "Cancel modal dialog", + waitFor: ".modal button:contains('Cancel'):visible", + element: ".modal button:contains('Cancel'):visible", + }, + { + title: "Click on Insert Blocks (2)", + waitNot: ".modal:visible, \ + #oe_manipulators .btn:visible, \ + #wrap .marginless-gallery:visible", + waitFor: "button[data-action=snippet]", + element: "button[data-action=snippet]", + }, + { + title: "Click on Features (2)", + waitFor: "a[href='#snippet_feature']", + element: "a[href='#snippet_feature']", + }, + { + title: "Drag and drop a marginless gallery snippet (2)", + waitFor: ".oe_snippet:contains('Marginless Gallery'):visible", + snippet: ".oe_snippet:contains('Marginless Gallery')", + }, + { + title: "Set no fixed height", + waitFor: ".modal .btn-primary:visible", + element: ".modal .btn-primary:visible", + }, + { + title: "Click on Customize", + waitFor: "#wrap .marginless-gallery, \ + .btn-primary:contains('Customize'):visible", + element: ".btn-primary:contains('Customize'):visible", + }, + { + title: "Click on Change Images Height", + waitFor: ".js_change_height:visible", + element: ".js_change_height:visible", + }, + { + title: "Set image height of 200px", + waitFor: ".modal input:visible", + element: ".modal input:visible", + sampleText: "200", + }, + { + title: "Accept modal dialog", + waitFor: ".modal input:contains('200'):visible", + element: ".modal .btn-primary:visible", + }, + { + title: "Check that the right height has been saved", + waitNot: ".modal:visible", + waitFor: "#wrap .marginless-gallery \ + .col-md-3[style*='height: 200px']", + }, + ], + }); +})(jQuery); diff --git a/website_snippet_marginless_gallery/tests/__init__.py b/website_snippet_marginless_gallery/tests/__init__.py new file mode 100644 index 0000000000..2225ff8c64 --- /dev/null +++ b/website_snippet_marginless_gallery/tests/__init__.py @@ -0,0 +1,5 @@ +# -*- 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). + +from . import test_ui diff --git a/website_snippet_marginless_gallery/tests/test_ui.py b/website_snippet_marginless_gallery/tests/test_ui.py new file mode 100644 index 0000000000..a2c010ac77 --- /dev/null +++ b/website_snippet_marginless_gallery/tests/test_ui.py @@ -0,0 +1,14 @@ +# -*- 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). + +from openerp.tests.common import HttpCase + + +class UICase(HttpCase): + def test_admin_tour_marginless_gallery(self): + self.phantom_js( + "/", + "openerp.Tour.run('marginless_gallery')", + "openerp.Tour.tours.marginless_gallery", + "admin") diff --git a/website_snippet_marginless_gallery/views/assets.xml b/website_snippet_marginless_gallery/views/assets.xml new file mode 100644 index 0000000000..89528354e6 --- /dev/null +++ b/website_snippet_marginless_gallery/views/assets.xml @@ -0,0 +1,24 @@ + + + + + + +