[REF] website_slides: adapt code after jQuery update

Part of task 1896658

Co-authored-by: Aaron Bohy <aab@odoo.com>
Co-authored-by: Christophe Matthieu <chm@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: David Monjoie <dmo@odoo.com>
Co-authored-by: Martin Geubelle <mge@odoo.com>
Co-authored-by: svs-odoo <svs@odoo.com>
Co-authored-by: Vincent Schippefilt <vsc@odoo.com>
This commit is contained in:
Vincent Schippefilt
2019-03-06 20:07:17 +01:00
committed by Aaron Bohy
co-authored by Aaron Bohy Christophe Matthieu Mathieu Duckerts-Antoine David Monjoie Martin Geubelle svs-odoo
parent a74169bb09
commit 4d1927caef
8 changed files with 18 additions and 21 deletions
@@ -28,7 +28,7 @@ publicWidget.registry.websiteSlides = publicWidget.Widget.extend({
$(el).text(displayStr);
});
return $.when.apply($, defs);
return Promise.all(defs);
},
});
@@ -101,7 +101,7 @@ publicWidget.registry.websiteSlidesEmbed = publicWidget.Widget.extend({
start: function (parent) {
var defs = [this._super.apply(this, arguments)];
$('iframe.o_wslides_iframe_viewer').on('ready', this._onIframeViewerReady.bind(this));
return $.when.apply($, defs);
return Promise.all(defs);
},
//--------------------------------------------------------------------------
@@ -410,17 +410,14 @@ odoo.define('website_slides.fullscreen', function (require) {
publicWidget.registry.websiteSlidesFullscreenPlayer = publicWidget.Widget.extend({
selector: '.o_wslides_fs_main',
xmlDependencies: ['/website_slides/static/src/xml/website_slides_fullscreen.xml'],
init: function (el){
this._super.apply(this, arguments);
},
start: function (){
var defs = [this._super.apply(this, arguments)];
var proms = [this._super.apply(this, arguments)];
var userId = this.$el.data('userId');
var courseId = this.$el.data('courseId');
var slideId = this.$el.data('slideId');
var fullscreen = new Fullscreen(this, courseId, slideId, userId);
defs.push(fullscreen.attachTo(this.$el));
return $.when.apply($, defs);
proms.push(fullscreen.attachTo(this.$el));
return Promise.all(proms);
}
});
@@ -73,11 +73,11 @@ publicWidget.registry.websiteSlidesCourseJoin = publicWidget.Widget.extend({
*/
start: function () {
var self = this;
var defs = [this._super.apply(this, arguments)];
var proms = [this._super.apply(this, arguments)];
$('.o_wslides_js_course_join').each(function () {
defs.push(new CourseJoinWidget(self).attachTo($(this)));
proms.push(new CourseJoinWidget(self).attachTo($(this)));
});
return $.when.apply($, defs);
return Promise.all(proms);
},
});
@@ -4,7 +4,7 @@
* a slide/video/document. This code can depend on pdf.js, JQuery and Bootstrap
* (see website_slides.slide_embed_assets bundle, in website_slides_embed.xml)
*/
$(document).ready(function () {
$(function () {
if ($('#PDFViewer') && $('#PDFViewerCanvas')) { // check if presentation only
@@ -67,7 +67,7 @@ publicWidget.registry.websiteSlidesShare = publicWidget.Widget.extend({
self._updateStatistics(key, self.slideURL);
});
return $.when.apply($, defs);
return Promise.all(defs);
},
//--------------------------------------------------------------------------
@@ -89,7 +89,7 @@ publicWidget.registry.websiteSlidesSlideLike = publicWidget.Widget.extend({
$('.o_wslides_js_slide_like').each(function () {
defs.push(new SlideLikeWidget(self).attachTo($(this)));
});
return $.when.apply($, defs);
return Promise.all(defs);
},
});
@@ -241,7 +241,7 @@ var SlideUploadDialog = Dialog.extend({
* @private
* @param {String} Placeholder for element.
* @param {bool} true for multiple selection box, false for single selection
* @param {Function} Function to fetch data from remote location should return $.deferred object
* @param {Function} Function to fetch data from remote location should return a Promise
* resolved data should be array of object with id and name. eg. [{'id': id, 'name': 'text'}, ...]
* @param {String} [nameKey='name'] (optional) the name key of the returned record
* ('name' if not provided)
@@ -97,14 +97,14 @@ WebsiteNewMenu.include({
* and redirects the user to this channel.
*
* @private
* @returns {Deferred} Unresolved if there is a redirection
* @returns {Promise} Unresolved if there is a redirection
*/
_createNewSlideChannel: function () {
var def = $.Deferred();
var dialog = new ChannelCreateDialog(this, {});
dialog.open();
dialog.on('closed', this, function() {
def.resolve();
var self = this;
var def = new Promise(function (resolve) {
var dialog = new ChannelCreateDialog(self, {});
dialog.open();
dialog.on('closed', self, resolve);
});
return def;
},