Merge pull request #2785 from edx/will/studio-oa-validation-fix
Studio OA validation dialog
This commit is contained in:
@@ -20,6 +20,10 @@ define [
|
|||||||
super()
|
super()
|
||||||
@savingNotification = new NotificationView.Mini
|
@savingNotification = new NotificationView.Mini
|
||||||
title: gettext('Saving…')
|
title: gettext('Saving…')
|
||||||
|
@alert = new NotificationView.Error
|
||||||
|
title: "OpenAssessment Save Error",
|
||||||
|
closeIcon: false,
|
||||||
|
shown: false
|
||||||
|
|
||||||
handlerUrl: (element, handlerName, suffix, query, thirdparty) ->
|
handlerUrl: (element, handlerName, suffix, query, thirdparty) ->
|
||||||
uri = URI("/xblock").segment($(element).data('usage-id'))
|
uri = URI("/xblock").segment($(element).data('usage-id'))
|
||||||
@@ -41,11 +45,15 @@ define [
|
|||||||
|
|
||||||
# Starting to save, so show the "Saving..." notification
|
# Starting to save, so show the "Saving..." notification
|
||||||
if data.state == 'start'
|
if data.state == 'start'
|
||||||
@_hideEditor()
|
|
||||||
@savingNotification.show()
|
@savingNotification.show()
|
||||||
|
|
||||||
# Finished saving, so hide the "Saving..." notification
|
# Finished saving, so hide the "Saving..." notification
|
||||||
else if data.state == 'end'
|
else if data.state == 'end'
|
||||||
|
|
||||||
|
# Hide the editor *after* we finish saving in case there are validation
|
||||||
|
# errors that the user needs to correct.
|
||||||
|
@_hideEditor()
|
||||||
|
|
||||||
$('.component.editing').removeClass('editing')
|
$('.component.editing').removeClass('editing')
|
||||||
@savingNotification.hide()
|
@savingNotification.hide()
|
||||||
|
|
||||||
@@ -54,7 +62,8 @@ define [
|
|||||||
|
|
||||||
else if name == 'error'
|
else if name == 'error'
|
||||||
if 'msg' of data
|
if 'msg' of data
|
||||||
@_showAlert(data.msg)
|
@alert.options.message = data.msg
|
||||||
|
@alert.show()
|
||||||
|
|
||||||
_hideEditor: () ->
|
_hideEditor: () ->
|
||||||
# This will close all open component editors, which works
|
# This will close all open component editors, which works
|
||||||
@@ -64,9 +73,6 @@ define [
|
|||||||
el.find('.component-editor').slideUp(150)
|
el.find('.component-editor').slideUp(150)
|
||||||
ModalUtils.hideModalCover()
|
ModalUtils.hideModalCover()
|
||||||
|
|
||||||
_showAlert: (msg) ->
|
# Hide any alerts that are being shown
|
||||||
new NotificationView.Error({
|
if @alert.options.shown
|
||||||
title: "OpenAssessment Save Error",
|
@alert.hide()
|
||||||
message: msg,
|
|
||||||
closeIcon: false
|
|
||||||
}).show()
|
|
||||||
|
|||||||
Reference in New Issue
Block a user