Sha256: 81d95849d1ab37c102343b75a11206801d00a2bd5da7dd5d7b96aad7842f6f53

Contents?: true

Size: 966 Bytes

Versions: 21

Compression:

Stored size: 966 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', decodeURIComponent $.parseJSON xhr.getResponseHeader('X-Message'))

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

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
locomotive_cms-2.5.7 app/assets/javascripts/locomotive/views/content_entries/index_view.js.coffee
locomotive_cms-2.5.6 app/assets/javascripts/locomotive/views/content_entries/index_view.js.coffee
locomotive_cms-2.5.6.rc2 app/assets/javascripts/locomotive/views/content_entries/index_view.js.coffee
locomotive_cms-2.5.6.rc1 app/assets/javascripts/locomotive/views/content_entries/index_view.js.coffee
locomotive_cms-2.5.5 app/assets/javascripts/locomotive/views/content_entries/index_view.js.coffee
locomotive_cms-2.5.4 app/assets/javascripts/locomotive/views/content_entries/index_view.js.coffee
locomotive_cms-2.5.3 app/assets/javascripts/locomotive/views/content_entries/index_view.js.coffee
locomotive_cms-2.5.2 app/assets/javascripts/locomotive/views/content_entries/index_view.js.coffee
locomotive_cms-2.5.1 app/assets/javascripts/locomotive/views/content_entries/index_view.js.coffee
locomotive_cms-2.5.0 app/assets/javascripts/locomotive/views/content_entries/index_view.js.coffee
locomotive_cms-2.5.0.rc3 app/assets/javascripts/locomotive/views/content_entries/index_view.js.coffee
locomotive_cms-2.5.0.rc2 app/assets/javascripts/locomotive/views/content_entries/index_view.js.coffee
locomotive_cms-2.5.0.rc1 app/assets/javascripts/locomotive/views/content_entries/index_view.js.coffee
locomotive_cms-2.4.1 app/assets/javascripts/locomotive/views/content_entries/index_view.js.coffee
locomotive_cms-2.4.0 app/assets/javascripts/locomotive/views/content_entries/index_view.js.coffee
locomotive_cms-2.3.1 app/assets/javascripts/locomotive/views/content_entries/index_view.js.coffee
locomotive_cms-2.3.0 app/assets/javascripts/locomotive/views/content_entries/index_view.js.coffee
locomotive_cms-2.2.3 app/assets/javascripts/locomotive/views/content_entries/index_view.js.coffee
locomotive_cms-2.2.2 app/assets/javascripts/locomotive/views/content_entries/index_view.js.coffee
locomotive_cms-2.2.1 app/assets/javascripts/locomotive/views/content_entries/index_view.js.coffee