summaryrefslogtreecommitdiff
path: root/addons/website/static/src/js/website.editor.js
diff options
context:
space:
mode:
authorqsm-odoo <qsm@odoo.com>2016-07-20 14:01:16 +0200
committerqsm-odoo <qsm@odoo.com>2016-07-20 15:59:53 +0200
commitf0620a9648d7f6ab65489432f49aa4854ee1cfd9 (patch)
treecc1cb924e59de6921ab1888c75c50bec4ccdea57 /addons/website/static/src/js/website.editor.js
parent7c33417e894d04bc377428b949b0d73e6bda7dd6 (diff)
[FIX] web_editor,website: allow creating pages from edit menu
The code for page creation from menu edition dialog was there but invisible to the user because of a wrong qweb template inheritance. Indeed, the edit menu dialog relies on an extension of the link dialog template. But this one is extended in-place in another location and that extension is not considered when the second extension is made because a t-extend always use the base template. The only solution to achieve the same result is to copy the edit menu dialog qweb extension in Javascript. Note: the feature was still available from the link dialog in page edition though because this was not concerned by the wrong qweb extension. However, adding a page by this way would create multiple pages because one was created each time a page name was entered (and not only on save !). So typing "test", then changing its mind and typing "hello", then rechanging to "test", then hitting the save button created the "test, "test-1", "test-2" and "hello" pages. This fix takes advantage of an already present parameter which can determine if a new page should be created or not. However, a code refactoring should be done in master for these classes.
Diffstat (limited to 'addons/website/static/src/js/website.editor.js')
-rw-r--r--addons/website/static/src/js/website.editor.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/addons/website/static/src/js/website.editor.js b/addons/website/static/src/js/website.editor.js
index 9dca29619b7..c0aed905031 100644
--- a/addons/website/static/src/js/website.editor.js
+++ b/addons/website/static/src/js/website.editor.js
@@ -160,11 +160,11 @@ widget.LinkDialog.include({
}
return this._super();
},
- get_data_buy_url: function (def, $e, isNewWindow, label, classes) {
+ get_data_buy_url: function (def, $e, isNewWindow, label, classes, test) {
var val = $e.val();
if (val && val.length && $e.hasClass('page')) {
var data = $e.select2('data');
- if (!data.create) {
+ if (!data.create || test) {
def.resolve(data.id, isNewWindow, label || data.text, classes);
} else {
// Create the page, get the URL back
@@ -175,7 +175,7 @@ widget.LinkDialog.include({
});
}
} else {
- def.resolve(val, isNewWindow, label, classes);
+ return this._super.apply(this, arguments);
}
},
changed: function (e) {