import ModalBase from 'ember-cli-dunlop/mixins/modal-base'
export default ModalBase.extend
  model_projects: Ember.A()

  willOpenModal: ->
    @get("model.projects").then (projects)=>
      @set "model_projects", projects.toArray()

  actions:
    newViewItem: ->
      record = @get('model.tracker_groups').createRecord(isEditing: true)

    saveRecord: ->
      @set("model.projects", @get("model_projects"))
      if @get("model.isNew")
        @get("model").save() # do not close modal
      else
        @_super()
