diff options
| author | ajay javiya (OpenERP) <aja@tinyerp.com> | 2014-03-26 11:18:41 +0530 |
|---|---|---|
| committer | ajay javiya (OpenERP) <aja@tinyerp.com> | 2014-03-26 11:18:41 +0530 |
| commit | 864892d6cee4bfe1971ca7cb1c5544dfa5e6e8ca (patch) | |
| tree | 2be542aa35ec5405e3046e6ddddb886dfbc8f238 /addons/website/static/src | |
| parent | 52e527c51889a9df22be47f6add712cff8959c95 (diff) | |
| parent | 0d4d9af5f4b7ca695e33af370848350b437c132e (diff) | |
[MERGE] : with trunk
bzr revid: aja@tinyerp.com-20140326054841-9yoaub8fw058vjkm
Diffstat (limited to 'addons/website/static/src')
| -rw-r--r-- | addons/website/static/src/js/website.editor.newpage.js | 2 | ||||
| -rw-r--r-- | addons/website/static/src/js/website.js | 3 | ||||
| -rw-r--r-- | addons/website/static/src/js/website.mobile.js | 4 | ||||
| -rw-r--r-- | addons/website/static/src/js/website.tour.js | 74 |
4 files changed, 53 insertions, 30 deletions
diff --git a/addons/website/static/src/js/website.editor.newpage.js b/addons/website/static/src/js/website.editor.newpage.js index b475223ecd9..77a086790fa 100644 --- a/addons/website/static/src/js/website.editor.newpage.js +++ b/addons/website/static/src/js/website.editor.newpage.js @@ -48,7 +48,7 @@ } }).then(function (val, field, $dialog) { if (val) { - var url = '/website/add/' + encodeURI(val); + var url = '/website/add' + encodeURI(val); if ($dialog.find('input[type="checkbox"]').is(':checked')) url +="?add_menu=1"; document.location = url; } diff --git a/addons/website/static/src/js/website.js b/addons/website/static/src/js/website.js index 065928df1cf..31e39b3bbc4 100644 --- a/addons/website/static/src/js/website.js +++ b/addons/website/static/src/js/website.js @@ -53,6 +53,7 @@ /* ---------------------------------------------------- Widgets ---------------------------------------------------- */ + website.prompt = function (options) { /** * A bootstrapped version of prompt() albeit asynchronous @@ -198,7 +199,7 @@ var page = +$a.attr("href").split(",").pop().split('-')[1]; data['page'] = page; - $.post('/website/kanban/', data, function (col) { + $.post('/website/kanban', data, function (col) { $col.find("> .thumbnail").remove(); $pagination.last().before(col); }); diff --git a/addons/website/static/src/js/website.mobile.js b/addons/website/static/src/js/website.mobile.js index 59c2328e09b..88a558f5094 100644 --- a/addons/website/static/src/js/website.mobile.js +++ b/addons/website/static/src/js/website.mobile.js @@ -18,9 +18,9 @@ }, start: function () { if (!window.location.origin) { // fix for ie9 - window.location.origin = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port: '') + '/'; + window.location.origin = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port: ''); } - document.getElementById("mobile-viewport").src = window.location.origin + window.location.pathname + "#mobile-preview"; + document.getElementById("mobile-viewport").src = window.location.origin + (window.location.pathname.length ? '/' : '') + window.location.pathname + "#mobile-preview"; this.$el.modal(); }, destroy: function () { diff --git a/addons/website/static/src/js/website.tour.js b/addons/website/static/src/js/website.tour.js index 61b8f851339..b7e55fe166b 100644 --- a/addons/website/static/src/js/website.tour.js +++ b/addons/website/static/src/js/website.tour.js @@ -1,11 +1,30 @@ (function () { 'use strict'; -var website = openerp.website; +// raise an error in test mode if openerp don't exist +if (typeof openerp === "undefined") { + var error = "openerp is undefined" + + "\nhref: " + window.location.href + + "\nreferrer: " + document.referrer + + "\nlocalStorage: " + JSON.stringify(window.localStorage); + if (typeof $ !== "undefined") { + error += '\n\n' + $("body").html(); + } + throw new Error(error); +} + +var website = window.openerp.website; + +// don't rewrite website.Tour in test mode +if (typeof website.Tour !== "undefined") { + return; +} // don't need template to use bootstrap Tour in automatic mode -if (typeof QWeb2 !== "undefined") -website.add_template_file('/website/static/src/xml/website.tour.xml'); +if (typeof QWeb2 !== "undefined") { + website.add_template_file('/website/static/src/xml/website.tour.xml'); + +} // don't need to use bootstrap Tour to launch an automatic tour function bootstrap_tour_stub () { @@ -19,27 +38,28 @@ function bootstrap_tour_stub () { -if (website.EditorBar) -website.EditorBar.include({ - tours: [], - start: function () { - var self = this; - var menu = $('#help-menu'); - _.each(this.tours, function (tour) { - var $menuItem = $($.parseHTML('<li><a href="#">'+tour.name+'</a></li>')); - $menuItem.click(function () { - tour.reset(); - tour.run(); +if (website.EditorBar) { + website.EditorBar.include({ + tours: [], + start: function () { + var self = this; + var menu = $('#help-menu'); + _.each(this.tours, function (tour) { + var $menuItem = $($.parseHTML('<li><a href="#">'+tour.name+'</a></li>')); + $menuItem.click(function () { + tour.reset(); + tour.run(); + }); + menu.append($menuItem); }); - menu.append($menuItem); - }); - return this._super(); - }, - registerTour: function (tour) { - website.Tour.add(tour); - this.tours.push(tour); - } -}); + return this._super(); + }, + registerTour: function (tour) { + website.Tour.add(tour); + this.tours.push(tour); + } + }); +} ///////////////////////////////////////////////// @@ -308,7 +328,8 @@ website.Tour = openerp.Class.extend({ self.timer = setTimeout(checkNext, self.defaultDelay); } else { self.reset(); - throw new Error("Time overlaps to arrive to step " + step.stepId + ": '" + step._title + "'" + throw new Error("Can't arrive to step " + step.stepId + ": '" + step._title + "'" + + '\nhref: ' + window.location.href + '\nelement: ' + Boolean(!step.element || ($(step.element).size() && $(step.element).is(":visible") && !$(step.element).is(":hidden"))) + '\nwaitNot: ' + Boolean(!step.waitNot || !$(step.waitNot).size()) + '\nwaitFor: ' + Boolean(!step.waitFor || $(step.waitFor).size()) @@ -363,12 +384,13 @@ website.Tour = openerp.Class.extend({ } }, endTour: function () { - if (parseInt(this.localStorage.getItem("tour-"+this.id+"-test"),10) >= this.steps.length-1) { + var test = parseInt(this.localStorage.getItem("tour-"+this.id+"-test"),10) >= this.steps.length-1; + this.reset(); + if (test) { console.log('ok'); } else { console.log('error'); } - this.reset(); }, autoNextStep: function () { var self = this; |
