diff options
| author | Dharmraj Jhala <dja@openerp.com> | 2017-02-10 19:07:07 +0530 |
|---|---|---|
| committer | qsm-odoo <qsm@odoo.com> | 2017-06-01 17:28:26 +0200 |
| commit | 0485af3786a2f187b7da3ed332e073314cb09295 (patch) | |
| tree | 6c1e28c2c481f251b60c104924a1a8fced103501 /addons/website/static/src | |
| parent | 5d15bd76c67e72a0eb6fd5e1b99037a3ffa7c5c4 (diff) | |
[IMP] website: properly preserve "style" when changing gallery snippet "mode"
Diffstat (limited to 'addons/website/static/src')
| -rw-r--r-- | addons/website/static/src/js/website.snippets.gallery.js | 24 | ||||
| -rw-r--r-- | addons/website/static/src/xml/website.gallery.xml | 2 |
2 files changed, 5 insertions, 21 deletions
diff --git a/addons/website/static/src/js/website.snippets.gallery.js b/addons/website/static/src/js/website.snippets.gallery.js index 8cb8bf0ceaa..265424f4d51 100644 --- a/addons/website/static/src/js/website.snippets.gallery.js +++ b/addons/website/static/src/js/website.snippets.gallery.js @@ -76,7 +76,7 @@ options.registry.gallery = options.Class.extend({ }); }, get_imgs: function () { - var imgs = this.$target.find("img").addClass("img img-thumbnail img-responsive mb8 mt8").detach().get(); + var imgs = this.$target.find("img").addClass("img img-responsive mb8 mt8").detach().get(); imgs.sort(function (a,b) { return $(a).data('index')-$(b).data('index'); }); return imgs; }, @@ -174,7 +174,6 @@ options.registry.gallery = options.Class.extend({ $imgs.each(function (index) { // 0 based index $img = $(this); $col = $img.wrap('<div>').parent(); - self.img_preserve_styles($img); self.img_responsive($img); $col.addClass(colClass); $col.appendTo($row); @@ -186,6 +185,7 @@ options.registry.gallery = options.Class.extend({ this.$target.css("height", ""); }, slideshow :function (type) { + var imgStyle = this.$el.find('li.active[data-styling]').data('styling') || ''; if (type !== "reapply" && this.$target.hasClass('o_slideshow')) return; var self = this, @@ -196,7 +196,8 @@ options.registry.gallery = options.Class.extend({ index: 0, title: "", interval : this.$target.data("interval") || false, - id: "slideshow_" + new Date().getTime() + id: "slideshow_" + new Date().getTime(), + userStyle: imgStyle, }, $slideshow = $(qweb.render('website.gallery.slideshow', params)); this.replace($slideshow); @@ -251,23 +252,6 @@ options.registry.gallery = options.Class.extend({ /* * helpers */ - styles_to_preserve : function ($img) { - var styles = [ 'img-rounded', 'img-thumbnail', 'img-circle', 'shadow', 'fa-spin' ]; - var preserved = []; - - for (var style in styles) { - if ($img.hasClass(style)) { - preserved.push(style); - } - } - return preserved.join(' '); - }, - img_preserve_styles : function ($img) { - var classes = this.styles_to_preserve($img); - $img.removeAttr("class"); - $img.addClass(classes); - return $img; - }, img_responsive : function (img) { img.addClass("img img-responsive"); return img; diff --git a/addons/website/static/src/xml/website.gallery.xml b/addons/website/static/src/xml/website.gallery.xml index 2e879f0f7d5..8f2a387e78b 100644 --- a/addons/website/static/src/xml/website.gallery.xml +++ b/addons/website/static/src/xml/website.gallery.xml @@ -52,7 +52,7 @@ <div class="carousel-inner container" style="padding: 0;"> <t t-foreach="srcs" t-as="src"> <div t-attf-class="item #{src_index == index and 'active' or ''}"> - <img class="img" t-att-src="src"/> + <img t-attf-class="img #{userStyle}" t-att-src="src"/> </div> </t> </div> |
