Commit 3f7d992a authored by danielgrippi's avatar danielgrippi Committed by Dennis Collinson

DH DG; added new routes for streams; fixed pagination

parent 80f797a5
......@@ -20,8 +20,8 @@ javascripts:
- public/javascripts/collections/*
- public/javascripts/views/*
- public/javascripts/routers/stream.js
- public/javascripts/routers/*
- public/javascripts/routers/stream/*
- public/javascripts/rails.validations.js
- public/javascripts/rails.js
......
......@@ -5,5 +5,8 @@ App.Routers.Stream = Backbone.Router.extend({
stream: function() {
App.stream = new App.Views.Stream;
$("#main_stream").html(App.stream.el);
App.stream.loadMore();
}
});
App.Routers.CommentStream = App.Routers.Stream.extend({
App.Routers.Comments = App.Routers.Stream.extend({
routes: {
"comment_stream": "stream"
}
......
App.Routers.People = App.Routers.Stream.extend({
routes: {
"people/:id": "stream"
}
});
App.Routers.TagFollowings = App.Routers.Stream.extend({
routes: {
"tag_followings": "stream"
}
});
App.Routers.Tags = App.Routers.Stream.extend({
routes: {
"tags/:id": "stream"
}
});
......@@ -3,14 +3,11 @@ App.Views.Stream = Backbone.View.extend({
"click #paginate": "loadMore"
},
initialize: function(){
this.el = $("#main_stream");
_.bindAll(this, "appendPost", "collectionFetched");
initialize: function() {
_.bindAll(this, "appendPost", "collectionFetched", "loadMore");
this.collection = new App.Collections.Stream;
this.collection.bind("add", this.appendPost);
this.loadMore();
},
appendPost: function(post) {
......@@ -23,7 +20,8 @@ App.Views.Stream = Backbone.View.extend({
this.$("#paginate").remove();
$(this.el).append($("<a>", {
href: this.collection.url(),
id: "paginate"
id: "paginate",
"class": "paginate"
}).text('more'));
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment