Skip to content

Commit

Permalink
Merge pull request #211 from jajodiaraghav/patch_1
Browse files Browse the repository at this point in the history
Refactor code for /leaderboard
  • Loading branch information
Martti Sasi authored Jun 6, 2017
2 parents d90846a + 199b267 commit 4762f0a
Showing 1 changed file with 26 additions and 17 deletions.
43 changes: 26 additions & 17 deletions website/templates/leaderboard.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
{% extends "base.html" %}
{% load gravatar %}

{% block style %}
.list-group-item img {
width: 50px;
height: 50px;
}
.list-group-item .badge {
margin-top: 15px;
}
.list-group-item a {
text-decoration: none;
margin-left: 10px;
}
{% endblock %}

{% block content %}
<div class="row">
<div class="col-lg-6">
Expand All @@ -8,24 +23,18 @@ <h1 class="page-header">Global Leaderboard</h1>
</div>
<div class="row">
<div class="col-lg-9">
<div class="panel panel-default">

<div class="panel-body">
<div class="list-group" >
{% for leader in leaderboard %}
<div class="list-group-item">
{% if leader.socialaccount_set.all.0.get_avatar_url %}
<img src="{{leader.socialaccount_set.all.0.get_avatar_url}}" width="50" height="50">
{% else %}
{% gravatar leader.email 50 %}
{% endif %}
<a href="/profile/{{leader.username}}" style="margin-left:5px;">{{leader.username}}</a>
<span class="pull-right text-muted small"><em> {{leader.total_score}} points</em>
</span>
</div>
{% endfor %}
<div class="list-group">
{% for leader in leaderboard %}
<div class="list-group-item">
{% if leader.socialaccount_set.all.0.get_avatar_url %}
<img src="{{leader.socialaccount_set.all.0.get_avatar_url}}">
{% else %}
<img src="{% gravatar_url leader.email 50 %}">
{% endif %}
<a href="/profile/{{leader.username}}">{{leader.username}}</a>
<span class="pull-right badge">{{leader.total_score}} Points</span>
</div>
</div>
{% endfor %}
</div>
</div>
</div>
Expand Down

0 comments on commit 4762f0a

Please sign in to comment.