Skip to content

Instantly share code, notes, and snippets.

@Szeliga
Created August 30, 2012 16:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Szeliga/3532886 to your computer and use it in GitHub Desktop.
Save Szeliga/3532886 to your computer and use it in GitHub Desktop.
Client list bb index
class MasterCrm.Views.Organization.Index extends Backbone.View
initialize: ->
@collection = new MasterCrm.Collections.Users()
@collection.on("reset change", @render_collection, this)
@collection.on "add", @append_element, this
$.fancybox.showActivity()
@collection.fetch()
@render()
initialize_view: ->
@$("#add_user").unbind("click").click =>
new MasterCrm.Views.Organization.NewUser model: new MasterCrm.Models.User(), collection: @collection
return false
append_element: (el) ->
new MasterCrm.Views.Organization.User el: @$("ul"), model: el
render_collection: ->
@$("ul").html ""
@collection.each (user) => new MasterCrm.Views.Organization.User({el: @$("ul"), model: user})
$.fancybox.hideActivity()
render: ->
that = this
@template = _.template $("#organization_index").html(), {}
$(@el).html @template
@initialize_view()
this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment