Skip to content

Commit

Permalink
Disable Create Timeline button until derivative loads
Browse files Browse the repository at this point in the history
  • Loading branch information
Dananji authored and phuongdh committed Jun 9, 2020
1 parent 9a7bb05 commit 2ebc209
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion app/views/media_objects/_timeline.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Unless required by applicable law or agreed to in writing, software distributed
%>

<div id="timeline-button" style="display: inline-block;">
<button type="button" class="btn btn-default" data-toggle="modal" data-target="#timelineModal" style="margin-top: 10px;">
<button type="button" class="btn btn-default" id="timeline-btn" data-toggle="modal" data-target="#timelineModal" style="margin-top: 10px;" disabled >
Create Timeline
</button>
</div>
Expand Down Expand Up @@ -49,6 +49,17 @@ Unless required by applicable law or agreed to in writing, software distributed

<script>
$(document).ready(function() {
let timelineBtn = $('#timeline-btn');
// Enable create timeline button after derivative is loaded
timeCheck = setInterval(enableTimelineBtn, 500);

function enableTimelineBtn() {
let currentVal = currentPlayer.duration;
if(currentVal > 0) {
timelineBtn[0].disabled = false;
clearInterval(timeCheck);
}
}
$('#timelineModal').on('show.bs.modal', function (e) {
console.log('in modal builder')
let $modalBody = $('#timelineModal').find('div#new-timeline-inputs')[0]
Expand Down

0 comments on commit 2ebc209

Please sign in to comment.