/
people.js.coffee
52 lines (32 loc) · 984 Bytes
/
people.js.coffee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
class Person extends Backbone.Model
#url: "/people/" + @id,
#name: "default name",
#initialize: ->
# @people = new PersonCollection
class PersonCollection extends Backbone.Collection
url: "/people",
model: Person
$ ->
collection = new PersonCollection
collection.fetch({
success: ->
html = $("#people").tmpl(collection)
$("body").append(html)
})
#collection.each (x) ->
# alert x
#a = new Person({name: "Hans"})
#a.fetch()
#a.set({name: "my second name"})
#a.name = "my second name";
#a.save()
#class PersonView extends Backbone.View
# el: ".my_id",
# render: ->
# template = ich.person(@model.attributes)
# $(@el).append(template)
#window.b = new PersonView({model: a})
#window.b.render()