Sha256: f6b01fe5ca2caaa7292162699ba724d1401b3f7b3150cd97b65e4ccd79aaaabe

Contents?: true

Size: 904 Bytes

Versions: 9

Compression:

Stored size: 904 Bytes

Contents

Locomotive.Views.ContentEntries ||= {}

class Locomotive.Views.ContentEntries.IndexView extends Backbone.View

  el: '#content'

  render: ->
    @make_sortable()

    return @

  make_sortable: ->
    self = @

    @$('ul#entries-list.sortable').sortable
      handle: 'span.handle'
      items:  'li.item'
      axis:   'y'
      update: (event, ui) -> self.call_sort $(@)

  call_sort: (folder) ->
    $.rails.ajax
      url:        folder.data('url')
      type:       'post'
      dataType:   'json'
      data:
        entries: (_.map folder.sortable('toArray'), (el) -> el.replace('entry-', ''))
        _method:  'put'
      success:    @.on_successful_sort
      error:      @.on_failed_sort

  on_successful_sort: (data, status, xhr) ->
    $.growl('success', xhr.getResponseHeader('X-Message'))

  on_failed_sort: (data, status, xhr) ->
    $.growl('error', xhr.getResponseHeader('X-Message'))

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
locomotive_cms-2.1.4 app/assets/javascripts/locomotive/views/content_entries/index_view.js.coffee
locomotive_cms-2.1.3 app/assets/javascripts/locomotive/views/content_entries/index_view.js.coffee
locomotive_cms-2.1.2 app/assets/javascripts/locomotive/views/content_entries/index_view.js.coffee
locomotive_cms-2.1.1 app/assets/javascripts/locomotive/views/content_entries/index_view.js.coffee
locomotive_cms-2.1.0 app/assets/javascripts/locomotive/views/content_entries/index_view.js.coffee
locomotive_cms-2.0.3 app/assets/javascripts/locomotive/views/content_entries/index_view.js.coffee
locomotive_cms-2.0.2 app/assets/javascripts/locomotive/views/content_entries/index_view.js.coffee
locomotive_cms-2.0.1 app/assets/javascripts/locomotive/views/content_entries/index_view.js.coffee
locomotive_cms-2.0.0 app/assets/javascripts/locomotive/views/content_entries/index_view.js.coffee