Fix saving levels from #3276 refactoring

This commit is contained in:
Nick Winter 2015-12-24 11:21:12 -08:00
parent e9e7416c8f
commit 208073ffdb
3 changed files with 7 additions and 6 deletions

View file

@ -7,7 +7,7 @@ block modal-header-content
h3(data-i18n="versions.save_version_title") Save New Version
block modal-body-content
if view.model.hasLocalChanges()
if view.hasChanges
.changes-stub
form.form-inline
.form-group.commit-message
@ -21,14 +21,14 @@ block modal-body-content
.alert.alert-danger(data-i18n="delta.no_changes") No changes
block modal-body-wait-content
if view.model.hasLocalChanges()
if view.hasChanges
if view.isPatch
h3(data-i18n="versions.submitting_patch") Submitting Patch...
else
h3(data-i18n="common.saving") Saving...
block modal-footer-content
if view.model.hasLocalChanges()
if view.hasChanges
#accept-cla-wrapper.alert.alert-info
span.spr(data-i18n="versions.cla_prefix") To save changes, first you must agree to our
strong#cla-link(data-i18n="versions.cla_url") CLA
@ -39,7 +39,7 @@ block modal-footer-content
.buttons
button.btn(data-dismiss="modal", data-i18n="common.cancel") Cancel
if view.model.hasLocalChanges() && !view.isPatch
if view.hasChanges && !view.isPatch
button.btn.btn-primary#save-version-button(data-i18n="common.save") Save
if view.model.hasLocalChanges() && view.isPatch
if view.hasChanges && view.isPatch
button.btn.btn-primary#submit-patch-button(data-i18n="common.submit_patch") Submit Patch

View file

@ -28,7 +28,7 @@ module.exports = class SaveLevelModal extends SaveVersionModal
context.levelNeedsSave = @level.hasLocalChanges()
context.modifiedComponents = _.filter @supermodel.getModels(LevelComponent), @shouldSaveEntity
context.modifiedSystems = _.filter @supermodel.getModels(LevelSystem), @shouldSaveEntity
context.hasChanges = (context.levelNeedsSave or context.modifiedComponents.length or context.modifiedSystems.length)
@hasChanges = (context.levelNeedsSave or context.modifiedComponents.length or context.modifiedSystems.length)
@lastContext = context
context

View file

@ -21,6 +21,7 @@ module.exports = class SaveVersionModal extends ModalView
super options
@model = options.model or options.level
@isPatch = not @model.hasWriteAccess()
@hasChanges = @model.hasLocalChanges()
afterRender: (insertDeltaView=true) ->
super()