From 1da82fa8516f1014d620c26df762c0f2fda64d8c Mon Sep 17 00:00:00 2001 From: Scott Erickson <sderickson@gmail.com> Date: Thu, 7 Jul 2016 16:34:15 -0700 Subject: [PATCH] Fix #1199 --- app/templates/editor/modal/save-version-modal.jade | 3 +++ app/views/editor/modal/SaveVersionModal.coffee | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/templates/editor/modal/save-version-modal.jade b/app/templates/editor/modal/save-version-modal.jade index fabc5e88f..93c7e13de 100644 --- a/app/templates/editor/modal/save-version-modal.jade +++ b/app/templates/editor/modal/save-version-modal.jade @@ -36,6 +36,9 @@ block modal-footer-content button.btn.btn-sm#agreement-button(data-i18n="versions.cla_agree") I AGREE if view.isPatch .alert.alert-info(data-i18n="versions.owner_approve") An owner will need to approve it before your changes will become visible. + .save-error-area + if view.savingPatchError + .alert.alert-danger Unable to save patch: #{view.savingPatchError} .buttons button.btn(data-dismiss="modal", data-i18n="common.cancel") Cancel diff --git a/app/views/editor/modal/SaveVersionModal.coffee b/app/views/editor/modal/SaveVersionModal.coffee index ad0bcd48b..effee16d0 100644 --- a/app/views/editor/modal/SaveVersionModal.coffee +++ b/app/views/editor/modal/SaveVersionModal.coffee @@ -46,6 +46,7 @@ module.exports = class SaveVersionModal extends ModalView } submitPatch: -> + @savingPatchError = false forms.clearFormAlerts @$el patch = new Patch() patch.set 'delta', @model.getDelta() @@ -60,8 +61,10 @@ module.exports = class SaveVersionModal extends ModalView return unless res @enableModalInProgress(@$el) - res.error => + res.error (jqxhr) => @disableModalInProgress(@$el) + @savingPatchError = jqxhr.responseJSON?.message or 'Unknown error.' + @renderSelectors '.save-error-area' res.success => @hide()