diff options
| author | ddm <ddm@openerp.com> | 2013-09-18 11:53:54 +0200 |
|---|---|---|
| committer | ddm <ddm@openerp.com> | 2013-09-18 11:53:54 +0200 |
| commit | d8cabd620388be50e0450081bb1d4eeb71c1509c (patch) | |
| tree | 689e1b837ebb9190de44c740f9829399289e52bb /addons/website/static/src | |
| parent | 888e51ae17f12c67cf59d5acde3d9b8a3518e6b0 (diff) | |
[IMP] Reopen Ace on save
bzr revid: ddm@openerp.com-20130918095354-ybiimwkcm554c1er
Diffstat (limited to 'addons/website/static/src')
| -rw-r--r-- | addons/website/static/src/js/website.ace.js | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/addons/website/static/src/js/website.ace.js b/addons/website/static/src/js/website.ace.js index 840e3317d56..d9e34f29da4 100644 --- a/addons/website/static/src/js/website.ace.js +++ b/addons/website/static/src/js/website.ace.js @@ -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; |
