Created
December 9, 2014 23:47
-
-
Save torsday/165aeb65b8d6c0237934 to your computer and use it in GitHub Desktop.
firewall_trigger.coffee
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
complete_assessment = (e) -> | |
$.ajax( | |
type: "PATCH" | |
url: $('#student_view_assessment').attr('data-updateurl') | |
success: (data) -> | |
if data.error | |
$('<div id="flash" class="alert">').html('<p>' + data.error + '</p>').insertBefore('#student_content') | |
e.preventDefault() | |
$('#student_view_assessment').html('Submit Answers') | |
else | |
window.location.href = data.new_url | |
error: -> | |
alert_message = 'Uh oh. Your school\'s firewall has stopped you from submitting these answers. Please pass on these <b><a href=\'http://support.teachtci.com/knowledgebase/articles/425786\' target=\'_blank\'>directions</a></b> to your IT department.' | |
if (window.TCI_alert == undefined) | |
window.TCI_alert = new TCIAlert() | |
window.TCI_alert.init(); | |
window.TCI_alert.showWithMessage(alert_message) | |
e.preventDefault() | |
$('#student_view_assessment').html('Submit Answers') | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment