DH DG; added new routes for streams; fixed pagination
This commit is contained in:
parent
80f797a581
commit
3f7d992a0b
9 changed files with 28 additions and 12 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -1,5 +0,0 @@
|
|||
App.Routers.CommentStream = App.Routers.Stream.extend({
|
||||
routes: {
|
||||
"comment_stream": "stream"
|
||||
}
|
||||
});
|
||||
|
|
@ -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();
|
||||
}
|
||||
});
|
||||
|
|
|
|||
5
public/javascripts/routers/stream/comments.js
Normal file
5
public/javascripts/routers/stream/comments.js
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
App.Routers.Comments = App.Routers.Stream.extend({
|
||||
routes: {
|
||||
"comment_stream": "stream"
|
||||
}
|
||||
});
|
||||
5
public/javascripts/routers/stream/people.js
Normal file
5
public/javascripts/routers/stream/people.js
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
App.Routers.People = App.Routers.Stream.extend({
|
||||
routes: {
|
||||
"people/:id": "stream"
|
||||
}
|
||||
});
|
||||
5
public/javascripts/routers/stream/tag_followings.js
Normal file
5
public/javascripts/routers/stream/tag_followings.js
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
App.Routers.TagFollowings = App.Routers.Stream.extend({
|
||||
routes: {
|
||||
"tag_followings": "stream"
|
||||
}
|
||||
});
|
||||
5
public/javascripts/routers/stream/tags.js
Normal file
5
public/javascripts/routers/stream/tags.js
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
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'));
|
||||
},
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue