Sha256: 02aeed90c5ac424509ffd546e260e666823f46910e710039cbb52c9d8d1b6f66

Contents?: true

Size: 446 Bytes

Versions: 10

Compression:

Stored size: 446 Bytes

Contents

class @PositionSort

  constructor: (element) ->
    @element = $(element)
    @setBindings()

  setBindings: () =>
    @element.sortable(axis: 'y')
    @element.on( "sortupdate", @updatePosition)

  updatePosition: (event, ui) =>
    @element.find('.js-position').each((index, el) -> $(el).val(index+1))

$.fn.positionSort = () ->
  @each ->
    new PositionSort($(this))

jQuery ->
  $(".js-position-sort").each () ->
    $(this).positionSort()

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
georgia-0.8.0 app/assets/javascripts/georgia/components/position_sort.js.coffee
georgia-0.7.8 app/assets/javascripts/georgia/components/position_sort.js.coffee
georgia-0.7.7 app/assets/javascripts/georgia/components/position_sort.js.coffee
georgia-0.7.6 app/assets/javascripts/georgia/components/position_sort.js.coffee
georgia-0.7.5 app/assets/javascripts/georgia/components/position_sort.js.coffee
georgia-0.7.4 app/assets/javascripts/georgia/components/position_sort.js.coffee
georgia-0.7.3 app/assets/javascripts/georgia/components/position_sort.js.coffee
georgia-0.7.2 app/assets/javascripts/georgia/components/position_sort.js.coffee
georgia-0.7.1 app/assets/javascripts/georgia/components/position_sort.js.coffee
georgia-0.7.0 app/assets/javascripts/georgia/components/position_sort.js.coffee