diff options
| author | Christophe Simonis <chs@odoo.com> | 2019-09-25 16:53:26 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2019-09-25 16:53:26 +0200 |
| commit | f1c0b085046527f9b9b35c0fb5c88ca3c87c8c49 (patch) | |
| tree | c1c51a5e4e3d2e12dd976cb09f13a7efc70c0298 /addons/website/static/src | |
| parent | f8f2b6a6ce8871cfa95446dca8d1d1d27a5d4d08 (diff) | |
| parent | bef26222b8f3e5ac349a55f2fc2c08e09eb3653b (diff) | |
[MERGE] forward port branch saas-12.4 up to bef26222b8f
Diffstat (limited to 'addons/website/static/src')
| -rw-r--r-- | addons/website/static/src/js/backend/dashboard.js | 12 | ||||
| -rw-r--r-- | addons/website/static/src/js/content/website_root.js | 17 |
2 files changed, 16 insertions, 13 deletions
diff --git a/addons/website/static/src/js/backend/dashboard.js b/addons/website/static/src/js/backend/dashboard.js index 28b9a55c8a4..f074bb0df84 100644 --- a/addons/website/static/src/js/backend/dashboard.js +++ b/addons/website/static/src/js/backend/dashboard.js @@ -133,6 +133,12 @@ var Dashboard = AbstractAction.extend({ }).open(); }, + on_go_to_website: function (ev) { + ev.preventDefault(); + var website = _.findWhere(this.websites, {selected: true}); + window.location.href = $.param.querystring(website.domain + '/', {'fw': website.id}); + }, + on_save_ga_client_id: function(ga_client_id, ga_analytics_key) { var self = this; return this._rpc({ @@ -393,10 +399,14 @@ var Dashboard = AbstractAction.extend({ self.on_website_button($(ev.target).data('website-id')); }); } + + var $buttons = $(QWeb.render("website.GoToButtons")); + $buttons.on('click', this.on_go_to_website.bind(this)); + this.updateControlPanel({ cp_content: { $searchview: this.$searchview, - $buttons: QWeb.render("website.GoToButtons"), + $buttons: $buttons, }, }); }, diff --git a/addons/website/static/src/js/content/website_root.js b/addons/website/static/src/js/content/website_root.js index a8e208f1408..70f8c5014f5 100644 --- a/addons/website/static/src/js/content/website_root.js +++ b/addons/website/static/src/js/content/website_root.js @@ -181,21 +181,14 @@ var WebsiteRoot = publicRootData.PublicRoot.extend({ * @param {Event} ev */ _onWebsiteSwitch: function (ev) { - var websiteID = ev.currentTarget.getAttribute('website-id'); - - // need to force in each case, even if domain is set - // Website 1: localhost; Website 2: 0.0.0.0; website 3: - - // when you switch 3 <--> 1, you need to force the website - + var websiteId = ev.currentTarget.getAttribute('website-id'); var websiteDomain = ev.currentTarget.getAttribute('domain'); - var url = $.param.querystring(window.location.href, {fw: websiteID}); + var url = window.location.href; if (websiteDomain && window.location.hostname !== websiteDomain) { - // if domain unchanged, this line will do a nop while we need to refresh - // the page to load the new forced website. - url = new URL(url); - url.hostname = websiteDomain; + var path = window.location.pathname + window.location.search + window.location.hash; + url = websiteDomain + path; } - window.location.href = url; + window.location.href = $.param.querystring(url, {'fw': websiteId}); }, /** * @private |
