From fe4be011af2d2acc732880691ebb3aaf770331ee Mon Sep 17 00:00:00 2001 From: Will Daly Date: Thu, 27 Feb 2014 16:54:19 -0500 Subject: [PATCH] Add error notification for XBlocks in Studio --- .../coffee/src/xblock/cms.runtime.v1.coffee | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/cms/static/coffee/src/xblock/cms.runtime.v1.coffee b/cms/static/coffee/src/xblock/cms.runtime.v1.coffee index 2849eed222..623d59d866 100644 --- a/cms/static/coffee/src/xblock/cms.runtime.v1.coffee +++ b/cms/static/coffee/src/xblock/cms.runtime.v1.coffee @@ -41,7 +41,7 @@ define [ # Starting to save, so show the "Saving..." notification if data.state == 'start' - @_hide_editor() + @_hideEditor() @savingNotification.show() # Finished saving, so hide the "Saving..." notification @@ -50,12 +50,23 @@ define [ @savingNotification.hide() else if name == 'cancel' - @_hide_editor() + @_hideEditor() - _hide_editor: () -> + else if name == 'error' + if 'msg' of data + @_showAlert(data.msg) + + _hideEditor: () -> # This will close all open component editors, which works # if we assume that <= 1 are open at a time. el = $('.component.editing') el.removeClass('editing') el.find('.component-editor').slideUp(150) ModalUtils.hideModalCover() + + _showAlert: (msg) -> + new NotificationView.Error({ + title: "OpenAssessment Save Error", + message: msg, + closeIcon: false + }).show()