summaryrefslogtreecommitdiff
path: root/addons/website/static/src
diff options
context:
space:
mode:
authorBenoit Socias <bso@odoo.com>2021-01-14 14:32:11 +0000
committerBenoit Socias <bso@odoo.com>2021-01-18 09:54:55 +0000
commite6675b075459c446a9115f9695824646c81dcc3f (patch)
tree25f047117f2adbd73a41fae6fa05f9467c6afcbc /addons/website/static/src
parent981eab82dbb15783bef7e010ffbc21735710dd0a (diff)
[FIX] website: prevent navigation during load if new content menu opened
Before this commit the new content menu only appeared once the page was fully loaded. Because of this users with slow connections could navigate elsewhere before noticing that the new option they enabled had appeared. After this commit a navigation-blocking overlay similar to the background of the menu is temporarily added to the page until the new content menu can be displayed. The div is put inside #wrapwrap in order to be later reused as the theme install loader blocking div which does not exist in 14.0. task-2439775 closes odoo/odoo#64554 Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Diffstat (limited to 'addons/website/static/src')
-rw-r--r--addons/website/static/src/js/menu/new_content.js2
-rw-r--r--addons/website/static/src/js/utils.js11
-rw-r--r--addons/website/static/src/scss/website.ui.scss7
3 files changed, 20 insertions, 0 deletions
diff --git a/addons/website/static/src/js/menu/new_content.js b/addons/website/static/src/js/menu/new_content.js
index 13de4a27794..c06213b9c08 100644
--- a/addons/website/static/src/js/menu/new_content.js
+++ b/addons/website/static/src/js/menu/new_content.js
@@ -184,6 +184,8 @@ var NewContentMenu = websiteNavbarData.WebsiteNavbarActionWidget.extend({
self.$newContentMenuChoices.removeClass('o_hidden');
$('body').addClass('o_new_content_open');
self.$('> a').focus();
+
+ wUtils.removeLoader();
});
},
diff --git a/addons/website/static/src/js/utils.js b/addons/website/static/src/js/utils.js
index f66f562b166..00d179bed27 100644
--- a/addons/website/static/src/js/utils.js
+++ b/addons/website/static/src/js/utils.js
@@ -263,6 +263,16 @@ function sendRequest(route, params) {
form.submit();
}
+/**
+ * Removes the navigation-blocking fullscreen loader from the DOM
+ */
+function removeLoader() {
+ const $loader = $('#o_website_page_loader');
+ if ($loader) {
+ $loader.remove();
+ }
+}
+
return {
loadAnchors: loadAnchors,
autocompleteWithPages: autocompleteWithPages,
@@ -270,5 +280,6 @@ return {
prompt: prompt,
sendRequest: sendRequest,
websiteDomain: websiteDomain,
+ removeLoader: removeLoader,
};
});
diff --git a/addons/website/static/src/scss/website.ui.scss b/addons/website/static/src/scss/website.ui.scss
index 88596884fd0..da23fabc6a3 100644
--- a/addons/website/static/src/scss/website.ui.scss
+++ b/addons/website/static/src/scss/website.ui.scss
@@ -126,6 +126,13 @@ body.o_connected_user {
}
}
+// BLOCKING LOADER
+#o_website_page_loader {
+ @include o-position-absolute(0, 0, 0, 0);
+ z-index: $zindex-modal - 1;
+ background-color: rgba(0, 0, 0, 0.8);
+}
+
// MODALS
body .modal {
&.o_technical_modal {