wip dennis

This commit is contained in:
Maxwell Salzberg 2012-05-30 14:42:32 -07:00 committed by Dennis Collinson
parent 51d71bf394
commit d926529ad7
3 changed files with 27 additions and 9 deletions

View file

@ -28,6 +28,8 @@ app.pages.Stream = app.views.Base.extend({
this.streamView = new app.views.NewStream({ model : this.stream }) this.streamView = new app.views.NewStream({ model : this.stream })
var interactions = this.interactionsView = new app.views.StreamInteractions() var interactions = this.interactionsView = new app.views.StreamInteractions()
this.setUpThrottledInteractionScroll();
this.stream.on("frame:interacted", function(post){ this.stream.on("frame:interacted", function(post){
interactions.setInteractions(post) interactions.setInteractions(post)
}) })
@ -35,11 +37,22 @@ app.pages.Stream = app.views.Base.extend({
postRenderTemplate : function() { postRenderTemplate : function() {
this.$("#header").css("background-image", "url(" + app.currentUser.get("wallpaper") + ")") this.$("#header").css("background-image", "url(" + app.currentUser.get("wallpaper") + ")")
$('body').scrollspy({target : '.stream-frame-wrapper'})
setTimeout(_.bind(this.refreshScrollSpy, this), 2000) _.defer(function(){$('body').scrollspy({target : '.stream-frame-wrapper', offset : 50})})
this.setUpHashChangeOnStreamLoad() this.setUpHashChangeOnStreamLoad()
}, },
setUpThrottledInteractionScroll : function(){
this.focusedPost = undefined;
var self = this;
this.updateInteractions = _.throttle(function(){
console.log("firing for " + self.focusedPost.get('id'));
self.interactionsView.setInteractions(self.focusedPost)
}, 1000)
},
setUpHashChangeOnStreamLoad : function(){ setUpHashChangeOnStreamLoad : function(){
var self = this; var self = this;
this.streamView.on('loadMore', function(){ this.streamView.on('loadMore', function(){
@ -47,6 +60,7 @@ app.pages.Stream = app.views.Base.extend({
if(post){ if(post){
self.navigateToPost(post) self.navigateToPost(post)
} }
self.refreshScrollSpy()
}); });
}, },
@ -55,16 +69,18 @@ app.pages.Stream = app.views.Base.extend({
}, },
},
triggerInteractionLoad : function(evt){ triggerInteractionLoad : function(evt){
var post = this.stream.items.get($(evt.target).data("id")) var id = $(evt.target).data("id");
this.interactionsView.setInteractions(post) console.log("calling triggerInteractiosns for: " + id)
this.focusedPost = this.stream.items.get(id)
this.updateInteractions()
}, },
//on active guid => this guid //on active guid => this guid
// fire interacted from stream collection w/guid // fire interacted from stream collection w/guid
refreshScrollSpy : function(){ refreshScrollSpy : function(){
$('body').scrollspy('refresh') setTimeout(function(){
$('body').scrollspy('refresh')
}, 2000)
} }
}); });

View file

@ -109,8 +109,6 @@
active = $(selector) active = $(selector)
.addClass('active') .addClass('active')
console.log(active)
active.trigger('activate') active.trigger('activate')
} }

View file

@ -438,6 +438,10 @@ color: white;
margin-top : 11px; margin-top : 11px;
} }
} }
.active {
border: 10px solid red;
}
} }
.canvas-frame { .canvas-frame {