Section improvements and add exception notifier
This commit is contained in:
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user