Skip to content
Permalink
Browse files

[IMP] web_editor: Save previous URL of video

- If user wants to change the video, the previous URL and options are saved
  • Loading branch information...
var-odoo committed Apr 16, 2019
1 parent 1c1ed01 commit 9ba85980423883592b2be0842d4d780dcd90cefb
@@ -65,7 +65,8 @@ var MediaDialog = Dialog.extend({
this.iconDialog.tabToShow = 'icon';
}
if (!this.noVideos) {
this.videoDialog = new MediaModules.VideoWidget(this, this.media, options);
var videoMediaEl = options.video && options.video[0] || this.media;
this.videoDialog = new MediaModules.VideoWidget(this, videoMediaEl, options);
this.videoDialog.tabToShow = 'video';
}
if (!this.noImages) {
@@ -850,6 +850,12 @@ registry.background = SnippetOption.extend({
// Put fake image in the DOM, edit it and use it as background-image
var $image = $('<img/>', {class: 'd-none', src: value === 'true' ? '' : value}).appendTo(this.$target);

// In case of background video, we want to see that already set video
var video = false;
if (this.$target.hasClass('oe_video_background')) {
video = this.$target.find('iframe.playerBox');
video.data({'src': this.$target.attr('src'), 'opacity': this.$target.attr('opacity'), 'background': this.$target.attr('background'), 'container': this.$target.attr('iframefit')});
}
var $editable = this.$target.closest('.o_editable');
var _editor = new weWidgets.MediaDialog(this, {
noDocuments: true,
@@ -858,6 +864,7 @@ registry.background = SnippetOption.extend({
res_model: $editable.data('oe-model'),
res_id: $editable.data('oe-id'),
background_video_options: true,
video: video,
}, $image[0]).open();

_editor.on('save', this, function (data) {

0 comments on commit 9ba8598

Please sign in to comment.
You can’t perform that action at this time.