diff options
| author | Fabien Meghazi <fme@openerp.com> | 2013-11-13 18:14:38 +0100 |
|---|---|---|
| committer | Fabien Meghazi <fme@openerp.com> | 2013-11-13 18:14:38 +0100 |
| commit | 7598bcdb98795d7e95a6a7b3eacdf018766f1328 (patch) | |
| tree | 2e18cfd788a9ed9e679a0dabf26edcb70908c3e1 /addons/website/static/src/js/website.editor.js | |
| parent | 70d9e5a8aa00014840de5493cbeb22389cbcf7e9 (diff) | |
[ADD] Content menu links splitted per modules
TODO: website.prompt() should be finished for Add a blog post link
Added @id=editable_scripts_hook in layout template so modules can easly add *.editor.js files
bzr revid: fme@openerp.com-20131113171438-3l0wo08ta5vsulq3
Diffstat (limited to 'addons/website/static/src/js/website.editor.js')
| -rw-r--r-- | addons/website/static/src/js/website.editor.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/addons/website/static/src/js/website.editor.js b/addons/website/static/src/js/website.editor.js index 5915ee5b359..a617f712976 100644 --- a/addons/website/static/src/js/website.editor.js +++ b/addons/website/static/src/js/website.editor.js @@ -12,6 +12,16 @@ website.ready().then(website.init_editor); } + $(document).on('click', 'a.js_link2post', function (ev) { + ev.preventDefault(); + var form = document.createElement('form'); + form.action = this.pathname; // restrict to same origin + form.method = 'POST'; + // TODO: support this.search as form input fields + $(this).append(form); + form.submit(); + }); + $(document).on('hide.bs.dropdown', '.dropdown', function (ev) { // Prevent dropdown closing when a contenteditable children is focused if (ev.originalEvent @@ -383,6 +393,7 @@ 'click button[data-action=edit]': 'edit', 'click button[data-action=save]': 'save', 'click button[data-action=cancel]': 'cancel', + 'click a[data-action=new_page]': 'new_page', }, container: 'body', customize_setup: function() { @@ -531,6 +542,12 @@ cancel: function () { website.reload(); }, + new_page: function (ev) { + ev.preventDefault(); + website.prompt('Create a new page', 'Page name').then(function (val) { + document.location = '/pagenew/' + encodeURI(val); + }); + }, }); var blocks_selector = _.keys(CKEDITOR.dtd.$block).join(','); |
