Skip to content

Instantly share code, notes, and snippets.

@torsday
Created December 9, 2014 23:47
Show Gist options
  • Save torsday/165aeb65b8d6c0237934 to your computer and use it in GitHub Desktop.
Save torsday/165aeb65b8d6c0237934 to your computer and use it in GitHub Desktop.
firewall_trigger.coffee
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