From d819d494f11d275cdd9ad2a7078ae93d4ef59dc1 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Thu, 6 Feb 2014 14:50:36 +0100 Subject: [IMP] website: add debugger template used to create nex tours/tests (display in customize menu in debug mode) bzr revid: chm@openerp.com-20140206135036-geq8fubtz39pxp20 --- addons/website/static/src/js/website.editor.js | 1 + 1 file changed, 1 insertion(+) (limited to 'addons/website/static/src') diff --git a/addons/website/static/src/js/website.editor.js b/addons/website/static/src/js/website.editor.js index e5ba5018316..e809619a923 100644 --- a/addons/website/static/src/js/website.editor.js +++ b/addons/website/static/src/js/website.editor.js @@ -414,6 +414,7 @@ openerp.jsonRpc('/website/customize_template_get', 'call', { 'xml_id': view_name }).then( function(result) { _.each(result, function (item) { + if (item.xml_id === "website.debugger" && !window.location.search.match(/[&?]debug(&|$)/)) return; if (item.header) { menu.append(''); } else { -- cgit v1.2.3 From 052bcacd5f80e68b3c6fbce31ccc56206eb480bb Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Thu, 6 Feb 2014 15:02:58 +0100 Subject: [FIX] website_sale template; snippet editor bzr revid: chm@openerp.com-20140206140258-l3hriceuksx0c061 --- addons/website/static/src/js/website.snippets.editor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/website/static/src') diff --git a/addons/website/static/src/js/website.snippets.editor.js b/addons/website/static/src/js/website.snippets.editor.js index 8a3e7a4421d..a702344a308 100644 --- a/addons/website/static/src/js/website.snippets.editor.js +++ b/addons/website/static/src/js/website.snippets.editor.js @@ -9,7 +9,7 @@ var self = this; $("[data-oe-model]").on('click', function (event) { var $this = $(event.srcElement); - var tag = $this[0].tagName.toLowerCase(); + var tag = $this[0] && $this[0].tagName.toLowerCase(); if (!(tag === 'a' || tag === "button") && !$this.parents("a, button").length) { self.$('[data-action="edit"]').parent().effect('bounce', {distance: 18, times: 5}, 250); } -- cgit v1.2.3 From 0677fda79ec8e57930762464a958eaf852b1441e Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Thu, 6 Feb 2014 15:06:43 +0100 Subject: [FIX] website tours: fix and translate bzr revid: chm@openerp.com-20140206140643-z3b2fu2v9uaozc1z --- .../website/static/src/js/website.tour.banner.js | 70 +++++++++++----------- 1 file changed, 35 insertions(+), 35 deletions(-) (limited to 'addons/website/static/src') diff --git a/addons/website/static/src/js/website.tour.banner.js b/addons/website/static/src/js/website.tour.banner.js index b079c4a670c..9fe0843f618 100644 --- a/addons/website/static/src/js/website.tour.banner.js +++ b/addons/website/static/src/js/website.tour.banner.js @@ -2,113 +2,113 @@ 'use strict'; var website = openerp.website; + var _t = openerp._t; website.EditorBar.include({ start: function () { - this.registerTour(new website.BannerTour(this)); + this.registerTour(new website.Tour.Banner(this)); return this._super(); }, }); - website.BannerTour = website.Tour.extend({ + website.Tour.Banner = website.Tour.extend({ id: 'banner', name: "Insert a banner", path: '/', - init: function (editor) { + init: function () { var self = this; self.steps = [ { - title: "Welcome to your website!", - content: "This tutorial will guide you to build your home page. We will start by adding a banner.", - template: self.popover({ next: "Start Tutorial", end: "Skip It" }), + title: _t("Welcome to your website!"), + content: _t("This tutorial will guide you to build your home page. We will start by adding a banner."), + template: self.popover({ next: _t("Start Tutorial"), end: _t("Skip It") }), backdrop: true, }, { waitNot: '.popover.tour', element: 'button[data-action=edit]', placement: 'bottom', - title: "Edit this page", - content: "Every page of your website can be modified through the Edit button.", + title: _t("Edit this page"), + content: _t("Every page of your website can be modified through the Edit button."), template: self.popover({ fixed: true }), }, { element: 'button[data-action=snippet]', placement: 'bottom', - title: "Insert building blocks", - content: "To add content in a page, you can insert building blocks.", + title: _t("Insert building blocks"), + content: _t("To add content in a page, you can insert building blocks."), template: self.popover({ fixed: true }), }, { snippet: 'carousel', placement: 'bottom', - title: "Drag & Drop a Banner", - content: "Drag the Banner block and drop it in your page.", + title: _t("Drag & Drop a Banner"), + content: _t("Drag the Banner block and drop it in your page."), template: self.popover({ fixed: true }), }, { waitFor: '.oe_overlay_options .oe_options:visible', element: '#wrap [data-snippet-id=carousel]:first .carousel-caption', - sampleText: 'My Title', placement: 'top', - title: "Customize banner's text", - content: "Click in the text and start editing it. Click continue once it's done.", - template: self.popover({ next: "Continue" }), + title: _t("Customize banner's text"), + content: _t("Click in the text and start editing it. Click continue once it's done."), + template: self.popover({ next: _t("Continue") }), }, { element: '.oe_overlay_options .oe_options', placement: 'left', - title: "Customize the banner", - content: "Customize any block through this menu. Try to change the background of the banner.", - template: self.popover({ next: "Continue" }), + title: _t("Customize the banner"), + content: _t("Customize any block through this menu. Try to change the background of the banner."), + template: self.popover({ next: _t("Continue") }), }, { waitNot: '.popover.tour', element: 'button[data-action=snippet]', placement: 'bottom', - title: "Add Another Block", - content: "Let's add another building block to your page.", + title: _t("Add Another Block"), + content: _t("Let's add another building block to your page."), template: self.popover({ fixed: true }), }, { snippet: 'three-columns', placement: 'bottom', - title: "Drag & Drop a Block", - content: "Drag the '3 Columns' block and drop it below the banner.", + title: _t("Drag & Drop a Block"), + content: _t("Drag the '3 Columns' block and drop it below the banner."), template: self.popover({ fixed: true }), }, { waitFor: '.oe_overlay_options .oe_options:visible', element: 'button[data-action=save]', placement: 'right', - title: "Save your modifications", - content: "Publish your page by clicking on the 'Save' button.", + title: _t("Save your modifications"), + content: _t("Publish your page by clicking on the 'Save' button."), template: self.popover({ fixed: true }), }, { waitFor: 'button[data-action=edit]:visible', - title: "Congratulation!", - content: "Your homepage has been updated.", - template: self.popover({ next: "Continue" }), + title: _t("Congratulation!"), + content: _t("Your homepage has been updated."), + template: self.popover({ next: _t("Continue") }), }, { waitNot: '.popover.tour', element: 'a[data-action=show-mobile-preview]', placement: 'bottom', - title: "Test Your Mobile Version", - content: "Let's check how your homepage looks like on mobile devices.", + title: _t("Test Your Mobile Version"), + content: _t("Let's check how your homepage looks like on mobile devices."), template: self.popover({ fixed: true }), }, { element: 'button[data-dismiss=modal]', placement: 'right', - title: "Close Mobile Preview", - content: "Scroll in the mobile preview to test the rendering. Once it's ok, close this dialog.", + title: _t("Close Mobile Preview"), + content: _t("Scroll in the mobile preview to test the rendering. Once it's ok, close this dialog."), }, { waitNot: '.modal', - title: "Congrats", - content: "Congratulation. This tour is finished.", - template: self.popover({ fixed: true, next: "Close Tutorial" }), + title: _t("Congrats"), + content: _t("Congratulation. This tour is finished."), + template: self.popover({ fixed: true, next: _t("Close Tutorial") }), }, ]; return this._super(); -- cgit v1.2.3 From e8964f896c4b23b0b8c1a5722f4576c5a7201bcc Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Thu, 6 Feb 2014 15:07:46 +0100 Subject: [FIX] website: tour, test and test_runner bzr revid: chm@openerp.com-20140206140746-jmeyx8q9qxv7sz1j --- addons/website/static/src/js/website.tests.js | 40 -------- addons/website/static/src/js/website.tour.js | 109 +++++++++++----------- addons/website/static/src/js/website.tour.test.js | 27 ++++++ 3 files changed, 84 insertions(+), 92 deletions(-) delete mode 100644 addons/website/static/src/js/website.tests.js create mode 100644 addons/website/static/src/js/website.tour.test.js (limited to 'addons/website/static/src') diff --git a/addons/website/static/src/js/website.tests.js b/addons/website/static/src/js/website.tests.js deleted file mode 100644 index 977dc8e1848..00000000000 --- a/addons/website/static/src/js/website.tests.js +++ /dev/null @@ -1,40 +0,0 @@ -var tests = {}; -var droptest = function () { - var errors = []; - for (var snippet_id in tests) { - if (!tests[snippet_id]['activated'] || !tests[snippet_id]['dropped']){ - console.log("Can't dropped or activated snippet: " + snippet_id); - } - } - if (errors.length) { - console.log(tests); - throw new Error("Can't dropped or activated at least one snippet"); - } - $("#oe_snippets").off('snippet-activated snippet-dropped'); -}; -var droptesttime = setTimeout(droptest,0); - -$("#oe_snippets").off('snippet-activated snippet-dropped') - .on('snippet-activated', function (event, dom) { - tests[$(dom).data('src-snippet-id')]['activated'] = true; - clearTimeout(droptesttime); - droptesttime = setTimeout(droptest,0); - }) - .on('snippet-dropped', function (event, dom, src_snipped_id) { - tests[$(dom).data('src-snippet-id')]['dropped'] = true; - clearTimeout(droptesttime); - droptesttime = setTimeout(droptest,0); - }); -var $thumbnails = $('#oe_snippets div.oe_snippet[data-snippet-id] .oe_snippet_thumbnail'); -$thumbnails.each(function () { - var $thumbnail = $(this); - tests[$thumbnail.parent().data('snippet-id')] = {}; - var position = $thumbnail.position(); - $thumbnail.trigger( $.Event( "mousedown", { which: 1, pageX: position.left, pageY: position.top } ) ); - $thumbnail.trigger( $.Event( "mousemove", { which: 1, pageX: position.left+100, pageY: position.top+100 } ) ); - $first_drop = $(".oe_drop_zone").first(); - position = $first_drop.position(); - $first_drop.trigger( $.Event( "mouseup", { which: 1, pageX: position.left+20, pageY: position.top+20 } ) ); - clearTimeout(droptesttime); - droptesttime = setTimeout(droptest,0); -}); diff --git a/addons/website/static/src/js/website.tour.js b/addons/website/static/src/js/website.tour.js index 1db813e4cd4..4285656e39a 100644 --- a/addons/website/static/src/js/website.tour.js +++ b/addons/website/static/src/js/website.tour.js @@ -4,6 +4,7 @@ var website = openerp.website; website.add_template_file('/website/static/src/xml/website.tour.xml'); +if (website.EditorBar) website.EditorBar.include({ tours: [], start: function () { @@ -17,31 +18,11 @@ website.EditorBar.include({ }); menu.append($menuItem); }); - - this.waitRTEReady = false; - this.on('rte:called', this, function () {self.waitRTEReady = true; }); - this.on('rte:ready', this, function () {self.waitRTEReady = false;}); - - var res = this._super(); - website.Tour.waitReady.call(this, this.testRunning); - return res; + return this._super(); }, registerTour: function (tour) { website.Tour.add(tour); this.tours.push(tour); - }, - testRunning: function () { - if (this.waitRTEReady) { - this.on('rte:ready', this, function () { - website.Tour.each(function () { - this.running(); - }); - }); - } else { - website.Tour.each(function () { - this.running(); - }); - } } }); @@ -78,23 +59,12 @@ $.ajaxSetup({ } }); - website.Tour = openerp.Class.extend({ steps: [], defaultDelay: 50, //ms + defaultOverLaps: 5000, //ms localStorage: window.localStorage, - init: function (url) { - this.tour = new Tour({ - name: this.id, - storage: this.tourStorage, - keyboard: false, - template: this.popover(), - onHide: function () { - window.scrollTo(0, 0); - } - }); - this.registerSteps(); - }, + init: function () {}, run: function (automatic) { this.reset(); @@ -143,14 +113,11 @@ website.Tour = openerp.Class.extend({ }, _running: function () { var stepId = this.localStorage.getItem("tour-"+this.id+"-test"); - var automatic = !!this.localStorage.getItem("tour-"+this.id+"-test-automatic"); - + if (stepId != null) { - if (!this.check(this.step(stepId))) { - var step = this.next(stepId); - stepId = step ? step.stepId : stepId; - } - this.nextStep(stepId, automatic ? this.autoNextStep : null, automatic ? 5000 : null); + this.automatic = !!this.localStorage.getItem("tour-"+this.id+"-test-automatic"); + this.registerTour(); + this.nextStep(stepId, this.automatic ? this.autoNextStep : null, this.automatic ? this.defaultOverLaps : null); } }, @@ -187,6 +154,18 @@ website.Tour = openerp.Class.extend({ } }, + registerTour: function () { + this.tour = new Tour({ + name: this.id, + storage: this.tourStorage, + keyboard: false, + template: this.popover(), + onHide: function () { + window.scrollTo(0, 0); + } + }); + this.registerSteps(); + }, registerSteps: function () { for (var index=0, len=this.steps.length; index Date: Fri, 7 Feb 2014 08:47:45 +0100 Subject: [IMP] website test: add a timeout in phantom js to raise a better error and improve log error bzr revid: chm@openerp.com-20140207074745-ffrcoi2aj5m67i8m --- addons/website/static/src/js/website.tour.js | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'addons/website/static/src') diff --git a/addons/website/static/src/js/website.tour.js b/addons/website/static/src/js/website.tour.js index 4285656e39a..25d8ac89a12 100644 --- a/addons/website/static/src/js/website.tour.js +++ b/addons/website/static/src/js/website.tour.js @@ -75,9 +75,8 @@ website.Tour = openerp.Class.extend({ website.Tour.busy = true; - if (automatic) { - this.localStorage.setItem("tour-"+this.id+"-test-automatic", true); - } + this.localStorage.setItem("tour-"+this.id+"-test-automatic", automatic); + this.automatic = automatic; if (this.path) { // redirect to begin of the tour in function of the language @@ -93,12 +92,13 @@ website.Tour = openerp.Class.extend({ website.Tour.waitReady.call(this, function () {self._running();}); }, running: function () { + var self = this; if (+this.localStorage.getItem("tour-"+this.id+"-test") >= this.steps.length-1) { this.endTour(); return; } - if (website.Tour.is_busy() || !this.testPathUrl()) return; + if (website.Tour.is_busy()) return; // launch tour with url this.checkRunningUrl(); @@ -106,6 +106,21 @@ website.Tour = openerp.Class.extend({ // mark tour as busy (only one test running) if (this.localStorage.getItem("tour-"+this.id+"-test") != null) { website.Tour.busy = true; + this.automatic = !!this.localStorage.getItem("tour-"+this.id+"-test-automatic"); + } + + if (!this.testPathUrl()) { + if (this.automatic) { + this.timer = setTimeout(function () { + self.reset(); + throw new Error("Wrong url for running " + self.id + + '\ntestPath: ' + self.testPath + + '\nhref: ' + window.location.href + + "\nreferrer: " + document.referrer + ); + },this.defaultOverLaps); + } + return; } var self = this; @@ -115,7 +130,6 @@ website.Tour = openerp.Class.extend({ var stepId = this.localStorage.getItem("tour-"+this.id+"-test"); if (stepId != null) { - this.automatic = !!this.localStorage.getItem("tour-"+this.id+"-test-automatic"); this.registerTour(); this.nextStep(stepId, this.automatic ? this.autoNextStep : null, this.automatic ? this.defaultOverLaps : null); } -- cgit v1.2.3 From 8879fb17288c0ab902cb4c106dbabe430ab55d6f Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Fri, 7 Feb 2014 11:07:34 +0100 Subject: [FIX] website snippet: reset snippet-editor and overlay because the rte re-generate the dom and cancelled all snippet datas bzr revid: chm@openerp.com-20140207100734-pdzr0qz8mtmha96m --- addons/website/static/src/js/website.snippets.editor.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'addons/website/static/src') diff --git a/addons/website/static/src/js/website.snippets.editor.js b/addons/website/static/src/js/website.snippets.editor.js index 8a3e7a4421d..7965c4b88f0 100644 --- a/addons/website/static/src/js/website.snippets.editor.js +++ b/addons/website/static/src/js/website.snippets.editor.js @@ -416,6 +416,19 @@ } setTimeout(function () { $("#oe_snippets").trigger('snippet-dropped', $target); + + // reset snippet for rte + $target.removeData("snippet-editor"); + $target.removeData("overlay"); + self.create_overlay($target); + $target.find("[data-snippet-id]").each(function () { + var $snippet = $(this); + $snippet.removeData("snippet-editor"); + $snippet.removeData("overlay"); + self.create_overlay($snippet); + }); + // end + self.make_active($target); },0); } else { -- cgit v1.2.3 From b21bb08c22680b12c6ae6f6b82dc04ca87f60594 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Fri, 7 Feb 2014 13:52:31 +0100 Subject: [ADD] website: test login, backend, go back, branding, edit, logout bzr revid: chm@openerp.com-20140207125231-3zd0i1axdwuht5g4 --- .../static/src/js/website.tour.test.admin.js | 106 +++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 addons/website/static/src/js/website.tour.test.admin.js (limited to 'addons/website/static/src') diff --git a/addons/website/static/src/js/website.tour.test.admin.js b/addons/website/static/src/js/website.tour.test.admin.js new file mode 100644 index 00000000000..81078185a35 --- /dev/null +++ b/addons/website/static/src/js/website.tour.test.admin.js @@ -0,0 +1,106 @@ +(function () { + 'use strict'; + + var website = openerp.website; + + website.Tour.LoginEdit = website.Tour.extend({ + id: 'login_edit', + name: "Try to log as admin and check editor", + path: '/', + init: function () { + var self = this; + self.steps = [ + { + title: "click login", + element: '#top_menu a[href*="/web/login"]', + }, + { + title: "insert login", + element: '.oe_login_form input[name="login"]', + sampleText: typeof user !== "undefined" ? user : "admin", + }, + { + title: "insert password", + waitFor: '.oe_login_form input[name="login"][value!=""]', + element: '.oe_login_form input[name="password"]', + sampleText: typeof password !== "undefined" ? password : "admin", + }, + { + title: "select 2 Standard tickets", + waitFor: '.oe_login_form input[name="password"][value!=""]', + element: '.oe_login_form button', + }, + { + title: "go back to website from backend", + element: 'a[data-action-model="ir.actions.act_url"]:contains("Website")', + }, + { + title: 'try to edit', + waitNot: '#wrap .carousel', + element: 'button[data-action=edit]:visible', + }, + { + title: 'check edit mode', + waitFor: 'button[data-action=save]:visible', + }, + { + title: 'check branding', + waitFor: '#wrap[data-oe-model="ir.ui.view"]', + }, + { + title: 'check rte', + waitFor: '#oe_rte_toolbar', + }, + { + title: 'check insert block button', + element: '[data-action="snippet"]:visible', + }, + { + title: 'add snippets', + snippet: 'carousel', + }, + { + title: 'try to save', + waitFor: '.oe_overlay_options .oe_options:visible', + element: 'button[data-action=save]:visible', + }, + { + title: 'check saved', + waitFor: '#wrap div.carousel', + element: 'button[data-action=edit]:visible', + }, + { + title: 'try to re-edit', + waitFor: 'button[data-action=save]:visible', + element: '#wrap .carousel', + }, + { + title: 'remove snippet', + element: '.oe_snippet_remove', + }, + { + title: 'try to re-save', + waitNot: '#wrap .carousel', + element: 'button[data-action=save]:visible', + }, + { + title: "click admin", + waitFor: 'button[data-action=edit]:visible', + element: 'a:contains("Administrator")', + }, + { + title: "click logout", + element: '#top_menu a[href*="/logout"]', + }, + { + title: "check logout", + waitFor: '#top_menu a[href*="/web/login"]', + }, + ]; + return this._super(); + }, + }); + // for test without editor bar + website.Tour.add(website.Tour.LoginEdit); + +}()); -- cgit v1.2.3 From 6cb5b1e556f5a97e2caa45fdc1f6ad605bc028a5 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Fri, 7 Feb 2014 14:01:04 +0100 Subject: [FIX] website: test tour: use admin insead of tools.config['admin_passwd'] bzr revid: chm@openerp.com-20140207130104-nuwurzlsvt4cu1jr --- addons/website/static/src/js/website.tour.test.admin.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'addons/website/static/src') diff --git a/addons/website/static/src/js/website.tour.test.admin.js b/addons/website/static/src/js/website.tour.test.admin.js index 81078185a35..787f05beb23 100644 --- a/addons/website/static/src/js/website.tour.test.admin.js +++ b/addons/website/static/src/js/website.tour.test.admin.js @@ -17,13 +17,13 @@ { title: "insert login", element: '.oe_login_form input[name="login"]', - sampleText: typeof user !== "undefined" ? user : "admin", + sampleText: "admin", }, { title: "insert password", waitFor: '.oe_login_form input[name="login"][value!=""]', element: '.oe_login_form input[name="password"]', - sampleText: typeof password !== "undefined" ? password : "admin", + sampleText: "admin", }, { title: "select 2 Standard tickets", -- cgit v1.2.3 From 76841f14e4ae1e56516d680bca09b41381d3ee75 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Fri, 7 Feb 2014 14:37:12 +0100 Subject: [FIX] website: snippet: display baner in mobile view; background cover insead of 100%; paralax scrolling bzr revid: chm@openerp.com-20140207133712-srtik2knhwyybgse --- addons/website/static/src/css/website.css | 15 ++++++++------- addons/website/static/src/css/website.sass | 14 ++++++++------ .../website/static/src/js/website.snippets.animation.js | 2 +- 3 files changed, 17 insertions(+), 14 deletions(-) (limited to 'addons/website/static/src') diff --git a/addons/website/static/src/css/website.css b/addons/website/static/src/css/website.css index 6610a98d0f1..291051a0986 100644 --- a/addons/website/static/src/css/website.css +++ b/addons/website/static/src/css/website.css @@ -1,3 +1,4 @@ +@charset "utf-8"; /* THIS CSS FILE IS FOR WEBSITE THEMING CUSTOMIZATION ONLY * * css for editor buttons, openerp widget included in the website and other @@ -281,12 +282,16 @@ ul.nav-stacked > li > a { } /* ---- SNIPPETS --- */ +.oe_img_bg { + background-size: 100%; +} + [data-snippet-id], .colmd, .hr, .blockquote { overflow: hidden; } @media (max-width: 400px) { - [data-snippet-id] { + [data-snippet-id]:not([data-snippet-id="carousel"]) { height: auto !important; } } @@ -295,7 +300,7 @@ ul.nav-stacked > li > a { } .carousel-inner .item { height: 100%; - background-size: 100%; + background-size: cover; } .carousel .carousel-caption { @@ -365,7 +370,7 @@ div.carousel[data-snippet-id="slider"] .carousel-indicators .active { .parallax { position: relative; - background-size: 100%; + background-size: cover; display: table; width: 100%; min-height: 100px; @@ -445,10 +450,6 @@ div.carousel[data-snippet-id="slider"] .carousel-indicators .active { } /* Misc */ -.oe_img_bg { - background-size: 100%; -} - .texttop { vertical-align: top; } diff --git a/addons/website/static/src/css/website.sass b/addons/website/static/src/css/website.sass index 2c5f691fae6..f4c0b338b6a 100644 --- a/addons/website/static/src/css/website.sass +++ b/addons/website/static/src/css/website.sass @@ -228,19 +228,24 @@ ul.nav-stacked > li > a a color: white + /* ---- SNIPPETS --- */ + +.oe_img_bg + background-size: 100% + [data-snippet-id],.colmd,.hr,.blockquote overflow: hidden @media (max-width: 400px) - [data-snippet-id] + [data-snippet-id]:not([data-snippet-id="carousel"]) height: auto !important .carousel-inner height: 100% .item height: 100% - background-size: 100% + background-size: cover .carousel .carousel-caption left: auto @@ -300,7 +305,7 @@ div.carousel[data-snippet-id="slider"] .parallax position: relative - background-size: 100% + background-size: cover display: table width: 100% min-height: 100px @@ -362,9 +367,6 @@ div.carousel[data-snippet-id="slider"] /* Misc */ -.oe_img_bg - background-size: 100% - .texttop vertical-align: top diff --git a/addons/website/static/src/js/website.snippets.animation.js b/addons/website/static/src/js/website.snippets.animation.js index 60c5aea49e2..048cf20231f 100644 --- a/addons/website/static/src/js/website.snippets.animation.js +++ b/addons/website/static/src/js/website.snippets.animation.js @@ -105,7 +105,7 @@ var offset = 0; var padding = parseInt($(document.body).css("padding-top")); if (speed < 1) { - var inner_offset = self.$target.outerHeight() - this.height / this.width * document.body.clientWidth; + var inner_offset = - self.$target.outerHeight() + this.height / this.width * document.body.clientWidth; var outer_offset = self.$target.offset().top - (document.body.clientHeight - self.$target.outerHeight()) - padding; offset = - outer_offset * speed + inner_offset; } else { -- cgit v1.2.3 From 25117ffd0b964ea58ce3c1c1f2a0467c4d14b16a Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Fri, 7 Feb 2014 14:45:48 +0100 Subject: [FIX] tour test log error bzr revid: chm@openerp.com-20140207134548-lr2563gtlgjphxrp --- addons/website/static/src/js/website.tour.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/website/static/src') diff --git a/addons/website/static/src/js/website.tour.test.js b/addons/website/static/src/js/website.tour.test.js index b98adb98b27..4fc9f1fe213 100644 --- a/addons/website/static/src/js/website.tour.test.js +++ b/addons/website/static/src/js/website.tour.test.js @@ -13,7 +13,7 @@ if (typeof Tour === "undefined") { } for (var i in scripts) { if (typeof jQuery === "undefined") { - throw new Error("jQuery not found.\nhref: " + window.location.href + "\n\n" + document.body.innerHTML); + throw new Error("jQuery not found.\nhref: " + window.location.href + (document && document.body ? "\n\n" + document.body.innerHTML : "")); } jQuery.ajax({ async: false, -- cgit v1.2.3 From f767f6ca4722313bdff194de023db559156865d7 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Fri, 7 Feb 2014 15:34:37 +0100 Subject: [FIX] website tour test: import with ajax insead of jquery (and auto load jquery) bzr revid: chm@openerp.com-20140207143437-uptdehmpegzze61y --- addons/website/static/src/js/website.tour.test.js | 47 +++++++++++++---------- 1 file changed, 26 insertions(+), 21 deletions(-) (limited to 'addons/website/static/src') diff --git a/addons/website/static/src/js/website.tour.test.js b/addons/website/static/src/js/website.tour.test.js index 4fc9f1fe213..ce2cc721a82 100644 --- a/addons/website/static/src/js/website.tour.test.js +++ b/addons/website/static/src/js/website.tour.test.js @@ -1,27 +1,32 @@ (function () { -var scripts = []; + +function LoadScript(src) { + xmlHttp = new XMLHttpRequest(); + xmlHttp.onreadystatechange = function() { + if(xmlHttp.readyState == 4) { + if (xmlHttp.status == 200 || xmlHttp.status == 304) { + new Function(xmlHttp.responseText)(); + } else { + throw new Error("Can't load JavaScript.\nhref: " + window.location.href + "\nsrc: " + src); + } + } + }; + xmlHttp.open("GET", src, false); + xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); + xmlHttp.send(null); +} + +if (typeof jQuery === "undefined") + LoadScript("/web/static/lib/jquery/jquery.js"); if (typeof openerp === "undefined") { - scripts.push("/web/static/lib/qweb/qweb2.js"); - scripts.push("/web/static/lib/qweb/openerpframework.js"); + LoadScript("/web/static/lib/qweb/qweb2.js"); + LoadScript("/web/static/lib/qweb/openerpframework.js"); } if (typeof openerp === "undefined" || !openerp.website || !openerp.website.add_template_file) - scripts.push("/website/static/src/js/website.js"); + LoadScript("/website/static/src/js/website.js"); if (typeof openerp === "undefined" || !openerp.website.Tour) - scripts.push("/website/static/src/js/website.tour.js"); -if (typeof Tour === "undefined") { - scripts.push("/website/static/lib/bootstrap-tour/bootstrap-tour.js"); -} -for (var i in scripts) { - if (typeof jQuery === "undefined") { - throw new Error("jQuery not found.\nhref: " + window.location.href + (document && document.body ? "\n\n" + document.body.innerHTML : "")); - } - jQuery.ajax({ - async: false, - type: 'GET', - data: null, - url: scripts[i], - dataType: "script", - error: function (a,b,e) {throw e;} - }); -} + LoadScript("/website/static/src/js/website.tour.js"); +if (typeof Tour === "undefined") + LoadScript("/website/static/lib/bootstrap-tour/bootstrap-tour.js"); + })(); \ No newline at end of file -- cgit v1.2.3 From 6900662b540f4e92842e4473e177510224f2620f Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Fri, 7 Feb 2014 15:51:49 +0100 Subject: [FIX] page creation broken because what is grep bzr revid: xmo@openerp.com-20140207145149-fem1wnr0t10rcgsn --- addons/website/static/src/js/website.editor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/website/static/src') diff --git a/addons/website/static/src/js/website.editor.js b/addons/website/static/src/js/website.editor.js index e5ba5018316..fab9dbcc4a7 100644 --- a/addons/website/static/src/js/website.editor.js +++ b/addons/website/static/src/js/website.editor.js @@ -1082,7 +1082,7 @@ } else { // Create the page, get the URL back done = $.get(_.str.sprintf( - '/pagenew/%s?noredirect=1', encodeURI(data.id))) + '/website/add/%s?noredirect=1', encodeURI(data.id))) .then(function (response) { self.make_link(response, false, data.id); }); -- cgit v1.2.3 From 6d7eccf10ab732b539ed44566d8679189b5d2561 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Fri, 7 Feb 2014 16:45:20 +0100 Subject: [FIX] website snippet drop for rte; remove dependence to qweb template (remove popover from tours); fx import file with ajax bzr revid: chm@openerp.com-20140207154520-2injapzg9lgrdbvc --- .../static/src/js/website.snippets.editor.js | 10 ++++++-- .../website/static/src/js/website.tour.banner.js | 29 +++++++++++----------- addons/website/static/src/js/website.tour.js | 16 ++++++++---- addons/website/static/src/js/website.tour.test.js | 8 +++--- 4 files changed, 38 insertions(+), 25 deletions(-) (limited to 'addons/website/static/src') diff --git a/addons/website/static/src/js/website.snippets.editor.js b/addons/website/static/src/js/website.snippets.editor.js index 28dab725792..e45bee9685b 100644 --- a/addons/website/static/src/js/website.snippets.editor.js +++ b/addons/website/static/src/js/website.snippets.editor.js @@ -419,12 +419,18 @@ // reset snippet for rte $target.removeData("snippet-editor"); - $target.removeData("overlay"); + if ($target.data("overlay")) { + $target.data("overlay").remove(); + $target.removeData("overlay"); + } self.create_overlay($target); $target.find("[data-snippet-id]").each(function () { var $snippet = $(this); $snippet.removeData("snippet-editor"); - $snippet.removeData("overlay"); + if ($snippet.data("overlay")) { + $snippet.data("overlay").remove(); + $snippet.removeData("overlay"); + } self.create_overlay($snippet); }); // end diff --git a/addons/website/static/src/js/website.tour.banner.js b/addons/website/static/src/js/website.tour.banner.js index 9fe0843f618..c5b04091b40 100644 --- a/addons/website/static/src/js/website.tour.banner.js +++ b/addons/website/static/src/js/website.tour.banner.js @@ -19,10 +19,9 @@ var self = this; self.steps = [ { - title: _t("Welcome to your website!"), - content: _t("This tutorial will guide you to build your home page. We will start by adding a banner."), - template: self.popover({ next: _t("Start Tutorial"), end: _t("Skip It") }), - backdrop: true, + title: _t("Welcome to your website!"), + content: _t("This tutorial will guide you to build your home page. We will start by adding a banner."), + popover: { next: _t("Start Tutorial"), end: _t("Skip It") }, }, { waitNot: '.popover.tour', @@ -30,21 +29,21 @@ placement: 'bottom', title: _t("Edit this page"), content: _t("Every page of your website can be modified through the Edit button."), - template: self.popover({ fixed: true }), + popover: { fixed: true }, }, { element: 'button[data-action=snippet]', placement: 'bottom', title: _t("Insert building blocks"), content: _t("To add content in a page, you can insert building blocks."), - template: self.popover({ fixed: true }), + popover: { fixed: true }, }, { snippet: 'carousel', placement: 'bottom', title: _t("Drag & Drop a Banner"), content: _t("Drag the Banner block and drop it in your page."), - template: self.popover({ fixed: true }), + popover: { fixed: true }, }, { waitFor: '.oe_overlay_options .oe_options:visible', @@ -52,14 +51,14 @@ placement: 'top', title: _t("Customize banner's text"), content: _t("Click in the text and start editing it. Click continue once it's done."), - template: self.popover({ next: _t("Continue") }), + popover: { next: _t("Continue") }, }, { element: '.oe_overlay_options .oe_options', placement: 'left', title: _t("Customize the banner"), content: _t("Customize any block through this menu. Try to change the background of the banner."), - template: self.popover({ next: _t("Continue") }), + popover: { next: _t("Continue") }, }, { waitNot: '.popover.tour', @@ -67,14 +66,14 @@ placement: 'bottom', title: _t("Add Another Block"), content: _t("Let's add another building block to your page."), - template: self.popover({ fixed: true }), + popover: { fixed: true }, }, { snippet: 'three-columns', placement: 'bottom', title: _t("Drag & Drop a Block"), content: _t("Drag the '3 Columns' block and drop it below the banner."), - template: self.popover({ fixed: true }), + popover: { fixed: true }, }, { waitFor: '.oe_overlay_options .oe_options:visible', @@ -82,13 +81,13 @@ placement: 'right', title: _t("Save your modifications"), content: _t("Publish your page by clicking on the 'Save' button."), - template: self.popover({ fixed: true }), + popover: { fixed: true }, }, { waitFor: 'button[data-action=edit]:visible', title: _t("Congratulation!"), content: _t("Your homepage has been updated."), - template: self.popover({ next: _t("Continue") }), + popover: { next: _t("Continue") }, }, { waitNot: '.popover.tour', @@ -96,7 +95,7 @@ placement: 'bottom', title: _t("Test Your Mobile Version"), content: _t("Let's check how your homepage looks like on mobile devices."), - template: self.popover({ fixed: true }), + popover: { fixed: true }, }, { element: 'button[data-dismiss=modal]', @@ -108,7 +107,7 @@ waitNot: '.modal', title: _t("Congrats"), content: _t("Congratulation. This tour is finished."), - template: self.popover({ fixed: true, next: _t("Close Tutorial") }), + popover: { fixed: true, next: _t("Close Tutorial") }, }, ]; return this._super(); diff --git a/addons/website/static/src/js/website.tour.js b/addons/website/static/src/js/website.tour.js index 25d8ac89a12..408a4c01539 100644 --- a/addons/website/static/src/js/website.tour.js +++ b/addons/website/static/src/js/website.tour.js @@ -2,6 +2,8 @@ 'use strict'; var website = openerp.website; + +if (typeof QWeb2 !== "undefined") website.add_template_file('/website/static/src/xml/website.tour.xml'); if (website.EditorBar) @@ -185,8 +187,9 @@ website.Tour = openerp.Class.extend({ var step = this.steps[index]; step.stepId = step.stepId || ""+index; - if (!step.waitNot && index > 0 && $(this.steps[index-1].template).has("button[data-role='next']").size()) { - step.waitNot = '.popover.tour'; + if (!step.waitNot && index > 0 && this.steps[index-1] && + this.steps[index-1].popover && this.steps[index-1].popover.next) { + step.waitNot = '.popover.tour:visible'; } if (!step.waitFor && index > 0 && this.steps[index-1].snippet) { step.waitFor = '.oe_overlay_options .oe_options:visible'; @@ -194,6 +197,8 @@ website.Tour = openerp.Class.extend({ step._title = step._title || step.title; step.title = this.popoverTitle({ title: step._title }); + step.template = step.template || this.popover( step.popover ); + if (!step.element) step.orphan = true; if (step.snippet) { step.element = '#oe_snippets div.oe_snippet[data-snippet-id="'+step.snippet+'"] .oe_snippet_thumbnail'; @@ -201,9 +206,10 @@ website.Tour = openerp.Class.extend({ } - if ($(this.steps[index-1].template).has("button[data-role='next']").size()) { + if (this.steps[index-1] && + this.steps[index-1].popover && this.steps[index-1].popover.next) { var step = { - stepId: index, + stepId: ""+index, waitNot: '.popover.tour:visible' }; this.steps.push(step); @@ -437,7 +443,7 @@ website.Tour.each = function (callback) { website.Tour.waitReady = function (callback) { var self = this; $(document).ready(function () { - if ($.ajaxBusy == null || $.ajaxBusy) { + if ($.ajaxBusy) { $(document).ajaxStop(function() { setTimeout(function () { callback.call(self); diff --git a/addons/website/static/src/js/website.tour.test.js b/addons/website/static/src/js/website.tour.test.js index ce2cc721a82..3e85ce20dae 100644 --- a/addons/website/static/src/js/website.tour.test.js +++ b/addons/website/static/src/js/website.tour.test.js @@ -18,15 +18,17 @@ function LoadScript(src) { if (typeof jQuery === "undefined") LoadScript("/web/static/lib/jquery/jquery.js"); +if (typeof _ === "undefined") + LoadScript("/web/static/lib/underscore/underscore.js"); if (typeof openerp === "undefined") { LoadScript("/web/static/lib/qweb/qweb2.js"); - LoadScript("/web/static/lib/qweb/openerpframework.js"); + LoadScript("/web/static/src/js/openerpframework.js"); } if (typeof openerp === "undefined" || !openerp.website || !openerp.website.add_template_file) LoadScript("/website/static/src/js/website.js"); -if (typeof openerp === "undefined" || !openerp.website.Tour) - LoadScript("/website/static/src/js/website.tour.js"); if (typeof Tour === "undefined") LoadScript("/website/static/lib/bootstrap-tour/bootstrap-tour.js"); +if (typeof openerp === "undefined" || !openerp.website.Tour) + LoadScript("/website/static/src/js/website.tour.js"); })(); \ No newline at end of file -- cgit v1.2.3