diff --git a/addons/website/controllers/main.py b/addons/website/controllers/main.py index aee0997e4b4..9872db219ec 100644 --- a/addons/website/controllers/main.py +++ b/addons/website/controllers/main.py @@ -296,7 +296,7 @@ class Website(openerp.addons.web.controllers.main.Home): #------------------------------------------------------ # Helpers #------------------------------------------------------ - @http.route(['/website/kanban/'], type='http', auth="public", methods=['POST'], website=True) + @http.route(['/website/kanban'], type='http', auth="public", methods=['POST'], website=True) def kanban(self, **post): return request.website.kanban_col(**post) diff --git a/addons/website/models/ir_http.py b/addons/website/models/ir_http.py index 1833ce102db..c0a9e209d00 100644 --- a/addons/website/models/ir_http.py +++ b/addons/website/models/ir_http.py @@ -91,7 +91,12 @@ class ir_http(orm.AbstractModel): assert path is not None except Exception: return self._handle_exception(werkzeug.exceptions.NotFound()) - if path != werkzeug.url_quote(request.httprequest.path): + + generated_path = werkzeug.url_unquote_plus(path) + current_path = werkzeug.url_unquote_plus(request.httprequest.path) + if generated_path != current_path: + if request.lang != request.website.default_lang_code: + path = '/' + request.lang + path return werkzeug.utils.redirect(path) def _handle_exception(self, exception=None, code=500): diff --git a/addons/website/models/website.py b/addons/website/models/website.py index 1a541865987..15e1a643d3d 100644 --- a/addons/website/models/website.py +++ b/addons/website/models/website.py @@ -248,7 +248,7 @@ class website(osv.osv): pmin = pmax - scope if pmax - scope > 0 else 1 def get_url(page): - _url = "%spage/%s/" % (url, page) if page > 1 else url + _url = "%s/page/%s" % (url, page) if page > 1 else url if url_args: _url = "%s?%s" % (_url, werkzeug.url_encode(url_args)) return _url 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('
Sorry, the requested event is not available anymore.
- +