2012-06-02 16:33:44 -07:00
|
|
|
NEWSBLUR.Views.ProfileThumb = Backbone.View.extend({
|
|
|
|
|
|
|
|
className: 'NB-story-share-profile',
|
|
|
|
|
|
|
|
events: {
|
|
|
|
"click .NB-user-avatar": "open_social_profile_modal"
|
|
|
|
},
|
|
|
|
|
|
|
|
initialize: function() {
|
|
|
|
this.model.profile_thumb_view = this;
|
|
|
|
},
|
|
|
|
|
|
|
|
render: function() {
|
|
|
|
var $profile = $.make('div', { className: 'NB-user-avatar', title: this.model.get('username') }, [
|
|
|
|
$.make('img', { src: this.model.get('photo_url') })
|
|
|
|
]).tipsy({
|
|
|
|
delayIn: 50,
|
|
|
|
gravity: 's',
|
|
|
|
fade: true,
|
|
|
|
offset: 3
|
|
|
|
});
|
|
|
|
|
|
|
|
this.$el.html($profile);
|
|
|
|
|
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
|
|
|
open_social_profile_modal: function() {
|
|
|
|
this.$('.NB-user-avatar').tipsy('hide');
|
|
|
|
NEWSBLUR.reader.open_social_profile_modal(this.model.id);
|
|
|
|
}
|
|
|
|
|
|
|
|
}, {
|
|
|
|
create: function(user_id, options) {
|
|
|
|
var user = NEWSBLUR.assets.user_profiles.find(user_id);
|
2012-06-05 16:18:30 -07:00
|
|
|
if (user && user.profile_thumb_view) {
|
2012-06-02 16:33:44 -07:00
|
|
|
return user.profile_thumb_view;
|
|
|
|
}
|
2012-06-05 16:18:30 -07:00
|
|
|
if (!user) {
|
|
|
|
console.log(["User not found", NEWSBLUR.assets.user_profiles, user_id]);
|
|
|
|
}
|
2012-06-02 16:33:44 -07:00
|
|
|
|
|
|
|
return new NEWSBLUR.Views.ProfileThumb(_.extend({}, {model: user}, options));
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|