From fc43a5307990c0e2b18ac0c6cc89b64815f96d87 Mon Sep 17 00:00:00 2001
From: Christophe Matthieu
Date: Thu, 17 Oct 2013 15:16:04 +0200
Subject: [PATCH 01/17] [FIX] product.attribute: store min and max
bzr revid: chm@openerp.com-20131017131604-x2xo963p9pq81hvf
---
addons/website_sale/models/product_attributes.py | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/addons/website_sale/models/product_attributes.py b/addons/website_sale/models/product_attributes.py
index e89763946f8..ddc5467a19d 100644
--- a/addons/website_sale/models/product_attributes.py
+++ b/addons/website_sale/models/product_attributes.py
@@ -29,14 +29,25 @@ class attributes(osv.Model):
result.update(dict(cr.fetchall()))
return result
+ def _get_min_max(self, cr, uid, ids, context=None):
+ result = {}
+ for value in self.pool.get('product.attribute.product').browse(cr, uid, ids, context=context):
+ if value.type == 'float':
+ result[value.attribute_id.id] = True
+ return result.keys()
+
_columns = {
'name': fields.char('Name', size=64, translate=True, required=True),
'type': fields.selection([('distinct', 'Distinct'), ('float', 'Float')], "Type", required=True),
'value_ids': fields.one2many('product.attribute.value', 'attribute_id', 'Values'),
'product_ids': fields.one2many('product.attribute.product', 'attribute_id', 'Products'),
- 'float_max': fields.function(_get_float_max, type='float', string="Max", relation='product.attribute.product',store=True),
- 'float_min': fields.function(_get_float_min, type='float', string="Min", relation='product.attribute.product',store=True),
+ 'float_max': fields.function(_get_float_max, type='float', string="Max", store={
+ 'product.attribute.product': (_get_min_max, ['value','attribute_id'], 20),
+ }),
+ 'float_min': fields.function(_get_float_min, type='float', string="Min", store={
+ 'product.attribute.product': (_get_min_max, ['value','attribute_id'], 20),
+ }),
}
_defaults = {
'type': 'distinct'
From 41c49645e2748f26038a07b1d2475fba1a9bd91a Mon Sep 17 00:00:00 2001
From: ddm
Date: Fri, 18 Oct 2013 11:28:20 +0200
Subject: [PATCH 02/17] [FIX] Refactor SEO models
bzr revid: ddm@openerp.com-20131018092820-lqj9yz518262nknr
---
addons/website/models/website.py | 10 ++++++++++
addons/website_blog/models/website_blog.py | 14 +++-----------
2 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/addons/website/models/website.py b/addons/website/models/website.py
index b3aaf611ddc..56cbfbd458e 100644
--- a/addons/website/models/website.py
+++ b/addons/website/models/website.py
@@ -393,3 +393,13 @@ class base_language_install(osv.osv):
'target': 'self'
}
return action
+
+class SeoMetadata(osv.Model):
+ _name = 'website.seo.metadata'
+ _description = 'SEO metadata'
+
+ _columns = {
+ 'website_meta_title': fields.char("Website meta title", size=70, translate=True),
+ 'website_meta_description': fields.text("Website meta description", size=160, translate=True),
+ 'website_meta_keywords': fields.char("Website meta keywords", translate=True),
+ }
diff --git a/addons/website_blog/models/website_blog.py b/addons/website_blog/models/website_blog.py
index 9f4a214a8b9..9ecfe6cafee 100644
--- a/addons/website_blog/models/website_blog.py
+++ b/addons/website_blog/models/website_blog.py
@@ -31,7 +31,7 @@ import difflib
class BlogCategory(osv.Model):
_name = 'blog.category'
_description = 'Blog Category'
- _inherit = ['mail.thread']
+ _inherit = ['mail.thread', 'website.seo.metadata']
_order = 'name'
_columns = {
@@ -41,15 +41,13 @@ class BlogCategory(osv.Model):
'blog.post', 'category_id',
'Blogs',
),
- 'website_meta_title': fields.char("Website meta title", size=70, translate=True),
- 'website_meta_description': fields.text("Website meta description", size=160, translate=True),
- 'website_meta_keywords': fields.char("Website meta keywords", translate=True),
}
class BlogTag(osv.Model):
_name = 'blog.tag'
_description = 'Blog Tag'
+ _inherit = ['website.seo.metadata']
_order = 'name'
_columns = {
@@ -57,16 +55,13 @@ class BlogTag(osv.Model):
'blog_post_ids': fields.many2many(
'blog.post', string='Posts',
),
- 'website_meta_title': fields.char("Website meta title", size=70, translate=True),
- 'website_meta_description': fields.text("Website meta description", size=160, translate=True),
- 'website_meta_keywords': fields.char("Website meta keywords", translate=True),
}
class BlogPost(osv.Model):
_name = "blog.post"
_description = "Blog Post"
- _inherit = ['mail.thread']
+ _inherit = ['mail.thread', 'website.seo.metadata']
_order = 'write_date DESC'
# maximum number of characters to display in summary
_shorten_max_char = 250
@@ -150,9 +145,6 @@ class BlogPost(osv.Model):
'res.users', 'Last Contributor',
select=True, readonly=True,
),
- 'website_meta_title': fields.char("Website meta title", size=70, translate=True),
- 'website_meta_description': fields.text("Website meta description", size=160, translate=True),
- 'website_meta_keywords': fields.char("Website meta keywords", translate=True),
}
def create_history(self, cr, uid, ids, vals, context=None):
From 3b578cd3731edded4387ff141c655db8a5f3d25f Mon Sep 17 00:00:00 2001
From: Xavier Morel
Date: Thu, 17 Oct 2013 15:31:33 +0200
Subject: [PATCH 03/17] [IMP] take over triple-click behavior in webkit to
avoid breaking snippets and the like
bzr revid: xmo@openerp.com-20131017133133-uebgw7m3fo9as38s
---
.../website/static/src/js/website.editor.js | 38 +++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/addons/website/static/src/js/website.editor.js b/addons/website/static/src/js/website.editor.js
index 485ba48e35b..ff9f82b0f8e 100644
--- a/addons/website/static/src/js/website.editor.js
+++ b/addons/website/static/src/js/website.editor.js
@@ -311,6 +311,7 @@
},
});
+ var blocks_selector = _.keys(CKEDITOR.dtd.$block).join(',');
/* ----- RICH TEXT EDITOR ---- */
website.RTE = openerp.Widget.extend({
tagName: 'li',
@@ -324,6 +325,42 @@
this._super.apply(this, arguments);
},
+ /**
+ * In Webkit-based browsers, triple-click will select a paragraph up to
+ * the start of the next "paragraph" including any empty space
+ * inbetween. When said paragraph is removed or altered, it nukes
+ * the empty space and brings part of the content of the next
+ * "paragraph" (which may well be e.g. an image) into the current one,
+ * completely fucking up layouts and breaking snippets.
+ *
+ * Try to fuck around with selections on triple-click to attempt to
+ * fix this garbage behavior.
+ *
+ * Note: for consistent behavior we may actually want to take over
+ * triple-clicks, in all browsers in order to ensure consistent cross-
+ * platform behavior instead of being at the mercy of rendering engines
+ * & platform selection quirks?
+ */
+ webkitSelectionFixer: function (root) {
+ root.addEventListener('click', function (e) {
+ // only webkit seems to have a fucked up behavior, ignore others
+ // FIXME: $.browser goes away in jquery 1.9...
+ if (!$.browser.webkit) { return; }
+ // http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-eventgroupings-mouseevents
+ // The detail attribute indicates the number of times a mouse button has been pressed
+ // we just want the triple click
+ if (e.detail !== 3) { return; }
+
+ // Get closest block-level element to the triple-clicked
+ // element (using ckeditor's block list because why not)
+ var $closest_block = $(e.target).closest(blocks_selector);
+
+ // manually set selection range to the content of the
+ // triple-clicked block-level element, to avoid crossing over
+ // between block-level elements
+ document.getSelection().selectAllChildren($closest_block[0]);
+ });
+ },
start_edition: function ($elements) {
var self = this;
// create a single editor for the whole page
@@ -331,6 +368,7 @@
$(root).on('dragstart', 'img', function (e) {
e.preventDefault();
});
+ this.webkitSelectionFixer(root);
var editor = this.editor = CKEDITOR.inline(root, self._config());
editor.on('instanceReady', function () {
editor.setReadOnly(false);
From 99723a8a9ffa70f8e41806e92de32c52583fc2ad Mon Sep 17 00:00:00 2001
From: Fabien Pinckaers
Date: Thu, 17 Oct 2013 16:19:59 +0200
Subject: [PATCH 04/17] [REVERT] snippets drop zone too complex
bzr revid: fp@tinyerp.com-20131017141959-fpkds0a7e1m1sfrw
---
addons/website/static/src/css/editor.css | 82 ++++----------
addons/website/static/src/css/editor.sass | 58 +++-------
addons/website/static/src/css/snippets.css | 3 +-
addons/website/static/src/css/website.css | 5 +-
addons/website/static/src/css/website.sass | 4 +-
.../website/static/src/js/website.snippets.js | 104 ++++++++----------
.../static/src/xml/website.snippets.xml | 23 +---
7 files changed, 90 insertions(+), 189 deletions(-)
diff --git a/addons/website/static/src/css/editor.css b/addons/website/static/src/css/editor.css
index dc9bb076e59..a009bf61f23 100644
--- a/addons/website/static/src/css/editor.css
+++ b/addons/website/static/src/css/editor.css
@@ -305,87 +305,53 @@ table.editorbar-panel td.selected {
}
/* ---- SNIPPETS DROP ZONES ---- */
-#dark_for_dropzone {
- width: 100%;
- position: absolute;
- top: 0;
- left: 0;
- opacity: 0.4;
- z-index: 1000;
- pointer-events: none;
-}
-#dark_for_dropzone td {
- background: black;
-}
-#dark_for_dropzone td.center.active {
- background: transparent;
-}
-
-.oe_drop_zone, .oe_drop_zone_style {
- border: none;
- background: rgba(100, 255, 255, 0.9);
- -webkit-border-radius: 4px;
- -moz-border-radius: 4px;
- -ms-border-radius: 4px;
- -o-border-radius: 4px;
- border-radius: 4px;
-}
-.oe_drop_zone div, .oe_drop_zone_style div {
- margin: 0;
- line-height: 48px;
- text-align: center;
- color: magenta;
- font-weight: bold;
- font-size: 24px;
-}
-.oe_drop_zone .oe_active, .oe_drop_zone_style .oe_active {
- display: none;
-}
-
-.oe_drop_zone_style div {
- line-height: 24px;
-}
-
-.oe_drop_zone {
+.oe_drop_zone.oe_insert {
display: block;
height: 48px;
margin: 0px;
margin-top: -4px;
margin-bottom: -44px;
- z-index: 1002;
+ -webkit-transition: margin 250ms linear;
+ -moz-transition: margin 250ms linear;
+ -o-transition: margin 250ms linear;
+ transition: margin 250ms linear;
width: 100%;
position: absolute;
+ z-index: 1000;
}
-.oe_drop_zone:not(.oe_vertical):before {
+.oe_drop_zone.oe_insert:not(.oe_vertical):before {
content: "";
display: block;
border-top: dashed 2px rgba(209, 178, 255, 0.72);
position: relative;
top: 0px;
}
-.oe_drop_zone.oe_hover:before {
+.oe_drop_zone.oe_insert.oe_hover:before {
border-top: dashed 2px rgba(116, 255, 161, 0.72);
}
-.oe_drop_zone.oe_vertical {
+.oe_drop_zone.oe_insert.oe_vertical {
width: 48px;
float: left;
position: relative;
- margin: 4px -24px !important;
+ margin: 0px -24px !important;
}
-.oe_drop_zone.oe_vertical div {
- display: none;
-}
-.oe_drop_zone.oe_overlay {
+.oe_drop_zone.oe_insert.oe_overlay {
border-radius: 3px;
+ background: rgba(153, 0, 255, 0.5);
}
-.oe_drop_zone.oe_drop_active {
- background: rgba(100, 255, 255, 0.3);
+
+.oe_drop_zone, .oe_drop_zone_style {
+ border: none;
+ background: rgba(153, 0, 255, 0.3);
+ -webkit-border-radius: 4px;
+ -moz-border-radius: 4px;
+ -ms-border-radius: 4px;
+ -o-border-radius: 4px;
+ border-radius: 4px;
}
-.oe_drop_zone.oe_drop_active div {
- display: none;
-}
-.oe_drop_zone.oe_drop_active .oe_active {
- display: block;
+.oe_drop_zone.oe_hover, .oe_drop_zone_style.oe_hover {
+ background: rgba(0, 255, 133, 0.3);
+ z-index: 1001;
}
.oe_drop_zone_style {
diff --git a/addons/website/static/src/css/editor.sass b/addons/website/static/src/css/editor.sass
index bc8b238736e..461667d8e54 100644
--- a/addons/website/static/src/css/editor.sass
+++ b/addons/website/static/src/css/editor.sass
@@ -242,45 +242,16 @@ table.editorbar-panel
/* ---- SNIPPETS DROP ZONES ---- */
-#dark_for_dropzone
- width: 100%
- position: absolute
- top: 0
- left: 0
- opacity: 0.4
- z-index: 1000
- pointer-events: none
- td
- background: #000
- &.center.active
- background: transparent
-
-.oe_drop_zone, .oe_drop_zone_style
- border: none
- background: rgba(100, 255, 255, .9)
- +border-radius(4px)
- div
- margin: 0
- line-height: 48px
- text-align: center
- color: #FF00FF
- font-weight: bold
- font-size: 24px
- .oe_active
- display: none
-
-.oe_drop_zone_style div
- line-height: 24px
-
-.oe_drop_zone
+.oe_drop_zone.oe_insert
display: block
height: 48px
margin: 0px
margin-top: -4px
margin-bottom: -44px
- z-index: 1002
+ @include transition(margin 250ms linear)
width: 100%
position: absolute
+ z-index: 1000
&:not(.oe_vertical):before
content: ""
display: block
@@ -293,17 +264,22 @@ table.editorbar-panel
width: 48px
float: left
position: relative
- margin: 4px -24px !important
- div
- display: none
+ margin: 0px -24px !important
&.oe_overlay
border-radius: 3px
- &.oe_drop_active
- background: rgba(100, 255, 255, .3)
- div
- display: none
- .oe_active
- display: block
+ //@include background-image( repeating-linear-gradient(45deg, rgba(255,255,255,.1) ,rgba(255,255,255,.1) 35px, rgba(0,0,0,.1) 35px, rgba(0,0,0,.1) 75px))
+ //background-size: 100px 100px
+ background: rgba(153, 0, 255,.5)
+
+.oe_drop_zone, .oe_drop_zone_style
+ border: none
+ //@include background-image( repeating-linear-gradient(45deg, rgba(255,255,255,.1) ,rgba(255,255,255,.1) 35px, rgba(0,0,0,.1) 35px, rgba(0,0,0,.1) 75px))
+ //background-size: 100px 100px
+ background: rgba(153, 0, 255, .3)
+ +border-radius(4px)
+ &.oe_hover
+ background: rgba(0, 255, 133, .3)
+ z-index: 1001
.oe_drop_zone_style
color: white
diff --git a/addons/website/static/src/css/snippets.css b/addons/website/static/src/css/snippets.css
index c6bb24d04f0..63e8fbefa76 100644
--- a/addons/website/static/src/css/snippets.css
+++ b/addons/website/static/src/css/snippets.css
@@ -216,4 +216,5 @@
[data-snippet-id] {
min-height: 10px;
min-width: 10px;
-}
\ No newline at end of file
+}
+
diff --git a/addons/website/static/src/css/website.css b/addons/website/static/src/css/website.css
index c5b58815c67..ce87e592136 100644
--- a/addons/website/static/src/css/website.css
+++ b/addons/website/static/src/css/website.css
@@ -235,10 +235,7 @@ footer {
}
.oe_structure.oe_empty > .oe_drop_zone.oe_insert:only-child, [data-oe-type=html] > .oe_drop_zone.oe_insert:only-child {
- position: relative;
-}
-.oe_structure.oe_empty > .oe_drop_zone.oe_insert:only-child div, [data-oe-type=html] > .oe_drop_zone.oe_insert:only-child div {
- display: none;
+ position: static;
}
.oe_structure.oe_empty:empty:before, [data-oe-type=html]:empty:before, .oe_structure.oe_empty > .oe_drop_zone.oe_insert:only-child:before, [data-oe-type=html] > .oe_drop_zone.oe_insert:only-child:before {
diff --git a/addons/website/static/src/css/website.sass b/addons/website/static/src/css/website.sass
index 2735dfe9fc8..5197653429c 100644
--- a/addons/website/static/src/css/website.sass
+++ b/addons/website/static/src/css/website.sass
@@ -161,9 +161,7 @@ footer
height: 220px !important
.oe_structure.oe_empty > .oe_drop_zone.oe_insert:only-child, [data-oe-type=html] > .oe_drop_zone.oe_insert:only-child
- position: relative
- div
- display: none
+ position: static
.oe_structure.oe_empty:empty:before, [data-oe-type=html]:empty:before, .oe_structure.oe_empty > .oe_drop_zone.oe_insert:only-child:before, [data-oe-type=html] > .oe_drop_zone.oe_insert:only-child:before
content: 'Click Edit To Create Content'
diff --git a/addons/website/static/src/js/website.snippets.js b/addons/website/static/src/js/website.snippets.js
index 17dd829708f..35568e8336e 100644
--- a/addons/website/static/src/js/website.snippets.js
+++ b/addons/website/static/src/js/website.snippets.js
@@ -319,32 +319,17 @@
}
- var $dark = $(openerp.qweb.render('website.snippet_dark_for_dropzone'))
- .css('height', $("body")[0].scrollHeight + 'px');
- $("body").append($dark);
-
$('.oe_drop_zone').droppable({
over: function(){
if( action === 'insert'){
dropped = true;
- $(this).first().addClass("oe_drop_active").after($toInsert);
- $dark.find("td:first")
- .css('height', $toInsert.offset().top+'px');
- $dark.find("tr:eq(1) td:first")
- .css('width', $toInsert.offset().left+'px');
- $dark.find("td.center")
- .addClass("active")
- .css('height', $toInsert.outerHeight()+'px')
- .css('width', $toInsert.outerWidth()+'px');
+ $(this).first().after($toInsert);
}
},
out: function(){
if( action === 'insert'){
- $(this).removeClass("oe_drop_active");
dropped = false;
$toInsert.detach();
- $dark.find("td.center").removeClass("active");
- $("body").scroll(); // trigger a scroll to reset position for jquery api
}
},
drop: function(){
@@ -353,8 +338,15 @@
});
},
stop: function(ev, ui){
+ if (action === 'insert' && ! dropped) {
+ var el = $('.oe_drop_zone').nearest({x: ui.position.left, y: ui.position.top}).first()
+ if (el) {
+ el.after($toInsert)
+ dropped = true;
+ }
+ }
+
$('.oe_drop_zone').droppable('destroy').remove();
- $("#dark_for_dropzone").remove();
if (dropped) {
var $target = false;
if(action === 'insert'){
@@ -405,7 +397,7 @@
var sibling_selector = selector.siblings;
var vertical_child_selector = selector.vertical_children;
- var zone_template = openerp.qweb.render('website.snippet_drop_zone');
+ var zone_template = "";
if(child_selector){
self.dom_filter(child_selector).each(function (){
@@ -425,7 +417,7 @@
var temp_left = 0;
$zone.find('> *:not(.oe_drop_zone):visible').each(function () {
var $col = $(this);
- $template.css('height', ($col.outerHeight() + parseInt($col.css("margin-top")) + parseInt($col.css("margin-bottom")) - 8)+'px');
+ $template.css('height', ($col.outerHeight() + parseInt($col.css("margin-top")) + parseInt($col.css("margin-bottom")))+'px');
$lastinsert = $template.clone();
$(this).after($lastinsert);
@@ -594,8 +586,7 @@
* Displayed into the overlay options on focus
*/
_readXMLData: function() {
- var self = this;
- this.$el = this.parent.$snippets.filter(function () { return $(this).data("snippet-id") == self.snippet_id; }).clone();
+ this.$el = this.parent.$snippets.siblings("[data-snippet-id='"+this.snippet_id+"']").clone();
this.$editor = this.$el.find(".oe_snippet_options");
var $options = this.$overlay.find(".oe_overlay_options");
this.$editor.prependTo($options.find(".oe_options ul"));
@@ -630,28 +621,18 @@
});
},
_drag_and_drop_after_insert_dropzone: function (){},
- _drag_and_drop_active_drop_zone: function (){
+ _drag_and_drop_active_drop_zone: function ($zones){
var self = this;
- var $dark = $("#dark_for_dropzone");
- $('.oe_drop_zone').droppable({
+ $zones.droppable({
over: function(){
- $(this).first().addClass("oe_drop_active").after(self.$target);
- $dark.find("td:first")
- .css('height', self.$target.offset().top+'px');
- $dark.find("tr:eq(1) td:first")
- .css('width', self.$target.offset().left+'px');
- $dark.find("td.center")
- .addClass("active")
- .css('height', self.$target.outerHeight()+'px')
- .css('width', self.$target.outerWidth()+'px');
+ $(".oe_drop_zone.hide").removeClass("hide");
+ $(this).addClass("hide").first().after(self.$target);
self.dropped = true;
},
out: function(){
- $(this).removeClass("oe_drop_active");
- $dark.find("td.center").removeClass("active");
+ $(this).removeClass("hide");
self.$target.detach();
self.dropped = false;
- $("body").scroll(); // trigger a scroll to reset position for jquery api
},
});
},
@@ -675,12 +656,8 @@
$("body").addClass('move-important');
- var $dark = $(openerp.qweb.render('website.snippet_dark_for_dropzone'))
- .css('height', $("body")[0].scrollHeight + 'px');
- $("body").append($dark);
-
self._drag_and_drop_after_insert_dropzone();
- self._drag_and_drop_active_drop_zone();
+ self._drag_and_drop_active_drop_zone($('.oe_drop_zone'));
},
_drag_and_drop_stop: function (){
var self = this;
@@ -690,7 +667,6 @@
self.$overlay.removeClass("hidden");
$("body").removeClass('move-important');
$('.oe_drop_zone').droppable('destroy').remove();
- $('#dark_for_dropzone').remove();
$(".oe_drop_clone, .oe_drop_to_remove").remove();
self.parent.editor_busy = false;
self.get_parent_block();
@@ -988,25 +964,23 @@
_drag_and_drop_after_insert_dropzone: function(){
var self = this;
- // commented for perf
-
- // var $zones = $(".row:has(> .oe_drop_zone)").each(function () {
- // var $row = $(this);
- // var width = $row.innerWidth();
- // var pos = 0;
- // while (width > pos + self.size.width) {
- // var $last = $row.find("> .oe_drop_zone:last");
- // $last.each(function () {
- // pos = $(this).position().left;
- // });
- // if (width > pos + self.size.width) {
- // $row.append("");
- // var $add_drop = $last.clone();
- // $row.append($add_drop);
- // self._drag_and_drop_active_drop_zone($add_drop);
- // }
- // }
- // });
+ var $zones = $(".row:has(> .oe_drop_zone)").each(function () {
+ var $row = $(this);
+ var width = $row.innerWidth();
+ var pos = 0;
+ while (width > pos + self.size.width) {
+ var $last = $row.find("> .oe_drop_zone:last");
+ $last.each(function () {
+ pos = $(this).position().left;
+ });
+ if (width > pos + self.size.width) {
+ $row.append("");
+ var $add_drop = $last.clone();
+ $row.append($add_drop);
+ self._drag_and_drop_active_drop_zone($add_drop);
+ }
+ }
+ });
},
_drag_and_drop_start: function () {
this._super();
@@ -1100,6 +1074,14 @@
self.$target.carousel();
});
+ this.$target.on('dblclick', '.item.active .carousel-image img', function (event) {
+ var $img = $(event.currentTarget);
+ var editor = new website.editor.ImageDialog();
+ editor.on('start', self, function (o) {o.url = $img.attr("src");});
+ editor.on('save', self, function (o) {$img.attr("src", o.url);});
+ editor.appendTo($('body'));
+ });
+
this.rebind_event();
},
// rebind event to active carousel on edit mode
diff --git a/addons/website/static/src/xml/website.snippets.xml b/addons/website/static/src/xml/website.snippets.xml
index 6aaf256b523..e5dde368154 100644
--- a/addons/website/static/src/xml/website.snippets.xml
+++ b/addons/website/static/src/xml/website.snippets.xml
@@ -31,8 +31,8 @@
this one:
-
-
drop in this zone
+
+ drop in this zone
@@ -57,25 +57,6 @@
-
-
-
Drag your block here (move your mouse in this zone)
-
Drop your block
-
-
-
-
-
-
-
From ba0778922cf141336c456e3d00e6a0f9de3a41a4 Mon Sep 17 00:00:00 2001
From: "RGA(OpenERP)" <>
Date: Fri, 18 Oct 2013 15:01:35 +0530
Subject: [PATCH 05/17] [IMP] parallax snippet add size option like banner has
bzr revid: rgaopenerp-20131018093135-4ux25wdnd73wlah2
---
addons/website/static/src/css/website.css | 13 +++++++--
addons/website/static/src/css/website.sass | 9 ++++--
.../website/static/src/js/website.snippets.js | 29 +++++++++++++++++++
addons/website/views/snippets.xml | 18 +++++++++++-
4 files changed, 63 insertions(+), 6 deletions(-)
diff --git a/addons/website/static/src/css/website.css b/addons/website/static/src/css/website.css
index ce87e592136..b17249dce64 100644
--- a/addons/website/static/src/css/website.css
+++ b/addons/website/static/src/css/website.css
@@ -1,4 +1,3 @@
-@charset "utf-8";
/* THIS CSS FILE IS FOR WEBSITE THEMING CUSTOMIZATION ONLY
*
* css for editor buttons, openerp widget included in the website and other
@@ -361,11 +360,19 @@ footer {
}
.parallax_full {
- background: #eeeeee bottom center repeat fixed;
- min-height: 650px;
+ background: #eeeeee no-repeat top center;
width: 100%;
background-size: 100%;
}
+.parallax_full.oe_small .container {
+ height: 200px;
+}
+.parallax_full.oe_medium .container {
+ height: 300px;
+}
+.parallax_full.oe_big .container {
+ height: 450px;
+}
/* -- Hack for removing double scrollbar from mobile preview -- */
div#mobile-preview.modal {
diff --git a/addons/website/static/src/css/website.sass b/addons/website/static/src/css/website.sass
index 5197653429c..136e039bc1c 100644
--- a/addons/website/static/src/css/website.sass
+++ b/addons/website/static/src/css/website.sass
@@ -276,10 +276,15 @@ footer
background-color: grey
.parallax_full
- background: #eee bottom center repeat fixed
- min-height: 650px
+ background: #eee no-repeat top center
width: 100%
background-size: 100%
+ &.oe_small .container
+ height: 200px
+ &.oe_medium .container
+ height: 300px
+ &.oe_big .container
+ height: 450px
/* -- Hack for removing double scrollbar from mobile preview -- */
div#mobile-preview.modal
diff --git a/addons/website/static/src/js/website.snippets.js b/addons/website/static/src/js/website.snippets.js
index 35568e8336e..2732c397619 100644
--- a/addons/website/static/src/js/website.snippets.js
+++ b/addons/website/static/src/js/website.snippets.js
@@ -1198,7 +1198,36 @@
start : function () {
this._super();
this.change_background(this.$target, 'ul[name="parallax-background"]');
+ this.change_size();
},
+ change_size: function () {
+ var self = this;
+ var $el = this.$target;
+
+ var size = 'oe_big';
+ if (this.$target.hasClass('oe_small'))
+ size = 'oe_small';
+ else if (this.$target.hasClass('oe_medium'))
+ size = 'oe_medium';
+
+ var $ul = this.$editor.find('ul[name="parallax-size"]');
+ var $li = $ul.find("li");
+
+ $ul.find('[data-value="' + size + '"]').addClass('active');
+
+ $li.on('click', function (event) {
+ $li.removeClass("active");
+ $(this).addClass("active");
+ })
+ .on('mouseover', function (event) {
+ $el.removeClass('oe_big oe_small oe_medium');
+ $el.addClass($(event.currentTarget).data("value"));
+ })
+ .on('mouseout', function (event) {
+ $el.removeClass('oe_big oe_small oe_medium');
+ $el.addClass($ul.find('li.active').data("value"));
+ });
+ }
});
/*
diff --git a/addons/website/views/snippets.xml b/addons/website/views/snippets.xml
index a351e07d4fd..6651e899762 100644
--- a/addons/website/views/snippets.xml
+++ b/addons/website/views/snippets.xml
@@ -677,6 +677,22 @@
Parallax
+
+