Skip to content

Commit

Permalink
Update video-chooser.js
Browse files Browse the repository at this point in the history
Hacked as per this discussion: neon-jungle#81
  • Loading branch information
fredevery authored May 16, 2022
1 parent 375d388 commit af28fff
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions wagtailvideos/static/wagtailvideos/js/video-chooser.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,18 @@ function createVideoChooser(id) {
var input = $('#' + id);
var editLink = chooserElement.find('.edit-link');

$('.action-choose', chooserElement).click(function() {
ModalWorkflow({
url: window.chooserUrls.videoChooser,
onload: VIDEO_CHOOSER_MODAL_ONLOAD_HANDLERS,
responses: {
videoChosen: function(videoData) {
input.val(videoData.id);
document.addEventListener('DOMContentLoaded', event => {
var input = $('#' + id);
let call_url = window.chooserUrls.videoChooser + input.val();
$.ajax(call_url).done(function(data) {
let videoData = data.result
input.val(videoData.id);
previewVideo.attr({
src: videoData.preview.url,
alt: videoData.title
});
chooserElement.removeClass('blank');
editLink.attr('href', videoData.edit_link);
}
}
});
});

Expand Down

0 comments on commit af28fff

Please sign in to comment.