summaryrefslogtreecommitdiff
path: root/addons/website/static/src/js/website.js
diff options
context:
space:
mode:
Diffstat (limited to 'addons/website/static/src/js/website.js')
-rw-r--r--addons/website/static/src/js/website.js26
1 files changed, 23 insertions, 3 deletions
diff --git a/addons/website/static/src/js/website.js b/addons/website/static/src/js/website.js
index 84d755a4801..48b656cd89d 100644
--- a/addons/website/static/src/js/website.js
+++ b/addons/website/static/src/js/website.js
@@ -256,6 +256,22 @@
if($.fn.placeholder) $('input, textarea').placeholder();
});
+ /**
+ * Execute a function if the dom contains at least one element matched
+ * through the given jQuery selector. Will first wait for the dom to be ready.
+ *
+ * @param {String} selector A jQuery selector used to match the element(s)
+ * @param {Function} fn Callback to execute if at least one element has been matched
+ */
+ website.if_dom_contains = function(selector, fn) {
+ website.dom_ready.then(function () {
+ var elems = $(selector);
+ if (elems.length) {
+ fn(elems);
+ }
+ });
+ };
+
var all_ready = null;
/**
* Returns a deferred resolved when the templates are loaded
@@ -267,8 +283,12 @@
return templates_def;
}).then(function () {
// display button if they are at least one editable zone in the page (check the branding)
- var editable = $('html').data('website-id') && !!$('[data-oe-model]').size();
- $("#oe_editzone").toggle(editable);
+ if (!!$('[data-oe-model]').size()) {
+ $("#oe_editzone").show();
+
+ //backwards compatibility with 8.0RC1 templates - Drop next line in master!
+ $("#oe_editzone button").show();
+ }
if ($('html').data('website-id')) {
website.id = $('html').data('website-id');
@@ -283,7 +303,7 @@
website.inject_tour = function() {
// if a tour is active inject tour js
- }
+ };
website.dom_ready.then(function () {
/* ----- PUBLISHING STUFF ---- */