make stream infininte scroll view static method on the page

This commit is contained in:
Dennis Collinson 2012-05-30 16:57:41 -07:00
parent a9288daf19
commit a7ced3f77b

View file

@ -1,12 +1,3 @@
app.views.NewStream = app.views.InfScroll.extend({
initialize: function(){
this.stream = this.model
this.collection = this.stream.items
this.postClass = app.views.Post.StreamFrame
this.setupInfiniteScroll()
}
});
app.pages.Stream = app.views.Base.extend({ app.pages.Stream = app.views.Base.extend({
templateName : "stream", templateName : "stream",
@ -23,7 +14,7 @@ app.pages.Stream = app.views.Base.extend({
this.stream = this.model = new app.models.Stream() this.stream = this.model = new app.models.Stream()
this.stream.preloadOrFetch() this.stream.preloadOrFetch()
this.streamView = new app.views.NewStream({ model : this.stream }) this.streamView = new app.pages.Stream.InfiniteScrollView({ model : this.stream })
var interactions = this.interactionsView = new app.views.StreamInteractions() var interactions = this.interactionsView = new app.views.StreamInteractions()
this.stream.on("frame:interacted", function(post){ this.stream.on("frame:interacted", function(post){
@ -65,4 +56,16 @@ app.pages.Stream = app.views.Base.extend({
refreshScrollSpy : function(){ refreshScrollSpy : function(){
_.defer($('body').scrollspy('refresh')) _.defer($('body').scrollspy('refresh'))
} }
},
//static methods
{
InfiniteScrollView : app.views.InfScroll.extend({
initialize: function(){
this.stream = this.model
this.collection = this.stream.items
this.postClass = app.views.Post.StreamFrame
this.setupInfiniteScroll()
}
})
}); });