summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvgeny Fadeev <evgeny.fadeev@gmail.com>2012-12-12 12:46:51 -0300
committerEvgeny Fadeev <evgeny.fadeev@gmail.com>2012-12-12 12:46:51 -0300
commit0550f1d8119d990915adc5dbc0ada9c3471f7545 (patch)
tree2cb86e2a32282f8e7dd4e9f9696c692e9b30ea8e
parenta70e6072dc2d609d2c58eabe4e7706a49c276dcd (diff)
downloadaskbot-0550f1d8119d990915adc5dbc0ada9c3471f7545.tar.gz
askbot-0550f1d8119d990915adc5dbc0ada9c3471f7545.tar.bz2
askbot-0550f1d8119d990915adc5dbc0ada9c3471f7545.zip
a small refactoring on the badges page
-rw-r--r--askbot/media/style/style.css11
-rw-r--r--askbot/templates/badges.html17
-rw-r--r--askbot/views/meta.py12
3 files changed, 19 insertions, 21 deletions
diff --git a/askbot/media/style/style.css b/askbot/media/style/style.css
index b23526f5..3ca80614 100644
--- a/askbot/media/style/style.css
+++ b/askbot/media/style/style.css
@@ -213,6 +213,7 @@ body.user-messages {
}
.wait-icon-box {
text-align: center;
+ margin-bottom: 8px;
}
#closeNotify {
position: absolute;
@@ -499,9 +500,6 @@ body.user-messages {
text-align: center;
padding-bottom: 10px;
}
-.search-drop-menu.empty {
- padding-bottom: 8px;
-}
.search-drop-menu.empty ul {
padding: 5px;
margin: 0;
@@ -536,6 +534,13 @@ input[type="submit"].searchBtn {
height: 0;
z-index: 0;
}
+.ask-page .search-drop-menu.empty {
+ border: none;
+ padding: 0;
+}
+.ask-page .search-drop-menu.empty ul {
+ padding: 0;
+}
.searchBtn:hover {
background: -146px -36px url(../images/sprites.png) no-repeat;
}
diff --git a/askbot/templates/badges.html b/askbot/templates/badges.html
index ce76e76b..e669b7d4 100644
--- a/askbot/templates/badges.html
+++ b/askbot/templates/badges.html
@@ -5,21 +5,16 @@
<h1 class="section-title">{% trans %}Badges{% endtrans %}</h1>
<p>
{% trans %}Community gives you awards for your questions, answers and votes.{% endtrans %}<br/>
-{% trans %}Below is the list of available badges and number
- of times each type of badge has been awarded. Have ideas about fun
-badges? Please, give us your <a href='{{feedback_faq_url}}'>feedback</a>
-{% endtrans %}
+{% trans %}Below is the list of available badges and number of times each type of badge has been awarded.{% endtrans %}
</p>
<div id="medalList">
{% for badge in badges %}
<div style="clear:both;line-height:30px">
- <div style="float:left;min-width:30px;text-align:right;height:30px">
- {% for a in mybadges %}
- {% if a.badge_id == badge.id %}
- <span style="font-size:175%; padding-right:5px; color:#5B9058;">&#10004;</span>
- {% endif %}
- {% endfor %}
- </div>
+ {% if badge.id in my_badge_ids %}
+ <div style="float:left;min-width:30px;text-align:right;height:30px">
+ <span style="font-size:175%; padding-right:5px; color:#5B9058;">&#10004;</span>
+ </div>
+ {% endif %}
<div style="float:left;width:230px;">
<a href="{{badge.get_absolute_url()}}"
title="{{badge.get_type_display()}} : {{badge.description}}"
diff --git a/askbot/views/meta.py b/askbot/views/meta.py
index d0c21965..092004e7 100644
--- a/askbot/views/meta.py
+++ b/askbot/views/meta.py
@@ -143,21 +143,19 @@ def badges(request):#user status/reputation system
raise Http404
known_badges = badge_data.BADGES.keys()
badges = BadgeData.objects.filter(slug__in = known_badges).order_by('slug')
- my_badges = []
+ my_badge_ids = list()
if request.user.is_authenticated():
- my_badges = Award.objects.filter(
+ my_badge_ids = Award.objects.filter(
user=request.user
- ).values(
- 'badge_id'
+ ).values_list(
+ 'badge_id', flat=True
).distinct()
- #my_badges.query.group_by = ['badge_id']
data = {
'active_tab': 'badges',
'badges' : badges,
'page_class': 'meta',
- 'mybadges' : my_badges,
- 'feedback_faq_url' : reverse('feedback'),
+ 'my_badge_ids' : my_badge_ids
}
return render(request, 'badges.html', data)