summaryrefslogtreecommitdiff
path: root/addons/website/static/src/js/utils.js
diff options
context:
space:
mode:
authorRobot Odoo <xmo+roboto@odoo.com>2019-02-08 20:16:33 +0100
committerGitHub <noreply@github.com>2019-02-08 20:16:33 +0100
commitf4dc2af71a662a3089ee12e52e2ccdaea6bd6587 (patch)
tree81b9a7ec93ff9ee3c6f456b39b26c7682eac7719 /addons/website/static/src/js/utils.js
parente6e206b14e3c3f0274b9d8e723ab1f40c53efe68 (diff)
parent52b27c4c6b38fec21872c7a5d6aa155da0827d11 (diff)
[MERGE] website, *: improve customize dialog + add logo sizing
* portal, web, web_editor See sub-commits for details. - Many improvements to the customize dialog 'framework' (toggle switches, new widgets, ...) - Optimization of RPCs (including ace editor which shares the same code) - Move navbar options of the customize menu to the customize dialog - Add the possibility to control the header logo size - Add the possibility to control the header font size task-1904244 closes odoo/odoo#29624
Diffstat (limited to 'addons/website/static/src/js/utils.js')
-rw-r--r--addons/website/static/src/js/utils.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/addons/website/static/src/js/utils.js b/addons/website/static/src/js/utils.js
index 9cf511fe160..01f0e7797a4 100644
--- a/addons/website/static/src/js/utils.js
+++ b/addons/website/static/src/js/utils.js
@@ -60,6 +60,24 @@ function autocompleteWithPages(self, $input) {
},
});
}
+
+/**
+ * @param {jQuery} $element
+ */
+function onceAllImagesLoaded($element) {
+ var defs = _.map($element.find('img').addBack('img'), function (img) {
+ if (img.complete) {
+ return; // Already loaded
+ }
+ var def = $.Deferred();
+ $(img).one('load', function () {
+ def.resolve();
+ });
+ return def;
+ });
+ return $.when.apply($, defs);
+}
+
/**
* @deprecated
* @todo create Dialog.prompt instead of this
@@ -168,6 +186,7 @@ function prompt(options, _qweb) {
return {
loadAnchors: loadAnchors,
autocompleteWithPages: autocompleteWithPages,
+ onceAllImagesLoaded: onceAllImagesLoaded,
prompt: prompt,
};
});