Last active
August 29, 2015 14:27
-
-
Save tannishk/ed49b83153f4b39472c9 to your computer and use it in GitHub Desktop.
editorerror
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function () { | |
PopcornEditor.listen(PopcornEditor.events.loaded, function () { | |
$.get($('#editor').data('url'), { | |
slug: $('#editor').data('slug') | |
}) | |
.done(function (response) { | |
if(response.data) { | |
PopcornEditor.loadInfo(response.data); | |
} else { | |
PopcornEditor.loadInfo(PopcornEditor.createTemplate(response.metadata)); | |
} | |
}) | |
.fail(function() { | |
console.warn("Unable to load popcorn data :("); | |
console.error.apply(console, arguments); | |
}); | |
$.post($('#editor').data('save'), { | |
data: JSON.stringify(message.data), | |
slug: $('#editor').data('slug'), | |
csrfmiddlewaretoken: $('input[name="csrfmiddlewaretoken"]').val() | |
}) | |
.done(function (response) { | |
var message = "Your edit has been saved and sent it for transcoding. " | |
+ "Once it completes, which can take several minutes, we'll automatically" | |
+ " update the event to use your latest video edits."; | |
alert(message); | |
}) | |
.fail(function () { | |
console.warn('Unable to save edit :('); | |
console.error.apply(console, arguments); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment