summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src/js
diff options
context:
space:
mode:
authorqsm-odoo <qsm@odoo.com>2019-01-21 16:41:38 +0000
committerqsm-odoo <qsm@odoo.com>2019-01-21 16:48:31 +0000
commitc97f16becebae2f86bb764cb65e49c927ba96300 (patch)
tree3d8160cad02eb8925182e477668cac33bf13dc30 /addons/web_editor/static/src/js
parent86d26ffb88720ba06261d03c683777d1673e9700 (diff)
[FIX] website, *: restore media dialog uses
* web_editor, website_blog Following the new editor's merge at https://github.com/odoo/odoo/pull/29775, the media dialog was refactored but the code which used it outside of the editor was not adapted at all. Also, the selected image was not saved correctly anymore, making the media dialog useless outside the editor in the current implementation. - Adapted SEO image uploading and body image background choice which were not working anymore - Adapted blog cover choice and gallery snippet which were strangely still working even though there were sending wrong parameters during media dialog initialization closes odoo/odoo#30416
Diffstat (limited to 'addons/web_editor/static/src/js')
-rw-r--r--addons/web_editor/static/src/js/wysiwyg/widgets/media_dialog.js24
1 files changed, 11 insertions, 13 deletions
diff --git a/addons/web_editor/static/src/js/wysiwyg/widgets/media_dialog.js b/addons/web_editor/static/src/js/wysiwyg/widgets/media_dialog.js
index 1cb6689d02e..f214d210b52 100644
--- a/addons/web_editor/static/src/js/wysiwyg/widgets/media_dialog.js
+++ b/addons/web_editor/static/src/js/wysiwyg/widgets/media_dialog.js
@@ -141,22 +141,20 @@ var MediaDialog = Dialog.extend({
*/
save: function () {
var self = this;
- var args = arguments;
var _super = this._super;
- if (this.multiImages) {
+ var args = arguments;
+ return $.when(this.active.save()).then(function (data) {
+ self.final_data = data;
// In the case of multi images selection we suppose this was not to
// replace an old media, so we only retrieve the images and save.
- return $.when(this.active.save()).then(function (data) {
- self.final_data = data;
- return _super.apply(self, args);
- });
- }
-
- return $.when(this.active.save()).then(function (media) {
- self.trigger('saved', {
- attachments: self.active.images,
- media: media,
- });
+ if (!self.multiImages) {
+ // TODO this dialog triggers 'save' and 'saved' with different
+ // data on close... should refactor to avoid confusion...
+ self.trigger('saved', {
+ attachments: self.active.images,
+ media: data,
+ });
+ }
return _super.apply(self, args);
});
},