- This gives the user the sense of what he/she is currently viewing - The hover/selected are the same right now. Needs to change. - Need to find a more meaningful place for `markSelected` Moved markSelected to app.views.Stream - Removes duplication - All streams create this view, and this seems to do some setup on initializing, which is a good place to markNavSelected Changing highlight on hover to 'black' instead of the blue - The blue was a little intruisive - Also fixes the vertical alignment issue Changing the background to bluebg on hover
40 lines
1.1 KiB
JavaScript
40 lines
1.1 KiB
JavaScript
//= require ./stream/shortcuts
|
|
|
|
app.views.Stream = app.views.InfScroll.extend(_.extend(
|
|
app.views.StreamShortcuts, {
|
|
|
|
initialize: function(options) {
|
|
this.stream = this.model
|
|
this.collection = this.stream.items
|
|
|
|
this.postViews = []
|
|
|
|
this.setupNSFW()
|
|
this.setupLightbox()
|
|
this.setupInfiniteScroll()
|
|
this.setupShortcuts()
|
|
this.markNavSelected()
|
|
},
|
|
|
|
postClass : app.views.StreamPost,
|
|
|
|
setupLightbox : function(){
|
|
this.lightbox = Diaspora.BaseWidget.instantiate("Lightbox");
|
|
this.$el.delegate("a.stream-photo-link", "click", this.lightbox.lightboxImageClicked);
|
|
},
|
|
|
|
setupNSFW : function(){
|
|
app.currentUser.bind("nsfwChanged", reRenderPostViews, this)
|
|
|
|
function reRenderPostViews() {
|
|
_.map(this.postViews, function(view){ view.render() })
|
|
}
|
|
},
|
|
|
|
markNavSelected : function() {
|
|
var activeStream = Backbone.history.fragment;
|
|
var streamSelection = $("#stream_selection");
|
|
streamSelection.find("[data-stream]").removeClass("selected");
|
|
streamSelection.find("[data-stream='" + activeStream + "']").addClass("selected");
|
|
}
|
|
}));
|