summaryrefslogtreecommitdiff
path: root/addons/website/static/src
diff options
context:
space:
mode:
authorChristophe Matthieu <chm@openerp.com>2013-11-07 10:42:56 +0100
committerChristophe Matthieu <chm@openerp.com>2013-11-07 10:42:56 +0100
commitef86f6d12ae12c3d450bb6feba1f40f9d7fa3b54 (patch)
treebfdc64b268915c4870e72d75ad0b6fa2c9b4a790 /addons/website/static/src
parentb7a4c6d3f0c22e7aaed5d1e58cc6bca232f4f756 (diff)
[FIX] website snippet: the 'insert block' button is loaded before the editor widget -> confusing in slow connectivity
bzr revid: chm@openerp.com-20131107094256-nqp5coey0fy732pl
Diffstat (limited to 'addons/website/static/src')
-rw-r--r--addons/website/static/src/js/website.snippets.js13
-rw-r--r--addons/website/static/src/xml/website.snippets.xml2
2 files changed, 11 insertions, 4 deletions
diff --git a/addons/website/static/src/js/website.snippets.js b/addons/website/static/src/js/website.snippets.js
index 16dab3af262..6a9c4039e97 100644
--- a/addons/website/static/src/js/website.snippets.js
+++ b/addons/website/static/src/js/website.snippets.js
@@ -17,9 +17,15 @@
return this._super();
},
edit: function () {
+ var self = this;
$("body").off('click');
window.snippets = this.snippets = new website.snippet.BuildingBlock(this);
this.snippets.appendTo(this.$el);
+
+ this.rte.on('rte:ready', this, function () {
+ self.snippets.$button.removeClass("hidden");
+ });
+
return this._super.apply(this, arguments);
},
save: function () {
@@ -118,10 +124,11 @@
start: function() {
var self = this;
- var $ul = this.parent.$("#website-top-edit ul");
+ this.$button = $(openerp.qweb.render('website.snippets_button'))
+ .prependTo(this.parent.$("#website-top-edit ul"))
+ .find("button");
- var $button = $(openerp.qweb.render('website.snippets_button')).prependTo($ul);
- $button.find('button').click(function () {
+ this.$button.click(function () {
self.make_active(false);
self.$el.toggleClass("hidden");
});
diff --git a/addons/website/static/src/xml/website.snippets.xml b/addons/website/static/src/xml/website.snippets.xml
index 103392a23b7..587c36a71bc 100644
--- a/addons/website/static/src/xml/website.snippets.xml
+++ b/addons/website/static/src/xml/website.snippets.xml
@@ -3,7 +3,7 @@
<!-- Snippet loader -->
<t t-name="website.snippets_button">
- <li class="navbar-form js_hide_on_translate"><button type="button" data-action="snippet" class="btn btn-primary">Insert Blocks</button></li>
+ <li class="navbar-form js_hide_on_translate"><button type="button" data-action="snippet" class="hidden btn btn-primary">Insert Blocks</button></li>
</t>
<t t-name="website.snippets_style">
<li class="navbar-form">