pass event to shouldAllow* methods

This commit is contained in:
Justin Palmer
2013-02-11 08:17:32 -08:00
parent ffbc0ab45c
commit ae841c2bf7
2 changed files with 5 additions and 5 deletions

View File

@@ -14,7 +14,7 @@ class SortableList extends View
@on 'drop', '.sortable', @onDrop
onDragStart: (event) =>
return false if !@shouldAllowDrag()
return false if !@shouldAllowDrag(event)
el = @getSortableElement(event)
el.addClass 'is-dragging'
@@ -34,14 +34,14 @@ class SortableList extends View
@getSortableElement(event).removeClass 'is-drop-target'
onDrop: (event) =>
return false if !@shouldAllowDrop()
return false if !@shouldAllowDrop(event)
event.stopPropagation()
@find('.is-drop-target').removeClass 'is-drop-target'
shouldAllowDrag: ->
shouldAllowDrag: (event) ->
true
shouldAllowDrop: ->
shouldAllowDrop: (event) ->
true
getDroppedElement: (event) ->

View File

@@ -45,7 +45,7 @@ class TabView extends SortableList
removeTabAtIndex: (index) ->
@find(".tab:eq(#{index})").remove()
shouldAllowDrag: ->
shouldAllowDrag: (event) ->
panes = rootView.find('.pane')
!(panes.length == 1 && panes.find('.sortable').length == 1)