allow external tools to remove beforeunload for submissions

test plan
  Install a tool with a homework submission placement
  Create an assignment that can accept submission from the tool
  Submit a URL and verify that no pop-up appears upon submitting
  Submit a file and verify that no pop-up appears upon submitting
  Submit a lti link and verify that no pop-up appears upon submitting

fixes: PLAT-2453

Change-Id: I8404eff102aea2230d1447c1cd2018a321b3f4d7
Reviewed-on: https://gerrit.instructure.com/109315
Tested-by: Jenkins
Reviewed-by: Andrew Butterfield <abutterfield@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Brad Humphrey <brad@instructure.com>
This commit is contained in:
Brad Humphrey 2017-04-20 21:28:02 -06:00
parent c883eb485d
commit 6653fb2998
4 changed files with 4 additions and 4 deletions

View File

@ -41,7 +41,7 @@ define [
return return
redirectSuccessfulAssignment: (responseData) => redirectSuccessfulAssignment: (responseData) =>
window.onbeforeunload = -> # remove alert message from being triggered $(window).off('beforeunload') # remove alert message from being triggered
window.location.reload() window.location.reload()
@loaderPromise.resolve() @loaderPromise.resolve()
return return

View File

@ -25,6 +25,6 @@ define [
$.ajaxJSON @submissionURL(), "POST", data, @redirectSuccessfulAssignment $.ajaxJSON @submissionURL(), "POST", data, @redirectSuccessfulAssignment
redirectSuccessfulAssignment: (responseData) => redirectSuccessfulAssignment: (responseData) =>
window.onbeforeunload = -> # remove alert message from being triggered $(window).off('beforeunload') # remove alert message from being triggered
window.location.reload() window.location.reload()

View File

@ -20,6 +20,6 @@ define [
$.ajaxJSON submissionUrl, "POST", data, @redirectSuccessfulAssignment $.ajaxJSON submissionUrl, "POST", data, @redirectSuccessfulAssignment
redirectSuccessfulAssignment: (responseData) => redirectSuccessfulAssignment: (responseData) =>
window.onbeforeunload = -> # remove alert message from being triggered $(window).off('beforeunload') # remove alert message from being triggered
window.location.reload() window.location.reload()

View File

@ -238,7 +238,7 @@ define([
} }
}); });
window.addEventListener('beforeunload', function(e) { $(window).on('beforeunload', function(e) {
if($("#submit_assignment:visible").length > 0 && !submitting) { if($("#submit_assignment:visible").length > 0 && !submitting) {
e.returnValue = I18n.t('messages.not_submitted_yet', "You haven't finished submitting your assignment. You still need to click \"Submit\" to finish turning it in. Do you want to leave this page anyway?"); e.returnValue = I18n.t('messages.not_submitted_yet', "You haven't finished submitting your assignment. You still need to click \"Submit\" to finish turning it in. Do you want to leave this page anyway?");
return e.returnValue; return e.returnValue;