From 4724266802b4e16bb86bbf0d12e17e6d7003933a Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Tue, 15 Oct 2013 14:53:08 +0200 Subject: [PATCH 01/19] [FIX] product: wrong product and supplierinfo demo data. Because product_id of product.supplierinfo is a product.template field and not a product.product field bzr revid: chm@openerp.com-20131015125308-mzmq1p1nm1kfqd9g --- addons/product/product_demo.xml | 472 ++++++++++++++++++++++---------- 1 file changed, 330 insertions(+), 142 deletions(-) diff --git a/addons/product/product_demo.xml b/addons/product/product_demo.xml index 260b4b3ea0b..39be1635d1a 100644 --- a/addons/product/product_demo.xml +++ b/addons/product/product_demo.xml @@ -209,7 +209,8 @@ - + + On Site Monitoring @@ -221,8 +222,12 @@ This type of service include basic monitoring of products. This type of service include basic monitoring of products. + + + - + + On Site Assistance @@ -233,10 +238,13 @@ This type of service include assistance for security questions, system configuration requirements, implementation or special needs. + + + - + + PC Assemble SC234 - PCSC234 450.0 @@ -249,10 +257,14 @@ Processor AMD 8-Core 512MB RAM HDD SH-1 + + + PCSC234 + - + + iPad Retina Display - A2323 500.0 @@ -264,10 +276,14 @@ HDD SH-1 Dual-core A5 with quad-core graphics FaceTime HD Camera, 1.2 MP Photos + + + A2323 + - + + Bose Mini Bluetooth Speaker - B3423 600.0 @@ -278,10 +294,14 @@ FaceTime HD Camera, 1.2 MP Photos Custom computer assembled on order based on customer's requirement. Bose's smallest portable Bluetooth speaker + + + B3423 + - + + iPad Mini - A1232 800.0 @@ -290,9 +310,13 @@ FaceTime HD Camera, 1.2 MP Photos - + + + A1232 + + + Apple In-Ear Headphones - A8767 70.0 @@ -301,9 +325,13 @@ FaceTime HD Camera, 1.2 MP Photos - + + + A8767 + + + iMac - A1090 1299.0 1799.0 @@ -311,9 +339,13 @@ FaceTime HD Camera, 1.2 MP Photos - + + + A1090 + + + Apple Wireless Keyboard - AK789 10.0 @@ -322,9 +354,13 @@ FaceTime HD Camera, 1.2 MP Photos - + + + AK789 + + + Mouse, Optical - M-Opt 12.50 @@ -333,10 +369,13 @@ FaceTime HD Camera, 1.2 MP Photos + + + M-Opt + - + iPod - A6678 14 @@ -356,17 +395,17 @@ FaceTime HD Camera, 1.2 MP Photos consu - + + A6678 32 Gb 12 - + - + Mouse, Wireless - M-Wir 18 @@ -375,9 +414,13 @@ FaceTime HD Camera, 1.2 MP Photos - + + + M-Wir + + + RAM SR5 - RAM-SR5 78.0 @@ -386,9 +429,13 @@ FaceTime HD Camera, 1.2 MP Photos - + + + RAM-SR5 + + + RAM SR2 - RAM-SR2 87.0 @@ -397,9 +444,13 @@ FaceTime HD Camera, 1.2 MP Photos - + + + RAM-SR2 + + + RAM SR3 - RAM-SR3 80.0 @@ -408,9 +459,13 @@ FaceTime HD Camera, 1.2 MP Photos - + + + RAM-SR3 + + + Computer Case - C-Case 20.0 @@ -419,9 +474,13 @@ FaceTime HD Camera, 1.2 MP Photos - + + + C-Case + + + HDD SH-1 - HDD-SH1 860.0 @@ -430,9 +489,13 @@ FaceTime HD Camera, 1.2 MP Photos - + + + HDD-SH1 + + + HDD SH-2 - HDD-SH2 1020.0 @@ -441,9 +504,13 @@ FaceTime HD Camera, 1.2 MP Photos - + + + HDD-SH2 + + + HDD on Demand - HDD-DEM 1100.0 @@ -453,9 +520,13 @@ FaceTime HD Camera, 1.2 MP Photos On demand hard-disk having capacity based on requirement. - + + + HDD-DEM + + + Motherboard I9P57 - MBi9 1700.0 @@ -464,9 +535,13 @@ FaceTime HD Camera, 1.2 MP Photos - + + + MBi9 + + + Motherboard A20Z7 - MBa20 1790.0 @@ -475,9 +550,13 @@ FaceTime HD Camera, 1.2 MP Photos - + + + MBa20 + + + Processor Core i5 2.70 Ghz - CPUi5 2010.0 @@ -486,9 +565,13 @@ FaceTime HD Camera, 1.2 MP Photos - + + + CPUi5 + + + Processor AMD 8-Core - CPUa8 1910.0 @@ -497,9 +580,13 @@ FaceTime HD Camera, 1.2 MP Photos - + + + CPUa8 + + + Graphics Card - CARD 876.0 @@ -508,9 +595,13 @@ FaceTime HD Camera, 1.2 MP Photos - + + + CARD + + + Laptop E5023 - LAP-E5 2870.0 @@ -523,9 +614,13 @@ FaceTime HD Camera, 1.2 MP Photos Standard-1294P Processor QWERTY keyboard - + + + LAP-E5 + + + Laptop S3450 - LAP-S3 3000.0 @@ -538,9 +633,13 @@ QWERTY keyboard Hi-Speed 234Q Processor QWERTY keyboard - + + + LAP-S3 + + + Laptop Customized - LAP-CUS 3300.0 @@ -550,9 +649,13 @@ QWERTY keyboard Custom Laptop based on customer's requirement. - + + + LAP-CUS + + + External Hard disk - EXT-HDD 390.0 @@ -561,10 +664,14 @@ QWERTY keyboard + + + EXT-HDD + - + + Pen drive, SP-2 - PD-SP2 90.0 @@ -573,10 +680,14 @@ QWERTY keyboard + + + PD-SP2 + - + + Pen drive, SP-4 - PD-SP4 126.0 @@ -585,9 +696,13 @@ QWERTY keyboard - + + + PD-SP4 + + + Multimedia Speakers - MM-SPK 134.0 @@ -597,9 +712,13 @@ QWERTY keyboard . - + + + MM-SPK + + + Headset standard - HEAD 57.0 @@ -609,9 +728,13 @@ QWERTY keyboard Hands free headset for laptop PC with in-line microphone and headphone plug. - + + + HEAD + + + Headset USB - HEAD-USB 60.0 @@ -621,10 +744,14 @@ QWERTY keyboard Headset for laptop PC with USB connector. + + + HEAD-USB + - + + Webcam - WCAM 38.0 @@ -633,10 +760,14 @@ QWERTY keyboard + + + WCAM + - + + Blank CD - CD 18.40 20.0 @@ -644,10 +775,14 @@ QWERTY keyboard + + + CD + - + + Blank DVD-RW - DVD 21.60 24.0 @@ -655,10 +790,14 @@ QWERTY keyboard + + + DVD + - + + Printer, All-in-one - PRINT 4258.0 @@ -668,10 +807,14 @@ QWERTY keyboard All in one hi-speed printer with fax and scanner. + + + PRINT + - + + Ink Cartridge - INK 60.0 @@ -680,10 +823,14 @@ QWERTY keyboard + + + INK + - + + Toner Cartridge - TONER 66.0 @@ -692,10 +839,14 @@ QWERTY keyboard + + + TONER + - + + Windows 7 Professional - Win7 330.0 @@ -704,10 +855,14 @@ QWERTY keyboard + + + Win7 + - + + Windows Home Server 2011 - WServer 540.0 @@ -716,10 +871,14 @@ QWERTY keyboard + + + WServer + - + + Office Suite - OSuite 110.0 @@ -729,10 +888,14 @@ QWERTY keyboard Office Editing Software with word processing, spreadsheets, presentations, graphics, and databases... + + + OSuite + - + + Zed+ Antivirus - Zplus 235.0 @@ -741,10 +904,14 @@ QWERTY keyboard + + + Zplus + - + + GrapWorks Software - GRAPs/w 155.0 @@ -754,10 +921,14 @@ QWERTY keyboard Full featured image editing software. + + + GRAPs/w + - + + Router R430 - ROUT_430 55.0 @@ -766,10 +937,14 @@ QWERTY keyboard + + + ROUT_430 + - + + Datacard - DC 35.0 @@ -778,10 +953,14 @@ QWERTY keyboard + + + DC + - + + Switch, 24 ports - SW24 55.0 @@ -790,10 +969,14 @@ QWERTY keyboard + + + SW24 + - + + USB Adapter - ADPT 13.0 18.0 @@ -801,328 +984,333 @@ QWERTY keyboard + + + ADPT + + - + 3 1 - + 3 1 - + 3 1 - + 3 1 - + 2 5 - + 4 1 - + 2 1 - + 2 1 - + 5 1 - + 5 1 - + 5 1 - + 1 1 - + 1 1 - + 3 1 - + 3 1 - + 4 5 - + 3 1 - + 2 1 - + 3 1 - + 3 1 - + 3 1 - + 8 1 - + 8 1 - + 4 1 - + 5 1 - + 2 12 - + 2 12 - + 2 5 - + 2 12 - + 2 5 - + 2 1 - + 2 1 - + 4 1 - + 4 1 - + 5 1 - + 5 1 - + 7 1 - + 4 1 - + 4 0 - + 5 0 - + 2 0 - + 4 0 - + 10 0 - + 3 0 - + 5 0 From 4a42935f4eb721ac9d23e230c53a77a77140d490 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Tue, 15 Oct 2013 16:56:54 +0200 Subject: [PATCH 02/19] [IMP] website snippets: add slide for banner with an other background of the active slide bzr revid: chm@openerp.com-20131015145654-294fik4do6lh85vr --- addons/website/static/src/js/website.snippets.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/addons/website/static/src/js/website.snippets.js b/addons/website/static/src/js/website.snippets.js index e4e41e802fa..6cd135a44dd 100644 --- a/addons/website/static/src/js/website.snippets.js +++ b/addons/website/static/src/js/website.snippets.js @@ -791,7 +791,7 @@ // select in ul options $ul.find("li").removeClass("active"); - var selected = $ul.find('[data-value="' + bg_value + '"], [data-value="' + bg_value.replace(/.*:\/\/[^\/]+/, '') + '"]'); + var selected = $ul.find('[data-value="' + bg_value + '"], [data-value="' + bg_value.replace(/.*:\/\/[^\/]+|\)$/g, '') + '"]'); selected.addClass('active'); if (!selected.length) { $ul.find('.oe_custom_bg b').html(bg_value); @@ -1050,7 +1050,11 @@ var index = $active.index(); this.$target.find('.carousel-control, .carousel-indicators').removeClass("hidden"); this.$indicators.append('
  • '); - $active.clone().removeClass('active').insertAfter($active); + + var $clone = this.$el.find(".item.active").clone(); + var bg = this.$editor.find('ul[name="carousel-background"] li:not([data-value="'+ $active.css("background-image").replace(/.*:\/\/[^\/]+|\)$/g, '') +'"]):first').data("value"); + $clone.css("background-image", "url('"+ bg +"')"); + $clone.removeClass('active').insertAfter($active); this.$target.carousel().carousel(++index); }, on_remove: function (e) { From 4800ac8e2e8847a77a601812f60ab64f0c017ad4 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Tue, 15 Oct 2013 17:43:51 +0200 Subject: [PATCH 03/19] [FIX] website snippet: fix banner and add a clean_for_save method on snippet editor bzr revid: chm@openerp.com-20131015154351-se9wsg5oel32ipoz --- .../website/static/src/js/website.snippets.js | 39 +++++++++++++++++-- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/addons/website/static/src/js/website.snippets.js b/addons/website/static/src/js/website.snippets.js index 6cd135a44dd..a9191154d99 100644 --- a/addons/website/static/src/js/website.snippets.js +++ b/addons/website/static/src/js/website.snippets.js @@ -24,6 +24,7 @@ }, save: function () { this.snippets.make_active(false); + this.snippets.clean_for_save(); remove_added_snippet_id(); this._super(); }, @@ -78,6 +79,7 @@ } this.$active_snipped_id = false; hack_to_add_snippet_id(); + this.snippets = []; $("body").on('DOMNodeInserted', hack_to_add_snippet_id); }, dom_filter: function (dom, sibling) { @@ -206,6 +208,11 @@ } } }, + clean_for_save: function () { + for (var k in this.snippets) { + $(this.snippets[k]).data("snippet-editor").clean_for_save(); + } + }, make_active: function ($snipped_id) { if ($snipped_id && this.$active_snipped_id && this.$active_snipped_id.get(0) === $snipped_id.get(0)) { return; @@ -214,6 +221,9 @@ this.snippet_blur(this.$active_snipped_id); } if ($snipped_id) { + if(_.indexOf(this.snippets, $snipped_id.get(0)) === -1) { + this.snippets.push($snipped_id.get(0)); + } this.$active_snipped_id = $snipped_id; this.create_overlay(this.$active_snipped_id); this.snippet_focus($snipped_id); @@ -749,6 +759,13 @@ this.$overlay.removeClass('oe_active'); }, + /* clean_for_save + * function called just before save vue + */ + clean_for_save: function () { + + }, + change_background: function (bg, ul_options) { var self = this; this.set_options_background(bg, ul_options); @@ -791,7 +808,7 @@ // select in ul options $ul.find("li").removeClass("active"); - var selected = $ul.find('[data-value="' + bg_value + '"], [data-value="' + bg_value.replace(/.*:\/\/[^\/]+|\)$/g, '') + '"]'); + var selected = $ul.find('[data-value="' + bg_value + '"], [data-value="' + bg_value.replace(/.*:\/\/[^\/]+/, '') + '"]'); selected.addClass('active'); if (!selected.length) { $ul.find('.oe_custom_bg b').html(bg_value); @@ -983,6 +1000,11 @@ }, }); + website.snippet.animationRegistry.carousel = website.snippet.Animation.extend({ + start: function () { + this.$target.carousel(); + }, + }); website.snippet.editorRegistry.carousel = website.snippet.editorRegistry.resize.extend({ build_snippet: function() { var id = 0; @@ -1005,6 +1027,13 @@ this._super(); this.$target.carousel('cycle'); }, + clean_for_save: function () { + this._super(); + this.$target.find(".item.left, .item.next").removeClass("next left"); + if(!this.$target.find(".item.active").length) { + this.$target.find(".item:first").addClass("active"); + } + }, start : function () { this._super(); @@ -1038,9 +1067,9 @@ // rebind event to active carousel on edit mode rebind_event: function () { var self = this; - this.$target.on('click', '.carousel-control', function () { + this.$target.off('click').on('click', '.carousel-control', function () { self.$target.carousel($(this).data('slide')); }); - this.$target.on('click', '.carousel-indicators [data-target]', function () { + this.$target.off('click').on('click', '.carousel-indicators [data-target]', function () { self.$target.carousel(+$(this).data('slide-to')); }); }, on_add: function (e) { @@ -1056,6 +1085,7 @@ $clone.css("background-image", "url('"+ bg +"')"); $clone.removeClass('active').insertAfter($active); this.$target.carousel().carousel(++index); + this.rebind_event(); }, on_remove: function (e) { e.preventDefault(); @@ -1072,7 +1102,8 @@ }); setTimeout(function () { new_index = index % cycle; - self.$target.carousel( new_index + 1 ); + self.$target.carousel().carousel( new_index + 1 ); + self.rebind_event(); }, 500); } else { this.$target.find('.carousel-control, .carousel-indicators').addClass("hidden"); From a5d530837576b2b7f582f24eff3118390143c127 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Wed, 16 Oct 2013 08:52:57 +0200 Subject: [PATCH 04/19] [IMP] website snippets: cleaner image editor for banner bzr revid: chm@openerp.com-20131016065257-3hl5k3nly8hlqrgk --- addons/website/static/src/js/website.snippets.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/addons/website/static/src/js/website.snippets.js b/addons/website/static/src/js/website.snippets.js index a9191154d99..a77c4b518bb 100644 --- a/addons/website/static/src/js/website.snippets.js +++ b/addons/website/static/src/js/website.snippets.js @@ -770,6 +770,7 @@ var self = this; this.set_options_background(bg, ul_options); var $ul = this.$editor.find(ul_options); + var bg_value = (typeof bg === 'string' ? this.$target.find(bg) : $(bg)).css("background-image").replace(/url\(['"]*|['"]*\)/g, ""); // bind envent on options var $li = $ul.find("li"); @@ -1059,7 +1060,11 @@ }); this.$target.on('dblclick', '.item.active .carousel-image img', function (event) { - $('#oe_rte_toolbar .cke_button__image .cke_button__image_icon').click(); + 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(); From aeffcc2a67959ff5794f719cb785c59968069328 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Wed, 16 Oct 2013 09:02:37 +0200 Subject: [PATCH 05/19] [FIX] website snippets: clean for save remove left and prev class bzr revid: chm@openerp.com-20131016070237-6jmnsjdw26w014nv --- addons/website/static/src/js/website.snippets.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/website/static/src/js/website.snippets.js b/addons/website/static/src/js/website.snippets.js index a77c4b518bb..9fd626cb8af 100644 --- a/addons/website/static/src/js/website.snippets.js +++ b/addons/website/static/src/js/website.snippets.js @@ -1030,7 +1030,7 @@ }, clean_for_save: function () { this._super(); - this.$target.find(".item.left, .item.next").removeClass("next left"); + this.$target.find(".item").removeClass("next prev left right"); if(!this.$target.find(".item.active").length) { this.$target.find(".item:first").addClass("active"); } From 12f6a051ff547011841a79fa2e92543dcfb3f34c Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Wed, 16 Oct 2013 09:36:30 +0200 Subject: [PATCH 06/19] [FIX] website snippet: remove snippet and clean_for_save bzr revid: chm@openerp.com-20131016073630-y153xmzapqgm9dsm --- addons/website/static/src/js/website.snippets.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/addons/website/static/src/js/website.snippets.js b/addons/website/static/src/js/website.snippets.js index 9fd626cb8af..2181b8a650b 100644 --- a/addons/website/static/src/js/website.snippets.js +++ b/addons/website/static/src/js/website.snippets.js @@ -210,7 +210,10 @@ }, clean_for_save: function () { for (var k in this.snippets) { - $(this.snippets[k]).data("snippet-editor").clean_for_save(); + var editor = $(this.snippets[k]).data("snippet-editor"); + if (editor) { + editor.clean_for_save(); + } } }, make_active: function ($snipped_id) { @@ -728,8 +731,9 @@ start: function () { var self = this; this.$overlay.on('click', '.oe_snippet_remove', function () { - self.$target.detach(); self.onBlur(); + var index = _.indexOf(self.parent.snippets, self.$target.get(0)); + delete self.parent.snippets[index]; self.$target.remove(); return false; }); From e375557b844e393d081019adc03cd5530a6f87fc Mon Sep 17 00:00:00 2001 From: ddm Date: Wed, 16 Oct 2013 11:19:47 +0200 Subject: [PATCH 07/19] [IMP] Editor flicker+resize (cf. task: [CMS] Source editor) bzr revid: ddm@openerp.com-20131016091947-5aymhkl1we878bdl --- addons/website/static/src/css/editor.css | 14 ++------- addons/website/static/src/css/editor.sass | 32 +++++++++---------- addons/website/static/src/js/website.ace.js | 35 ++++++++++++++++++--- 3 files changed, 47 insertions(+), 34 deletions(-) diff --git a/addons/website/static/src/css/editor.css b/addons/website/static/src/css/editor.css index ebcb7f43826..845d77cad2c 100644 --- a/addons/website/static/src/css/editor.css +++ b/addons/website/static/src/css/editor.css @@ -1,3 +1,4 @@ +@charset "utf-8"; /* ---- CKEditor Minimal Reset ---- */ .navbar.navbar-inverse .cke_chrome { border: none; @@ -602,17 +603,12 @@ table.editorbar-panel td.selected { /* ---- ACE EDITOR ---- */ .oe_ace_view_editor { - -webkit-transition: all 0.2s ease-in; - -moz-transition: all 0.2s ease-in; - -o-transition: all 0.2s ease-in; - transition: all 0.2s ease-in; - filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=30); - opacity: 0.3; position: fixed; top: 51px; right: 0; z-index: 1000; height: 100%; + width: 720px; } .oe_ace_view_editor .oe_ace_view_editor_title { width: 100%; @@ -643,15 +639,11 @@ table.editorbar-panel td.selected { left: 0; width: 720px; } -.oe_ace_view_editor:hover { +.oe_ace_view_editor.oe_ace_open { filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100); opacity: 1; } -.oe_ace_view_editor.oe_ace_open { - width: 720px; -} .oe_ace_view_editor.oe_ace_closed { - width: 0; filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0); opacity: 0; } diff --git a/addons/website/static/src/css/editor.sass b/addons/website/static/src/css/editor.sass index 1ef6d67bb49..db8b0bbf460 100644 --- a/addons/website/static/src/css/editor.sass +++ b/addons/website/static/src/css/editor.sass @@ -4,15 +4,15 @@ @import "compass/css3/user-interface" @import "compass/css3/transition" -//smartphones, iPhone, portrait 480x320 phones +//smartphones, iPhone, portrait 480x320 phones $smart_phone: 320px //portrait e-readers (Nook/Kindle), smaller tablets @ 600 or @ 640 wide.*/ -$small-tablet: 481px +$small-tablet: 481px //portrait tablets, portrait iPad, landscape e-readers, landscape 800x480 or 854x480 phones -$portrait-tablet: 641px -//tablet, landscape iPad, lo-res laptops ands desktops +$portrait-tablet: 641px +//tablet, landscape iPad, lo-res laptops ands desktops $tablet: 961px -//big landscape tablets, laptops, and desktops +//big landscape tablets, laptops, and desktops $desktop: 1025px /* ---- CKEditor Minimal Reset ---- */ @@ -179,7 +179,7 @@ table.editorbar-panel background: black !important > a padding: 2px 10px !important - width: 100% + width: 100% display: block border: 0 z-index: 1 @@ -189,13 +189,13 @@ table.editorbar-panel display: inline-block white-space: nowrap background: black - > div + > div background: rgb(0,0,0) label width: 44px color: #fff padding-left: 10px - + div width: 100px text-align: center @@ -267,13 +267,13 @@ table.editorbar-panel margin: 0px -24px !important &.oe_overlay border-radius: 3px - //@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)) + //@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)) + //@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) @@ -293,7 +293,7 @@ table.editorbar-panel display: none position: absolute background: transparent - //@include background-image( repeating-linear-gradient(45deg, rgba(255,255,255,.02) ,rgba(255,255,255,.02) 35px, rgba(0,0,0,.02) 35px, rgba(0,0,0,.02) 75px)) + //@include background-image( repeating-linear-gradient(45deg, rgba(255,255,255,.02) ,rgba(255,255,255,.02) 35px, rgba(0,0,0,.02) 35px, rgba(0,0,0,.02) 75px)) +border-radius(3px) @include transition(opacity 100ms linear) +box-sizing(border-box) @@ -476,13 +476,12 @@ $navbar_height: 51px font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace line-height: normal .oe_ace_view_editor - @include transition(all 0.2s ease-in) - +opacity(0.3) position: fixed top: $navbar_height right: 0 z-index: 1000 height: 100% + width: $ace_width .oe_ace_view_editor_title width: 100% padding-top: 4px @@ -504,12 +503,9 @@ $navbar_height: 51px bottom: $navbar_height left: 0 width: $ace_width - &:hover - +opacity(1) &.oe_ace_open - width: $ace_width + +opacity(1) &.oe_ace_closed - width: 0 +opacity(0) /* ---- EDITOR TOUR ---- */ diff --git a/addons/website/static/src/js/website.ace.js b/addons/website/static/src/js/website.ace.js index 1a0417ff11a..d640839acf9 100644 --- a/addons/website/static/src/js/website.ace.js +++ b/addons/website/static/src/js/website.ace.js @@ -66,6 +66,9 @@ }); website.ace.ViewEditor = openerp.Widget.extend({ + resizing: false, + refX: 0, + minWidth: 40, template: 'website.ace_view_editor', events: { 'change #ace-view-list': 'displaySelectedView', @@ -89,6 +92,32 @@ self.loadViews.call(self, views); self.open.call(self); }); + + var $editor = $('.ace_editor'); + function resizeEditor (target) { + var width = Math.min(document.body.clientWidth, Math.max(parseInt(target, 10), self.minWidth)); + $editor.width(width); + self.aceEditor.resize(); + self.$el.width(width); + } + function startResizing (e) { + self.refX = e.pageX; + self.resizing = true; + } + function stopResizing () { + self.resizing = false; + } + function updateWidth (e) { + if (self.resizing) { + var offset = e.pageX - self.refX; + var width = self.$el.width() - offset; + self.refX = e.pageX; + resizeEditor(width); + } + } + document.body.addEventListener('mouseup', stopResizing, true); + self.$('.ace_gutter').mouseup(stopResizing).mousedown(startResizing).click(stopResizing); + $(document).mousemove(updateWidth); }, loadViews: function (views) { var self = this; @@ -205,11 +234,7 @@ }, close: function () { window.location.hash = ""; - var self = this; - this.$el.bind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function () { - globalEditor = null; - self.destroy.call(self); - }).removeClass('oe_ace_open').addClass('oe_ace_closed'); + this.$el.removeClass('oe_ace_open').addClass('oe_ace_closed'); }, }); From 52ef0032e33e9b13b0c1814e7a8e653860a1a34b Mon Sep 17 00:00:00 2001 From: ddm Date: Wed, 16 Oct 2013 11:28:52 +0200 Subject: [PATCH 08/19] [IMP] Ace editor CSS improvements bzr revid: ddm@openerp.com-20131016092852-3myx024u2zn5cnvi --- addons/website/static/src/css/editor.css | 13 +++++++------ addons/website/static/src/css/editor.sass | 11 ++++++----- addons/website/static/src/js/website.ace.js | 4 ++-- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/addons/website/static/src/css/editor.css b/addons/website/static/src/css/editor.css index 845d77cad2c..a009bf61f23 100644 --- a/addons/website/static/src/css/editor.css +++ b/addons/website/static/src/css/editor.css @@ -612,20 +612,20 @@ table.editorbar-panel td.selected { } .oe_ace_view_editor .oe_ace_view_editor_title { width: 100%; - padding-top: 4px; - padding-left: 4px; - height: 40px; + padding-top: 0; + padding-left: 0; + height: 30px; background: #2f3129; } .oe_ace_view_editor .oe_ace_view_editor_title .oe_view_list { width: 50%; - height: 32px; + height: 30px; font-size: 14px; font-family: "Monaco", "Menlo", "Ubuntu Mono", "Consolas", "source-code-pro", monospace; line-height: normal; } .oe_ace_view_editor .oe_ace_view_editor_title .btn { - height: 32px; + height: 30px; padding: 0 4px 0 4px; font-size: 14px; font-family: "Monaco", "Menlo", "Ubuntu Mono", "Consolas", "source-code-pro", monospace; @@ -633,7 +633,7 @@ table.editorbar-panel td.selected { } .oe_ace_view_editor .ace_editor { position: absolute; - top: 40px; + top: 30px; right: 0; bottom: 51px; left: 0; @@ -644,6 +644,7 @@ table.editorbar-panel td.selected { opacity: 1; } .oe_ace_view_editor.oe_ace_closed { + z-index: -1000; filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0); opacity: 0; } diff --git a/addons/website/static/src/css/editor.sass b/addons/website/static/src/css/editor.sass index db8b0bbf460..461667d8e54 100644 --- a/addons/website/static/src/css/editor.sass +++ b/addons/website/static/src/css/editor.sass @@ -467,7 +467,7 @@ $highlighted_text_color: #ffffff /* ---- ACE EDITOR ---- */ $ace_width: 720px -$editorbar_height: 40px +$editorbar_height: 30px // TODO Fix => might break with themes $navbar_height: 51px @@ -484,16 +484,16 @@ $navbar_height: 51px width: $ace_width .oe_ace_view_editor_title width: 100% - padding-top: 4px - padding-left: 4px + padding-top: 0 + padding-left: 0 height: $editorbar_height background: #2F3129 .oe_view_list width: 50% - height: $editorbar_height - 8px + height: $editorbar_height @include editor-font .btn - height: $editorbar_height - 8px + height: $editorbar_height padding: 0 4px 0 4px @include editor-font .ace_editor @@ -506,6 +506,7 @@ $navbar_height: 51px &.oe_ace_open +opacity(1) &.oe_ace_closed + z-index: -1000 +opacity(0) /* ---- EDITOR TOUR ---- */ diff --git a/addons/website/static/src/js/website.ace.js b/addons/website/static/src/js/website.ace.js index d640839acf9..faf3e8f7e04 100644 --- a/addons/website/static/src/js/website.ace.js +++ b/addons/website/static/src/js/website.ace.js @@ -93,7 +93,7 @@ self.open.call(self); }); - var $editor = $('.ace_editor'); + var $editor = self.$('.ace_editor'); function resizeEditor (target) { var width = Math.min(document.body.clientWidth, Math.max(parseInt(target, 10), self.minWidth)); $editor.width(width); @@ -108,7 +108,7 @@ self.resizing = false; } function updateWidth (e) { - if (self.resizing) { + if (self.resizing) { var offset = e.pageX - self.refX; var width = self.$el.width() - offset; self.refX = e.pageX; From 1cec2a5b6f392902adb7c19935a5519834366eaa Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Wed, 16 Oct 2013 11:32:48 +0200 Subject: [PATCH 09/19] [REM] Obsolete route /admin bzr revid: fme@openerp.com-20131016093248-2q2c8ppkxxhfx1su --- addons/website/controllers/main.py | 6 +----- addons/website/static/src/xml/website.xml | 2 +- addons/website/views/website_templates.xml | 6 +++--- addons/website_blog/controllers/main.py | 2 +- addons/website_sale/views/website_sale.xml | 2 +- 5 files changed, 7 insertions(+), 11 deletions(-) diff --git a/addons/website/controllers/main.py b/addons/website/controllers/main.py index baa6b6c780b..083f9f3aef7 100644 --- a/addons/website/controllers/main.py +++ b/addons/website/controllers/main.py @@ -51,11 +51,7 @@ class Website(openerp.addons.web.controllers.main.Home): def index(self, **kw): return self.page("website.homepage") - @http.route('/admin', type='http', auth="none") - def admin(self, *args, **kw): - return super(Website, self).index(*args, **kw) - - # FIXME: auth, if /pagenew known anybody can create new empty page + # FIXME: auth, if /pagenew known anybody can create new empty page @website.route('/pagenew/', type='http', auth="admin") def pagenew(self, path, noredirect=NOPE): module = 'website' diff --git a/addons/website/static/src/xml/website.xml b/addons/website/static/src/xml/website.xml index b3e4cacd32a..409d73f1f27 100644 --- a/addons/website/static/src/xml/website.xml +++ b/addons/website/static/src/xml/website.xml @@ -35,7 +35,7 @@
  • - Apps + Apps
  • diff --git a/addons/website/views/website_templates.xml b/addons/website/views/website_templates.xml index 1071a5bff0e..a6e6579ef1d 100644 --- a/addons/website/views/website_templates.xml +++ b/addons/website/views/website_templates.xml @@ -93,8 +93,8 @@ - + diff --git a/addons/website_blog/controllers/main.py b/addons/website_blog/controllers/main.py index 7d40e080636..e2341af88aa 100644 --- a/addons/website_blog/controllers/main.py +++ b/addons/website_blog/controllers/main.py @@ -178,7 +178,7 @@ class WebsiteBlog(http.Controller): url = request.httprequest.host_url request.session.body = post.get('body') if request.context['is_public_user']: # purpose of this ? - return '%s/admin#action=redirect&url=%s/blog/%s/post' % (url, url, blog_post_id) + return '%s/web#action=redirect&url=%s/blog/%s/post' % (url, url, blog_post_id) if request.session.get('body') and blog_post_id: request.registry['blog.post'].message_post( diff --git a/addons/website_sale/views/website_sale.xml b/addons/website_sale/views/website_sale.xml index b458c36aa0e..a263a01ed2e 100644 --- a/addons/website_sale/views/website_sale.xml +++ b/addons/website_sale/views/website_sale.xml @@ -623,7 +623,7 @@
    From 641477141f39ac02bcd933fb8b0a6f15cf1526de Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Wed, 16 Oct 2013 12:10:55 +0200 Subject: [PATCH 10/19] [IMP] website snippet: improve visibility of drop zone bzr revid: chm@openerp.com-20131016101055-p6vhiijvladtbn87 --- addons/website/static/src/css/editor.css | 99 +++++++++++++------ 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 | 96 +++++++++++------- .../static/src/xml/website.snippets.xml | 23 ++++- 7 files changed, 198 insertions(+), 90 deletions(-) diff --git a/addons/website/static/src/css/editor.css b/addons/website/static/src/css/editor.css index ebcb7f43826..1b55eeacef5 100644 --- a/addons/website/static/src/css/editor.css +++ b/addons/website/static/src/css/editor.css @@ -1,3 +1,4 @@ +@charset "utf-8"; /* ---- CKEditor Minimal Reset ---- */ .navbar.navbar-inverse .cke_chrome { border: none; @@ -304,53 +305,87 @@ table.editorbar-panel td.selected { } /* ---- SNIPPETS DROP ZONES ---- */ -.oe_drop_zone.oe_insert { - display: block; - height: 48px; - margin: 0px; - margin-top: -4px; - margin-bottom: -44px; - -webkit-transition: margin 250ms linear; - -moz-transition: margin 250ms linear; - -o-transition: margin 250ms linear; - transition: margin 250ms linear; +#dark_for_dropzone { width: 100%; position: absolute; + top: 0; + left: 0; + opacity: 0.4; z-index: 1000; + pointer-events: none; } -.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; +#dark_for_dropzone td { + background: black; } -.oe_drop_zone.oe_insert.oe_hover:before { - border-top: dashed 2px rgba(116, 255, 161, 0.72); -} -.oe_drop_zone.oe_insert.oe_vertical { - width: 48px; - float: left; - position: relative; - margin: 0px -24px !important; -} -.oe_drop_zone.oe_insert.oe_overlay { - border-radius: 3px; - background: rgba(153, 0, 255, 0.5); +#dark_for_dropzone td.center.active { + background: transparent; } .oe_drop_zone, .oe_drop_zone_style { border: none; - background: rgba(153, 0, 255, 0.3); + 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.oe_hover, .oe_drop_zone_style.oe_hover { - background: rgba(0, 255, 133, 0.3); - z-index: 1001; +.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 { + display: block; + height: 48px; + margin: 0px; + margin-top: -4px; + margin-bottom: -44px; + z-index: 1002; + width: 100%; + position: absolute; +} +.oe_drop_zone: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 { + border-top: dashed 2px rgba(116, 255, 161, 0.72); +} +.oe_drop_zone.oe_vertical { + width: 48px; + float: left; + position: relative; + margin: 4px -24px !important; +} +.oe_drop_zone.oe_vertical div { + display: none; +} +.oe_drop_zone.oe_overlay { + border-radius: 3px; +} +.oe_drop_zone.oe_drop_active { + background: rgba(100, 255, 255, 0.3); +} +.oe_drop_zone.oe_drop_active div { + display: none; +} +.oe_drop_zone.oe_drop_active .oe_active { + display: block; } .oe_drop_zone_style { diff --git a/addons/website/static/src/css/editor.sass b/addons/website/static/src/css/editor.sass index 1ef6d67bb49..becf7dc9ba0 100644 --- a/addons/website/static/src/css/editor.sass +++ b/addons/website/static/src/css/editor.sass @@ -242,16 +242,45 @@ table.editorbar-panel /* ---- SNIPPETS DROP ZONES ---- */ -.oe_drop_zone.oe_insert +#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 display: block height: 48px margin: 0px margin-top: -4px margin-bottom: -44px - @include transition(margin 250ms linear) + z-index: 1002 width: 100% position: absolute - z-index: 1000 &:not(.oe_vertical):before content: "" display: block @@ -264,22 +293,17 @@ table.editorbar-panel width: 48px float: left position: relative - margin: 0px -24px !important + margin: 4px -24px !important + div + display: none &.oe_overlay border-radius: 3px - //@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_active + background: rgba(100, 255, 255, .3) + div + display: none + .oe_active + display: block .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 63e8fbefa76..c6bb24d04f0 100644 --- a/addons/website/static/src/css/snippets.css +++ b/addons/website/static/src/css/snippets.css @@ -216,5 +216,4 @@ [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 ce87e592136..c5b58815c67 100644 --- a/addons/website/static/src/css/website.css +++ b/addons/website/static/src/css/website.css @@ -235,7 +235,10 @@ footer { } .oe_structure.oe_empty > .oe_drop_zone.oe_insert:only-child, [data-oe-type=html] > .oe_drop_zone.oe_insert:only-child { - position: static; + 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; } .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 5197653429c..2735dfe9fc8 100644 --- a/addons/website/static/src/css/website.sass +++ b/addons/website/static/src/css/website.sass @@ -161,7 +161,9 @@ 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: static + position: relative + div + display: none .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 2181b8a650b..bbedd970d9b 100644 --- a/addons/website/static/src/js/website.snippets.js +++ b/addons/website/static/src/js/website.snippets.js @@ -308,17 +308,32 @@ } + 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().after($toInsert); + $(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'); } }, 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(){ @@ -327,15 +342,8 @@ }); }, 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'){ @@ -386,7 +394,7 @@ var sibling_selector = selector.siblings; var vertical_child_selector = selector.vertical_children; - var zone_template = "
    "; + var zone_template = openerp.qweb.render('website.snippet_drop_zone'); if(child_selector){ self.dom_filter(child_selector).each(function (){ @@ -406,7 +414,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")))+'px'); + $template.css('height', ($col.outerHeight() + parseInt($col.css("margin-top")) + parseInt($col.css("margin-bottom")) - 8)+'px'); $lastinsert = $template.clone(); $(this).after($lastinsert); @@ -575,7 +583,8 @@ * Displayed into the overlay options on focus */ _readXMLData: function() { - this.$el = this.parent.$snippets.siblings("[data-snippet-id='"+this.snippet_id+"']").clone(); + var self = this; + this.$el = this.parent.$snippets.filter(function () { return $(this).data("snippet-id") == self.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")); @@ -610,18 +619,28 @@ }); }, _drag_and_drop_after_insert_dropzone: function (){}, - _drag_and_drop_active_drop_zone: function ($zones){ + _drag_and_drop_active_drop_zone: function (){ var self = this; - $zones.droppable({ + var $dark = $("#dark_for_dropzone"); + $('.oe_drop_zone').droppable({ over: function(){ - $(".oe_drop_zone.hide").removeClass("hide"); - $(this).addClass("hide").first().after(self.$target); + $(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'); self.dropped = true; }, out: function(){ - $(this).removeClass("hide"); + $(this).removeClass("oe_drop_active"); + $dark.find("td.center").removeClass("active"); self.$target.detach(); self.dropped = false; + $("body").scroll(); // trigger a scroll to reset position for jquery api }, }); }, @@ -645,8 +664,12 @@ $("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($('.oe_drop_zone')); + self._drag_and_drop_active_drop_zone(); }, _drag_and_drop_stop: function (){ var self = this; @@ -656,6 +679,7 @@ 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(); @@ -953,23 +977,25 @@ _drag_and_drop_after_insert_dropzone: function(){ var self = this; - 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); - } - } - }); + // 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); + // } + // } + // }); }, _drag_and_drop_start: function () { this._super(); diff --git a/addons/website/static/src/xml/website.snippets.xml b/addons/website/static/src/xml/website.snippets.xml index e5dde368154..6aaf256b523 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,6 +57,25 @@
    + +
    +
    Drag your block here (move your mouse in this zone)
    +
    Drop your block
    +
    +
    + + +
    + + + + + + +
    +
    +
    +
    From 7c0da590e19e3f0b942c6442b2d50c9ab1ef65de Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Wed, 16 Oct 2013 12:45:45 +0200 Subject: [PATCH 11/19] [IMP] website: after save reload page with the same scrolling bzr revid: chm@openerp.com-20131016104545-e415ixicw2crci2w --- addons/website/static/src/js/website.editor.js | 2 +- addons/website/static/src/js/website.js | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/addons/website/static/src/js/website.editor.js b/addons/website/static/src/js/website.editor.js index 81fe087a59e..aef390027c5 100644 --- a/addons/website/static/src/js/website.editor.js +++ b/addons/website/static/src/js/website.editor.js @@ -307,7 +307,7 @@ }); }, cancel: function () { - window.location.href = window.location.href.replace(/unable_editor(=[^&]*)?|#.*/g, ''); + website.reload(); }, }); diff --git a/addons/website/static/src/js/website.js b/addons/website/static/src/js/website.js index 1f4e54b43df..963a0b1664d 100644 --- a/addons/website/static/src/js/website.js +++ b/addons/website/static/src/js/website.js @@ -38,7 +38,12 @@ return $.when.apply(null, dones); }; website.reload = function () { - window.location.href = window.location.href.replace(/unable_editor(=[^&]*)?|#.*/g, ''); + location.hash = "scrollTop=" + window.document.body.scrollTop; + if (location.search.indexOf("unable_editor") > -1) { + window.location.href = window.location.href.replace(/unable_editor(=[^&]*)?/g, ''); + } else { + window.location.reload(); + } }; var all_ready = null; @@ -167,6 +172,11 @@ website.init_kanban(this); }); + setTimeout(function () { + if (window.location.hash.indexOf("scrollTop=") > -1) { + window.document.body.scrollTop = +location.hash.match(/scrollTop=([0-9]+)/)[1]; + } + },0); }); return website; From 57c5f11aaeabd86f7bf9a94f33a06d01b82e3a60 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Wed, 16 Oct 2013 14:37:08 +0200 Subject: [PATCH 12/19] [FIX] don't use mutation events if unnecessary Mutation events are synchronous and one is triggered per observed alteration (they're not batched). When doing lots of modifications to the DOM tree, they will add a lot of overhead as (in this case) the event handler will run for *each* added node and it will run during (and slow down) node insertion rather than afterwards. bzr revid: xmo@openerp.com-20131016123708-lx389x0g6xs6zu10 --- addons/website/static/src/js/website.editor.js | 4 ++-- addons/website/static/src/js/website.snippets.js | 15 +++++++++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/addons/website/static/src/js/website.editor.js b/addons/website/static/src/js/website.editor.js index aef390027c5..a1b8ffdb9ee 100644 --- a/addons/website/static/src/js/website.editor.js +++ b/addons/website/static/src/js/website.editor.js @@ -927,7 +927,7 @@ } - var Observer = window.MutationObserver || window.WebkitMutationObserver || window.JsMutationObserver; + website.Observer = window.MutationObserver || window.WebkitMutationObserver || window.JsMutationObserver; var OBSERVER_CONFIG = { childList: true, attributes: true, @@ -935,7 +935,7 @@ subtree: true, attributeOldValue: true, }; - var observer = new Observer(function (mutations) { + var observer = new website.Observer(function (mutations) { // NOTE: Webkit does not fire DOMAttrModified => webkit browsers // relying on JsMutationObserver shim (Chrome < 18, Safari < 6) // will not mark dirty on attribute changes (@class, img/@src, diff --git a/addons/website/static/src/js/website.snippets.js b/addons/website/static/src/js/website.snippets.js index 5f6d8b5073c..17dd829708f 100644 --- a/addons/website/static/src/js/website.snippets.js +++ b/addons/website/static/src/js/website.snippets.js @@ -45,7 +45,14 @@ /* ----- SNIPPET SELECTOR ---- */ website.snippet = {}; - + var observer = new website.Observer(function (mutations) { + if (!_(mutations).find(function (m) { + return m.type === 'childList' && m.addedNodes.length > 0; + })) { + return; + } + hack_to_add_snippet_id() + }); // puts $el at the same absolute position as $target function hack_to_add_snippet_id () { @@ -80,7 +87,11 @@ this.$active_snipped_id = false; hack_to_add_snippet_id(); this.snippets = []; - $("body").on('DOMNodeInserted', hack_to_add_snippet_id); + + observer.observe(document.body, { + childList: true, + subtree: true, + }); }, dom_filter: function (dom, sibling) { if (typeof dom === "string") { From 1625eb29ae716874761626e31e99c493fb90dcdb Mon Sep 17 00:00:00 2001 From: ddm Date: Wed, 16 Oct 2013 16:39:39 +0200 Subject: [PATCH 13/19] [FIX] SEO metadata saving bzr revid: ddm@openerp.com-20131016143939-v0v1tcopq4zoqgxf --- addons/website/static/src/js/website.seo.js | 52 ++++++++++++++----- addons/website/static/src/xml/website.seo.xml | 3 +- 2 files changed, 40 insertions(+), 15 deletions(-) diff --git a/addons/website/static/src/js/website.seo.js b/addons/website/static/src/js/website.seo.js index 0d20253290a..4413f628afa 100644 --- a/addons/website/static/src/js/website.seo.js +++ b/addons/website/static/src/js/website.seo.js @@ -241,7 +241,8 @@ return hashIndex >= 0 ? url.substring(0, hashIndex) : url; }, title: function () { - return ($('title').length > 0) && $('title').text() && $('title').text().trim(); + var $title = $('title'); + return ($title.length > 0) && $title.text() && $title.text().trim(); }, changeTitle: function (title) { // TODO create tag if missing @@ -250,7 +251,7 @@ }, description: function () { var $description = $('meta[name=description]'); - return ($description.length > 0) && $description.attr('value') && $description.attr('value').trim(); + return ($description.length > 0) && ($description.attr('value') && $description.attr('value').trim()); }, changeDescription: function (description) { // TODO create tag if missing @@ -331,13 +332,13 @@ $modal.find('.js_seo_page_url').text(htmlPage.url()); $modal.find('input[name=seo_page_title]').val(htmlPage.title()); $modal.find('textarea[name=seo_page_description]').val(htmlPage.description()); - self.suggestImprovements(); - self.imageList = new website.seo.ImageList(self, { page: htmlPage }); - if (htmlPage.images().length === 0) { - $modal.find('.js_image_section').remove(); - } else { - self.imageList.appendTo($modal.find('.js_seo_image_list')); - } + // self.suggestImprovements(); + // self.imageList = new website.seo.ImageList(self, { page: htmlPage }); + // if (htmlPage.images().length === 0) { + // $modal.find('.js_image_section').remove(); + // } else { + // self.imageList.appendTo($modal.find('.js_seo_image_list')); + // } self.keywordList = new website.seo.KeywordList(self, { page: htmlPage }); self.keywordList.on('list-full', self, function () { $modal.find('input[name=seo_page_keywords]') @@ -356,8 +357,26 @@ self.keywordList.add(word); }); self.keywordList.appendTo($modal.find('.js_seo_keywords_list')); + self.disableUnsavableFields(); $modal.modal(); }, + disableUnsavableFields: function () { + var $modal = this.$el; + this.loadMetaData().then(function (data) { + var canEditTitle = data && ('website_meta_title' in data); + var canEditDescription = data && ('website_meta_description' in data); + var canEditKeywords = data && ('website_meta_keywords' in data); + if (!canEditTitle) { + $modal.find('input[name=seo_page_title]').attr('disabled', true); + } + if (!canEditDescription) { + $modal.find('textarea[name=seo_page_description]').attr('disabled', true); + } + if (!canEditTitle && !canEditDescription && !canEditKeywords) { + $modal.find('button[data-action=update]').attr('disabled', true); + } + }); + }, suggestImprovements: function () { var tips = []; var self = this; @@ -397,11 +416,16 @@ }, update: function () { var self = this; - var data = { - website_meta_title: self.htmlPage.title(), - website_meta_description: self.htmlPage.description(), - website_meta_keywords: self.keywordList.keywords().join(", "), - }; + var data = {}; + if (!this.htmlPage.isTitleEditable()) { + data.website_meta_title = self.htmlPage.title(); + } + if (!this.htmlPage.isDescriptionEditable()) { + data.website_meta_description = self.htmlPage.description(); + } + if (!this.htmlPage.isKeywordsEditable()) { + data.website_meta_keywords = self.keywordList.keywords().join(", "); + } self.saveMetaData(data).then(function () { self.$el.modal('hide'); }); diff --git a/addons/website/static/src/xml/website.seo.xml b/addons/website/static/src/xml/website.seo.xml index 96a38a75d32..580779283ad 100644 --- a/addons/website/static/src/xml/website.seo.xml +++ b/addons/website/static/src/xml/website.seo.xml @@ -48,12 +48,13 @@
    +
    + -->