Qsupplier.App.SectionController = Ember.ObjectController.extend
  needs: ['application', 'sections', 'section'] #wtf? section, otherwise an Ember error
  editmode: false
  actions:
    ###
    markListAsHelped: (list) -> list.is_helped() if list
    closeList: (list)->
      @send 'openModal', 'modal_close_list', list
    ###
    makeEditable: -> @set('editmode', true)
    finishEditable: ->
      @set('editmode', false)
      @get('model').save()
    addSection: ->
      @send 'openModal', 'modal_add_section', @get('model')
    addTables: ->
      #$('#add-tables-modal').modal()
      @send 'openModal', 'modal_section_add_tables', @get('model')
    arrangeTables: ->
      @send 'openModal', 'modal_section_arrange_tables', @get('model')
    destroySection: ->
      @send 'openModal', 'modal_confirm',
        title: t('helpers.links.are_you_sure')
        ok: =>
          @get('model').destroyRecord()
          @transitionToRoute 'sections'
  textures: ['wood1', 'wood2']

  sections: (-> @get('controllers.sections.model')).property('controllers.sections.model')
