summaryrefslogtreecommitdiff
path: root/addons/website/static/src/js/website.snippets.editor.js
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2015-08-14 18:35:33 +0200
committerChristophe Simonis <chs@odoo.com>2015-08-15 16:57:35 +0200
commit73e652818b812670b7d6ce3da727de1809da531c (patch)
treefcc9f2ae92e5d1318dbddf423d330114cff68896 /addons/website/static/src/js/website.snippets.editor.js
parent9979939cd160a234270426f644c3bb2fdda8b543 (diff)
parent8d95f6dcdf6e451f32c247bcabd5ce024a158ebe (diff)
[MERGE] forward port of branch saas-6 up to 8d95f6d
Diffstat (limited to 'addons/website/static/src/js/website.snippets.editor.js')
-rw-r--r--addons/website/static/src/js/website.snippets.editor.js29
1 files changed, 18 insertions, 11 deletions
diff --git a/addons/website/static/src/js/website.snippets.editor.js b/addons/website/static/src/js/website.snippets.editor.js
index 86d0717d979..9cc40247b89 100644
--- a/addons/website/static/src/js/website.snippets.editor.js
+++ b/addons/website/static/src/js/website.snippets.editor.js
@@ -81,17 +81,24 @@ options.registry.slider = options.Class.extend({
this.$indicators.append('<li data-target="#' + this.id + '" data-slide-to="' + cycle + '"></li>');
// clone the best candidate from template to use new features
- var $snippets = this.buildingBlock.$snippets.find('.oe_snippet_body.carousel');
- var point = 0;
- var selection;
- var className = _.compact(this.$target.attr("class").split(" "));
- $snippets.each(function () {
- var len = _.intersection(_.compact(this.className.split(" ")), className).length;
- if (len > point) {
- point = len;
- selection = this;
- }
- });
+ var $snippets = this.BuildingBlock.$snippets;
+ //since saas-6, all snippets must start by s_
+ var selection = this.$target.closest('[class*="s_"');
+ if (_.isUndefined(selection)) {
+ var point = 0;
+ var className = _.compact(this.$target.attr("class").split(" "));
+ $snippets.find('.oe_snippet_body').each(function () {
+ var len = _.intersection(_.compact(this.className.split(" ")), className).length;
+ if (len > point) {
+ point = len;
+ selection = this;
+ }
+ });
+ }
+ else {
+ var s_class = selection.attr('class').split(' ').filter(function(o) { return _.str.startsWith(o, "s_") })[0]
+ selection = $snippets.find("." + s_class);
+ }
var $clone = $(selection).find('.item:first').clone();
// insert