Created
August 30, 2012 16:47
-
-
Save Szeliga/3532886 to your computer and use it in GitHub Desktop.
Client list bb index
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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