daily pastebin goal
26%
SHARE
TWEET

Untitled

a guest Dec 13th, 2018 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class MasterCrm.Views.Organization.Index extends Backbone.View
  2.  
  3.   initialize: ->
  4.     @collection = new MasterCrm.Collections.Users()
  5.     @collection.on("reset change", @render_collection, this)
  6.     @collection.on "add", @append_element, this
  7.     $.fancybox.showActivity()
  8.     @collection.fetch()
  9.     @render()
  10.    
  11.   initialize_view: ->
  12.     @$("#add_user").unbind("click").click =>
  13.       new MasterCrm.Views.Organization.NewUser model: new MasterCrm.Models.User(), collection: @collection
  14.       return false
  15.  
  16.   append_element: (el) ->
  17.     new MasterCrm.Views.Organization.User el: @$("ul"), model: el
  18.  
  19.   render_collection: ->
  20.     @$("ul").html ""
  21.     @collection.each (user) => new MasterCrm.Views.Organization.User({el: @$("ul"),  model: user})
  22.     $.fancybox.hideActivity()
  23.  
  24.   render: ->
  25.     that = this
  26.     @template = _.template $("#organization_index").html(), {}
  27.     $(@el).html @template
  28.     @initialize_view()
  29.     this
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top