Sha256: d531c0b0e5a897eb65fe68aeaacea31f384971bc961b88e1288c2a9e6703b037
Contents?: true
Size: 1.05 KB
Versions: 2
Compression:
Stored size: 1.05 KB
Contents
namespace "SensuDashboard.Views", (exports) -> class exports.List extends SensuDashboard.Views.Base collectionEl: "tbody" itemName: "list_item" itemClass: -> exports.ListItem itemView: (model) -> kls = @itemClass() view = new kls(model: model, name: @itemName) initialize: -> @listenTo(@collection, "remove", @renderEmpty) @listenTo(@collection, "reset", @render) @listenTo(@collection, "add", @render) addItem: (item) -> @renderItem(item) @collection.sort() renderItem: (item) -> item_view = @itemView(item) @$el.find(@collectionEl).append(item_view.render().el) renderCollection: (collection = @collection) -> unless @renderEmpty(collection) collection.each (item) => @renderItem(item) renderEmpty: (collection = @collection) -> if collection.isEmpty() tmpl = HandlebarsTemplates["empty_list"] @$el.html(tmpl()) true else false render: -> @$el.html(@template()) @renderCollection()
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sensu-dashboard-0.10.0 | lib/sensu-dashboard/assets/javascripts/views/list.coffee |
sensu-dashboard-0.9.9 | lib/sensu-dashboard/assets/javascripts/views/list.coffee |