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() {
|
2012-07-28 18:33:07 -07:00
|
|
|
if (this.model) {
|
|
|
|
this.model.profile_thumb_view = this;
|
|
|
|
}
|
2012-06-02 16:33:44 -07:00
|
|
|
},
|
|
|
|
|
|
|
|
render: function() {
|
|
|
|
var $profile = $.make('div', { className: 'NB-user-avatar', title: this.model.get('username') }, [
|
2013-03-06 16:49:23 -08:00
|
|
|
(this.model.get('private') && $.make('img', { src: NEWSBLUR.Globals.MEDIA_URL + 'img/icons/circular/g_icn_lock.png', className: 'NB-user-avatar-private' })),
|
2012-10-24 17:01:22 -07:00
|
|
|
$.make('img', { src: this.model.get('photo_url'), className: 'NB-user-avatar-image' })
|
2012-06-02 16:33:44 -07:00
|
|
|
]).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);
|
|
|
|
}
|
|
|
|
|
|
|
|
}, {
|
2012-06-05 18:12:34 -07:00
|
|
|
|
2012-06-02 16:33:44 -07:00
|
|
|
create: function(user_id, options) {
|
|
|
|
var user = NEWSBLUR.assets.user_profiles.find(user_id);
|
2012-07-15 19:29:05 -07:00
|
|
|
if (!user && user_id == NEWSBLUR.Globals.user_id) {
|
|
|
|
user = NEWSBLUR.assets.user_profile;
|
|
|
|
}
|
2012-07-28 17:14:28 -07:00
|
|
|
if (user) {
|
|
|
|
return new NEWSBLUR.Views.ProfileThumb(_.extend({}, {model: user}, options));
|
|
|
|
}
|
2012-06-02 16:33:44 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
});
|