Permalink
Browse files

frontend

  • Loading branch information...
1 parent bf8f1e2 commit 5823d22c6d7af0129aeda825a751968840a2b366 @HalfdanJ HalfdanJ committed Oct 9, 2011
Showing with 18 additions and 6 deletions.
  1. +8 −3 html/coffee/main.coffee
  2. +1 −1 html/index.html
  3. +9 −2 html/javascripts/main.js
View
@@ -1,10 +1,11 @@
$ ()->
- jsonUrl = "http://illutron.johan.cc/"
+ jsonUrl = "http://illutron.johan.cc/api/"
window.Person = Backbone.Model.extend({
+ initialize: -> alert "asd"
defaults: ->
{
- "member": "-"
+ "username": "-"
}
url: ->
@@ -37,6 +38,9 @@ $ ()->
template: _.template($('#person-template').html())
initialize: ->
+ this.model.bind('change', this.render, this);
+ this.model.bind('destroy', this.remove, this);
+
this
render: ->
@@ -62,11 +66,12 @@ $ ()->
render: -> this
addAll: ->
+ alert "asd"
People.each(this.addPerson);
addPerson: (person) ->
- #alert person.url()
+ alert person.url()
view = new PersonView(model: person)
@$("#people-list").append view.render().el
View
@@ -27,7 +27,7 @@
<script type="text/template" id="person-template">
<div class="personbox <%= on_illutron == 1 ? 'activeperson' : '' %>">
<img src="http://illutron.johan.cc<%= image %>">
- <p class="person-name"><%= id %> - <%= member %></p>
+ <p class="person-name"><%= id %> - <%= username %></p>
</div>
</script>
View
@@ -1,11 +1,14 @@
(function() {
$(function() {
var jsonUrl;
- jsonUrl = "http://illutron.johan.cc/";
+ jsonUrl = "http://illutron.johan.cc/api/";
window.Person = Backbone.Model.extend({
+ initialize: function() {
+ return alert("asd");
+ },
defaults: function() {
return {
- "member": "-"
+ "username": "-"
};
},
url: function() {
@@ -29,6 +32,8 @@
tagName: "div",
template: _.template($('#person-template').html()),
initialize: function() {
+ this.model.bind('change', this.render, this);
+ this.model.bind('destroy', this.remove, this);
return this;
},
render: function() {
@@ -53,10 +58,12 @@
return this;
},
addAll: function() {
+ alert("asd");
return People.each(this.addPerson);
},
addPerson: function(person) {
var view;
+ alert(person.url());
view = new PersonView({
model: person
});

0 comments on commit 5823d22

Please sign in to comment.