Core libraries and tools part for pro architecture. It's a submodule - use from this perspective http://git.maniak.pro/madmaniak/pro
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

27 lines
612 B

class Collection.Dynamic extends Collection.Static
prev: ->
if @dynamic_prev
then @go dynamic: @scope, @dynamic
else super
next: ->
if @dynamic_next
then @go dynamic: @scope, @dynamic
else super
dynamic: (scope) ->
L.each scope, (id) => @add_id(id)
@_dynamic_flags(scope)
_dynamic_flags: (scope) ->
@dynamic_prev = false if L.includes scope, @scope[0]
@dynamic_next = false if L.includes scope, L.last(@scope)
reorder: (i) ->
i = super(i)
if i == @elements().length - 1
@dynamic_next = true
else if i == 0
@dynamic_prev = true
i