Section improvements and add exception notifier

This commit is contained in:
2015-10-09 14:58:37 +02:00
parent 709bd59c0c
commit 978dfcbf82
7 changed files with 27 additions and 22 deletions
@@ -12,21 +12,17 @@ App.SectionController = Ember.Controller.extend
@get('model.section_areas').filterBy('hasDirtyAttributes').invoke 'save'
rollbackEditable: ->
@get('model').rollbackAttributes()
@get('model.tables').forEach (table) ->
if table.get('isNew')
table.deleteRecord()
else
table.rollbackAttributes()
@get('model.section_elements').forEach (section_element) ->
if section_element.get('isNew')
section_element.deleteRecord()
else
section_element.rollbackAttributes()
@get('model.section_areas').forEach (section_area) ->
if section_area.get('isNew')
section_area.deleteRecord()
else
section_area.rollbackAttributes()
tables = @get('model.tables')
tables.filterBy('isNew').invoke 'unloadRecord'
tables.rejectBy('isNew').invoke 'rollbackAttributes'
section_elements = @get('model.section_elements')
section_elements.filterBy('isNew').invoke 'unloadRecord'
section_elements.rejectBy('isNew').invoke 'rollbackAttributes'
section_areas = @get('model.section_areas')
section_areas.filterBy('isNew').invoke 'unloadRecord'
section_areas.rejectBy('isNew').invoke 'rollbackAttributes'
@set('model.editmode', false)
addSection: -> @modal 'add_section', model: @get('model')
addTables: -> @modal 'section_add_tables', model: @get('model')