display badges on user profiles [#29340547]

pull/1/head
eric 2012-09-22 23:55:07 -04:00
parent 8611f73382
commit 4b49b1df4b
6 changed files with 32 additions and 8 deletions

View File

@ -895,6 +895,10 @@ class Badge(models.Model):
name = models.CharField(max_length=72, blank=True) name = models.CharField(max_length=72, blank=True)
description = models.TextField(default='', null=True) description = models.TextField(default='', null=True)
@property
def path(self):
return '/static/images/%s.png' % self.name
#class CampaignSurveyResponse(models.Model): #class CampaignSurveyResponse(models.Model):
# # generic # # generic
# campaign = models.ForeignKey("Campaign", related_name="surveyresponse", null=False) # campaign = models.ForeignKey("Campaign", related_name="surveyresponse", null=False)

View File

@ -92,6 +92,13 @@ there's no tab for seeing ALL my books, only the filters! huh.
{% ifequal supporter request.user %} {% ifequal supporter request.user %}
<div id="user-block1"> <div id="user-block1">
<div class="block-inner"> <div class="block-inner">
<span class="my-setting">My Profile
<span class="user-badges">
{% for badge in supporter.profile.badges.all %}
<img class="user-badge" src="{{ badge.path }}" alt="{{ badge.description }}" title="{{ badge.description }}" />
{% endfor %}
</span>
</span>
</div> </div>
</div> </div>
<div class="user-block2"> <div class="user-block2">
@ -112,6 +119,10 @@ there's no tab for seeing ALL my books, only the filters! huh.
<img class="user-avatar" src="/static/images/header/avatar.png" height="50" width="50" alt="Generic Ungluer Avatar" title="Ungluer" /> <img class="user-avatar" src="/static/images/header/avatar.png" height="50" width="50" alt="Generic Ungluer Avatar" title="Ungluer" />
{% endif %} {% endif %}
<span class="user-name"><a href="#">{{ supporter.username }}</a></span> <span class="user-name"><a href="#">{{ supporter.username }}</a></span>
<span class="user-badges">
{% for badge in supporter.profile.badges.all %}
<img src="{{ badge.path }}" alt="{{ badge.description }}" title="{{ badge.description }}" />
{% endfor %}
</div> </div>
</div> </div>
<div class="user-block2"> <div class="user-block2">

View File

@ -195,6 +195,12 @@ img.user-avatar {
-webkit-border-radius: 7px; -webkit-border-radius: 7px;
border-radius: 7px; border-radius: 7px;
} }
img.user-badge{
vertical-align:middle;
}
.user-badges{
font-size:32px;
}
.social { .social {
width: 100%; width: 100%;
} }
@ -207,7 +213,6 @@ span.special-user-name {
height: 50px; height: 50px;
} }
span.user-name, span.user-name,
span.user-date,
span.user-short-info { span.user-short-info {
display: block; display: block;
} }
@ -313,10 +318,10 @@ span.my-setting {
-moz-border-radius: 7px; -moz-border-radius: 7px;
-webkit-border-radius: 7px; -webkit-border-radius: 7px;
border-radius: 7px; border-radius: 7px;
height: 50px; height: 40px;
line-height: 50px; line-height: 40px;
display: block; display: block;
padding: 0 0 0 10px; padding: 0 0 10px 10px;
font-size: 19px; font-size: 19px;
font-weight: bold; font-weight: bold;
cursor: pointer; cursor: pointer;

BIN
static/images/pledger.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
static/images/pledger2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -120,7 +120,12 @@ img.user-avatar {
margin-right:10px; margin-right:10px;
.one-border-radius(7px); .one-border-radius(7px);
} }
img.user-badge{
vertical-align:middle;
}
.user-badges{
font-size:32px;
}
.social { .social {
width:100%; width:100%;
} }
@ -135,7 +140,6 @@ span.special-user-name {
} }
span.user-name, span.user-name,
span.user-date,
span.user-short-info { span.user-short-info {
display: block; display: block;
} }
@ -234,9 +238,9 @@ input.profile-save {
span.my-setting { span.my-setting {
background:@blue-grey url("@{image-base}header/explane.png") 90% center no-repeat; background:@blue-grey url("@{image-base}header/explane.png") 90% center no-repeat;
.one-border-radius(7px); .one-border-radius(7px);
.height(50px); .height(40px);
display:block; display:block;
padding:0 0 0 10px; padding:0 0 10px 10px;
font-size: @font-size-header; font-size: @font-size-header;
font-weight: bold; font-weight: bold;
cursor:pointer; cursor:pointer;