Skip to content

Instantly share code, notes, and snippets.

@tannishk
Last active August 29, 2015 14:27
Show Gist options
  • Save tannishk/ed49b83153f4b39472c9 to your computer and use it in GitHub Desktop.
Save tannishk/ed49b83153f4b39472c9 to your computer and use it in GitHub Desktop.
editorerror
$(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