Sha256: 1ef1fb54f3e1a28721a4ebbebe886c792e00bffd90e1f64fbfc365fce3de9979

Contents?: true

Size: 868 Bytes

Versions: 1

Compression:

Stored size: 868 Bytes

Contents

##########  List model ##############
class window.List
 min_show_number: 3
 show_number: @min_show_number

 constructor: (list_data, min_show_number, model, tracker_id)->
   @list = []
   @min_show_number = min_show_number if min_show_number
   @model = model
   @tracker_elem = $("<input id='#{tracker_id}' type='hidden'>")
   this.setList(list_data)

 getList: -> @list.slice(0, @show_number)

 # use this method to set a new list
 setList: (list_info)->
   @list = []
   # revert back to minimum show number
   @show_number = @min_show_number
   this.loadList(list_info)
   @tracker_elem.change()

 setShowNumber: (num)->
   @show_number = num
   @tracker_elem.change()

 # meant for internal use. use setList to set the list with info
 loadList: (list_info)->
   return unless list_info
   $.each( list_info, (index, data)=> @list.push(new @model(data, index)) )

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
medivo-0.2.24 app/assets/javascripts/medivo/models.coffee