diaspora/app/assets/javascripts/app/views/stream_faces_view.js
Florian Staudacher 8eb70c8a80 use app.models.Stream instead of app.models.Photos,
change naming a bit to be more general since its posts+photos now
(re #3158)
2012-04-18 20:20:56 +02:00

29 lines
661 B
JavaScript

app.views.StreamFaces = app.views.Base.extend({
templateName : "stream-faces",
className : "stream-faces",
tooltipSelector : ".avatar",
initialize : function(){
this.updatePeople()
app.stream.items.bind("add", this.updatePeople, this)
},
presenter : function() {
return {people : this.people}
},
updatePeople : function(){
if(this.people && this.people.length >= 15) { return }
this.people = _(this.collection.models).chain()
.map(function(post){ return post.get("author") })
.compact()
.uniq(false, function(person){ return person.id })
.value()
.slice(0,15);
this.render();
}
});