summaryrefslogtreecommitdiff
path: root/addons/website/static/src
diff options
context:
space:
mode:
authorFrédéric van der Essen <fva@openerp.com>2013-07-31 17:12:30 +0200
committerFrédéric van der Essen <fva@openerp.com>2013-07-31 17:12:30 +0200
commit4f050353cf733eff2de09be31491e34e55ec1b95 (patch)
tree060775514ba127cf597fe3af9e5517936b104b53 /addons/website/static/src
parentb645f4830ae0660deb811221a570bd2729f28888 (diff)
parentbb6412a6f10d79e8915ab8e42e00477808ff18e1 (diff)
[MERGE] from upstream
bzr revid: fva@openerp.com-20130731151230-vyg6y8362khlu0ry
Diffstat (limited to 'addons/website/static/src')
-rw-r--r--addons/website/static/src/css/snippets.css9
-rw-r--r--addons/website/static/src/js/website.js86
-rw-r--r--addons/website/static/src/xml/website.xml14
3 files changed, 39 insertions, 70 deletions
diff --git a/addons/website/static/src/css/snippets.css b/addons/website/static/src/css/snippets.css
index e909c1ddb01..78e9162c332 100644
--- a/addons/website/static/src/css/snippets.css
+++ b/addons/website/static/src/css/snippets.css
@@ -177,5 +177,10 @@
}
*/
-
-
+.carousel > .css_carousel_options {
+ cursor: pointer;
+ position: absolute;
+ white-space: nowrap;
+ z-index: 1;
+ display: none;
+} \ No newline at end of file
diff --git a/addons/website/static/src/js/website.js b/addons/website/static/src/js/website.js
index 21d8b426ec9..98096df28cf 100644
--- a/addons/website/static/src/js/website.js
+++ b/addons/website/static/src/js/website.js
@@ -1,5 +1,6 @@
openerp.website = function(instance) {
var _lt = instance.web._lt;
+var QWeb = instance.web.qweb;
instance.website.EditorBar = instance.web.Widget.extend({
template: 'Website.EditorBar',
events: {
@@ -116,7 +117,7 @@ instance.website.EditorBar = instance.web.Widget.extend({
var self = this;
$('.oe_snippet_drop').remove();
var droppable = '<div class="oe_snippet_drop"></div>';
- var $zone = $('*:not(.oe_snippet) > .container');
+ var $zone = $(':not(.oe_snippet) > .container');
$zone.before(droppable).after(droppable);
$(".oe_snippet_drop").droppable({
@@ -338,11 +339,18 @@ instance.website.RTE = instance.web.Widget.extend({
this.toggle(!!CKEDITOR.currentInstance);
},
_config: function () {
+ var removed_plugins = [
+ // remove toolbar entirely
+ 'toolbar,elementspath,resize',
+ // remove custom context menu
+ 'contextmenu,tabletools,liststyle',
+ // magicline captures mousein/mouseout => draggable does not work
+ 'magicline'
+ ];
return {
// Don't load ckeditor's style rules
stylesSet: [],
- // Remove toolbar entirely, also custom context menu
- removePlugins: 'toolbar,elementspath,resize,contextmenu,tabletools,liststyle',
+ removePlugins: removed_plugins.join(','),
uiColor: '',
// Ensure no config file is loaded
customConfig: '',
@@ -356,60 +364,24 @@ instance.website.RTE = instance.web.Widget.extend({
// TODO clean
snippet_carousel: function () {
var self = this;
- $carousels = $("<div/>");
- $carousels.css({'position': 'absolute', 'top': 0, 'white-space': 'nowrap'});
- $carousels.insertAfter(self.$el);
-
- $(".carousel").each(function() {
- var $carousel = new instance.website.snippet.carousel(self, this);
- $carousel.appendTo($carousels);
- });
- $(document).on("scroll", function () {
- $carousels.css("top", (-self.$el.offset().top+2) + 'px');
+ $('.carousel .js_carousel_options .label').on('click', function (e) {
+ e.preventDefault();
+ var $button = $(e.currentTarget)
+ var $c = $button.parents(".carousel:first");
+
+ if($button.hasClass("js_add")) {
+ var cycle = $c.find(".carousel-inner .item").size();
+ $c.find(".carousel-inner").append(QWeb.render("Website.Snipped.carousel"));
+ $c.carousel(cycle);
+ }
+ else {
+ var cycle = $c.find(".carousel-inner .item.active").remove();
+ $c.find(".carousel-inner .item:first").addClass("active");
+ $c.carousel(0);
+ self.trigger('change', self, null);
+ }
});
- }
-});
-
-
-instance.website.snippet = {};
-instance.website.snippet.carousel = instance.web.Widget.extend({
- template: 'Website.Snipped.carousel',
- events: {
- 'click .add': 'add_page',
- 'click .remove': 'remove_page',
- },
- instances: [],
- init: function (parent, carousel) {
- this._super(parent);
- this.parent = parent;
- var index = instance.website.snippet.carousel.index || 0;
- instance.website.snippet.carousel.index = index++;
- this.index = index;
- $(carousel).addClass("carousel-index-"+index);
- this.offset = $(carousel).offset();
- },
- start: function () {
- var self = this;
- this.$el.css({position: 'absolute', top: this.offset.top+'px', left: this.offset.left+'px'});
- },
- destroy: function () {
- return this._super();
- },
- get_carousel: function() {
- return $(".carousel.carousel-index-"+this.index);
- },
- add_page: function() {
- var $c = this.get_carousel();
- var cycle = $c.find(".carousel-inner .item").size();
- $c.find(".carousel-inner").append(this.$(".item").clone());
- $c.carousel(cycle);
- },
- remove_page: function() {
- var $c = this.get_carousel();
- var cycle = $c.find(".carousel-inner .item.active").remove();
- $c.find(".carousel-inner .item:first").addClass("active");
- $c.carousel(0);
- this.parent.trigger('change', this.parent, null);
+ $('.carousel .js_carousel_options').show();
}
});
@@ -490,10 +462,8 @@ $(function(){
}
event.preventDefault();
}
-
});
-
instance.web.ActionRedirect = function(parent, action) {
var url = $.deparam(window.location.href).url;
if (url) {
diff --git a/addons/website/static/src/xml/website.xml b/addons/website/static/src/xml/website.xml
index 75d25616d87..941015fd0f5 100644
--- a/addons/website/static/src/xml/website.xml
+++ b/addons/website/static/src/xml/website.xml
@@ -19,16 +19,10 @@
</div>
</t>
<t t-name="Website.Snipped.carousel">
- <div style="position: absolute; top: -4px;">
- <span class="label" style="cursor:pointer"><i class="add icon-plus-sign"></i></span>
- <span class="label" style="cursor:pointer"><i class="remove icon-minus-sign"></i></span>
- <div style="display: none;">
- <div class="item" style="background-image: url(/website/static/src/img/china.jpg); background-size: cover; background-position: bottom;" >
- <div class='container'>
- <h1 class='mt64'>Your New Banner Slide</h1>
- <h2>With another convincing subtitle</h2>
- </div>
- </div>
+ <div class="item" style="background-image: url(/website/static/src/img/china.jpg); background-size: cover; background-position: bottom;" >
+ <div class='container'>
+ <h1 class='mt64'>Your New Banner Slide</h1>
+ <h2>With another convincing subtitle</h2>
</div>
</div>
</t>