App.ModalView = Ember.Component.extend
  layoutName: 'modals/layout'
  didInsertElement: ->
    @$('input:first').focus()
    sortable = $('.sortable')
    controller = @get('controller')
    if sortable.length
      sortable.sortable
        update: (e, ui)->
          ids = sortable.find('.sortable-item-container').map((i, el) -> $(el).data('sortableId')).toArray()
          if callback = controller.sortableUpdate
            callback.call(controller, ids)


