[IMP] Reopen Ace on save

bzr revid: ddm@openerp.com-20130918095354-ybiimwkcm554c1er
This commit is contained in:
ddm
2013-09-18 11:53:54 +02:00
parent 888e51ae17
commit d8cabd6203
+21 -9
View File
@@ -3,21 +3,31 @@
var globalEditor;
var hash = "#advanced-view-editor";
var website = openerp.website;
website.templates.push('/website/static/src/xml/website.ace.xml');
website.ready().then(function () {
if (window.location.hash == hash) {
launch();
}
});
function launch () {
if (globalEditor) {
globalEditor.open();
} else {
globalEditor = new website.ace.ViewEditor(this);
globalEditor.appendTo($(document.body));
}
}
website.EditorBar.include({
events: _.extend({}, website.EditorBar.prototype.events, {
'click a[data-action=ace]': 'launchAce',
'click a[data-action=ace]': 'launch',
}),
launchAce: function () {
if (globalEditor) {
globalEditor.open();
} else {
globalEditor = new website.ace.ViewEditor(this);
globalEditor.appendTo($(document.body));
}
},
launch: launch,
});
website.ace = {};
@@ -163,6 +173,7 @@
}
},
reloadPage: function () {
window.location.hash = hash;
window.location.reload();
},
displayError: function (error) {
@@ -174,6 +185,7 @@
this.displayView();
},
close: function () {
window.location.hash = "";
var self = this;
this.$el.bind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function () {
globalEditor = null;