Skip to content

Commit

Permalink
[skip] Added an integration hook for when views have been added or re…
Browse files Browse the repository at this point in the history
…moved (1m)
  • Loading branch information
boblail committed Mar 30, 2016
1 parent c03a45f commit 2cff830
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion vendor/assets/javascripts/neat/renderer/basic.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,29 @@ class window.Neat.Renderer.Basic
view.render()
$(view.el).insertBeforeChildOrAppendTo @$ul, ".neat-row:eq(#{newIndex})"
@views.splice(newIndex, 0, view)
@_viewAddedAt(view, newIndex)

_moveView: (oldIndex, newIndex) ->
$el = $ @views[oldIndex].el
$el.detach().insertBeforeChildOrAppendTo @$ul, ".neat-row:eq(#{newIndex})"

view = @views.splice(oldIndex, 1)[0]
@views.splice(newIndex, 0, view)
@_viewRemovedAt(view, oldIndex)
@_viewAddedAt(view, newIndex)

_removeView: (oldIndex) ->
@views[oldIndex].remove()
@views.splice(oldIndex, 1)
view = @views.splice(oldIndex, 1)[0]
@_viewRemovedAt(view, oldIndex)



_viewAddedAt: (view, index) ->
# do nothing

_viewRemovedAt: (view, index) ->
# do nothing



Expand Down

0 comments on commit 2cff830

Please sign in to comment.