[FIX] website snippet: the 'insert block' button is loaded before the editor widget -> confusing in slow connectivity

bzr revid: chm@openerp.com-20131107094256-nqp5coey0fy732pl
This commit is contained in:
Christophe Matthieu 2013-11-07 10:42:56 +01:00
parent b7a4c6d3f0
commit ef86f6d12a
2 changed files with 11 additions and 4 deletions

View File

@ -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");
});

View File

@ -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">