Fixed social image in activity sizing

This commit is contained in:
Fergal Moran
2013-02-07 20:15:29 +00:00
parent 227c089602
commit c86cab9b4a
5 changed files with 41 additions and 40 deletions

View File

@@ -25,8 +25,8 @@ class ActivityResource(BackboneCompatibleResource):
user_profile = bundle.obj.user.get_profile().get_profile_url()
else:
user_name = "Anonymous user"
user_image = ""
user_profile = UserProfile.get_default_avatar_image()
user_image = UserProfile.get_default_avatar_image()
user_profile = ""
bundle.data["verb"] = bundle.obj.get_verb_passed(),
bundle.data["object"] = bundle.obj.get_object_singular(),
@@ -49,6 +49,6 @@ class ActivityResource(BackboneCompatibleResource):
def alter_list_data_to_serialize(self, request, data):
return [i for i in data['objects'] if i is not None and i.obj.user is not None and i.obj.get_object_name is not None and i.obj.get_object_url is not None]
"""
def dehydrate_date(self, bundle):
return self.humanize_date(bundle.obj.date)

View File

@@ -134,7 +134,7 @@ class UserProfile(_BaseModel):
if social_account:
provider = social_account.get_provider_account()
return provider.get_avatar_url()
except:
except Exception, ex:
pass
elif avatar_type == 'custom' or avatar_type:
return self.avatar_image.name

View File

@@ -591,4 +591,5 @@ div.event-content td {
.activity-list-item{
margin-bottom: 5px;
margin-left: 5px;
}
}

View File

@@ -1,33 +1,33 @@
/** @license
----------------------------------------------
Copyright (c) 2012, Fergal Moran. All rights reserved.
Code provided under the BSD License:
*/
window.ActivityListItemView = Backbone.View.extend({
tagName:"li",
initialize:function () {
$(this.el).data("id", this.model.get("id"));
$(this.el).addClass("activity-entry");
},
render:function () {
$(this.el).html(this.template({"item":this.model.toJSON()}));
return this;
}
});
window.ActivityListView = Backbone.View.extend({
initialize:function () {
//this.collection.bind('add', this.render);
this.render();
},
render:function () {
$(this.el).html(this.template()).append('<ul class="activity-listing list-nostyle"></ul>');
this.collection.each(function (item) {
$('.activity-listing', this.el).append(new ActivityListItemView({model:item}).render().el);
}, this);
return this;
}
});
/** @license
----------------------------------------------
Copyright (c) 2012, Fergal Moran. All rights reserved.
Code provided under the BSD License:
*/
window.ActivityListItemView = Backbone.View.extend({
tagName:"li",
initialize:function () {
$(this.el).data("id", this.model.get("id"));
$(this.el).addClass("media");
},
render:function () {
$(this.el).html(this.template({"item":this.model.toJSON()}));
return this;
}
});
window.ActivityListView = Backbone.View.extend({
initialize:function () {
//this.collection.bind('add', this.render);
this.render();
},
render:function () {
$(this.el).html(this.template()).append('<ul class="activity-listing media-list"></ul>');
this.collection.each(function (item) {
$('.activity-listing', this.el).append(new ActivityListItemView({model:item}).render().el);
}, this);
return this;
}
});

View File

@@ -1,8 +1,9 @@
{% load account_tags %}
<div class="media bordered-faint activity-list-item">
<a class="pull-left" href="#">
<img class="media-object" data-src="<%= item.user_image %>" alt="">
<img class="media-object image-avatar-small" src="<%= item.user_image %>" alt="">
</a>
<div class="media-body">
<div class="media">
<a class="activity-user" href="<%= item.user_profile %>">
@@ -13,4 +14,3 @@
</div>
</div>
</div>