summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--askbot/doc/source/customizing-skin-in-askbot.rst2
-rw-r--r--askbot/media/bootstrap/css/bootstrap.css1
-rw-r--r--askbot/media/style/style.css62
-rw-r--r--askbot/media/style/style.less67
-rw-r--r--askbot/models/__init__.py19
-rw-r--r--askbot/templates/badge.html14
-rw-r--r--askbot/templates/macros.html24
-rw-r--r--askbot/templates/question/question_card.html66
-rw-r--r--askbot/templates/users.html6
-rw-r--r--askbot/templates/widgets/question_summary.html1
-rw-r--r--askbot/templates/widgets/user_card.html33
-rw-r--r--askbot/templates/widgets/user_list.html34
-rw-r--r--askbot/templates/widgets/user_long_score_and_badge_summary.html4
-rw-r--r--askbot/templates/widgets/user_score_and_badge_summary.html23
14 files changed, 193 insertions, 163 deletions
diff --git a/askbot/doc/source/customizing-skin-in-askbot.rst b/askbot/doc/source/customizing-skin-in-askbot.rst
index e384a314..f8cf82a5 100644
--- a/askbot/doc/source/customizing-skin-in-askbot.rst
+++ b/askbot/doc/source/customizing-skin-in-askbot.rst
@@ -338,8 +338,6 @@ which file is called is in the following table.
+----------------------------+-----------------------------+--------------------------------+
| /badges/ | badges.html | |
+----------------------------+-----------------------------+--------------------------------+
-| /badges/<id>/ | badge.html | user_score_and_badge_summary |
-+----------------------------+-----------------------------+--------------------------------+
| /account/logout/ | authopenid/logout.html | |
+----------------------------+-----------------------------+--------------------------------+
| /faq/ | faq.html | |
diff --git a/askbot/media/bootstrap/css/bootstrap.css b/askbot/media/bootstrap/css/bootstrap.css
index 71c4e217..7e74f6a7 100644
--- a/askbot/media/bootstrap/css/bootstrap.css
+++ b/askbot/media/bootstrap/css/bootstrap.css
@@ -396,7 +396,6 @@ h6 {
ul,
ol {
padding: 0;
- margin: 0 0 9px 25px;
}
ul ul,
ul ol,
diff --git a/askbot/media/style/style.css b/askbot/media/style/style.css
index 58f95f91..69444ec8 100644
--- a/askbot/media/style/style.css
+++ b/askbot/media/style/style.css
@@ -750,7 +750,7 @@ form.ajax-file-upload img.spinner {
font-size: 20px;
height: 42px;
line-height: 44px;
- margin-top: 6px;
+ margin: 6px 0 0 0;
text-transform: uppercase;
width: 200px;
/* to match width of sidebar */
@@ -2023,10 +2023,13 @@ ul#related-tags li {
font-family: 'Open Sans Condensed', Arial, sans-serif;
vertical-align: top;
}
+.question-page .question-card {
+ display: relative;
+}
.question-page .question-content {
- float: right;
- width: 682px;
+ padding-left: 43px;
margin-bottom: 10px;
+ width: auto;
}
.question-page .question-content pre,
.question-page .answer pre,
@@ -2095,7 +2098,6 @@ ul#related-tags li {
float: right;
font-size: 9px;
font-family: Arial;
- width: 158px;
padding: 4px;
margin: 0px 0px 5px 5px;
line-height: 14px;
@@ -2495,7 +2497,7 @@ ul#related-tags li {
float: right;
width: 14px;
line-height: 130%;
- padding: 8px 6px;
+ padding: 8px 0px;
}
.question-page .comments .upvote {
margin: 0px;
@@ -3834,6 +3836,28 @@ p.signup_p {
.userList {
font-size: 13px;
}
+.user-list {
+ margin: 0;
+ list-style: none;
+}
+.user-list li {
+ margin: 5px 10px 15px 0;
+ display: inline-block;
+}
+.user-card {
+ display: inline-block;
+ height: 35px;
+ width: 166px;
+ overflow: hidden;
+}
+.user-card .avatar-box {
+ float: left;
+ margin: 3px 6px 0 0;
+}
+.user-card .info {
+ height: 32px;
+ width: 134px;
+}
img.flag {
border: 1px solid #eee;
vertical-align: text-top;
@@ -4179,8 +4203,14 @@ textarea.tipped-input {
#ContentLeft,
#ContentFull {
padding-left: 6px;
+ }
+ #ContentRight,
+ #ContentFull {
padding-right: 6px;
}
+ .short-summary {
+ width: 100%;
+ }
.short-summary .answers,
.short-summary .views,
.short-summary .votes {
@@ -4189,6 +4219,9 @@ textarea.tipped-input {
.question-page .vote-buttons {
margin-right: 2px;
}
+ .tag-right {
+ height: 20px;
+ }
}
@media screen and (max-width: 800px) {
body {
@@ -4205,11 +4238,11 @@ textarea.tipped-input {
}
#ContentLeft {
width: 100%;
+ padding-right: 6px;
}
.main-page h1,
#askButton,
#metaNav #navBadges,
- .user-info,
.copyright,
.counts .views,
.counts .votes,
@@ -4281,7 +4314,7 @@ textarea.tipped-input {
.question-page .post-update-info {
float: none;
margin-left: 0;
- width: 95%;
+ width: auto;
}
.question-page .post-update-info br,
.question-page .post-update-info .badge1,
@@ -4289,23 +4322,14 @@ textarea.tipped-input {
.question-page .post-update-info .badge3,
.question-page .post-update-info .gravatar,
.question-page .post-update-info .reputation-score,
+ .question-page .post-update-info .user-card,
.question-page .post-update-info .badge-count {
display: none;
}
- .question-page .question-content,
- .question-page ul.post-retag input {
- width: 88%;
- }
.question-page .answer-table,
.question-page #question-table {
- width: 85%;
- }
- .users-page .userList td {
- display: block;
- width: 100%;
- }
- .users-page .userList td .user {
- width: 100%;
+ float: left;
+ margin-left: 12px;
}
.user-profile-page td {
display: block;
diff --git a/askbot/media/style/style.less b/askbot/media/style/style.less
index 3dc85eca..de0e28e8 100644
--- a/askbot/media/style/style.less
+++ b/askbot/media/style/style.less
@@ -774,7 +774,7 @@ form.ajax-file-upload {
font-size: 20px;
height: 42px;
line-height: 44px;
- margin-top: 6px;
+ margin: 6px 0 0 0;
text-transform: uppercase;
width: 200px;/* to match width of sidebar */
}
@@ -2134,10 +2134,14 @@ ul#related-tags li {
vertical-align: top;
}
+ .question-card {
+ display: relative;
+ }
+
.question-content {
- float:right;
- width:682px;
+ padding-left: 43px;
margin-bottom:10px;
+ width: auto;
}
.question-content, .answer {
@@ -2211,7 +2215,6 @@ ul#related-tags li {
float: right;
font-size: 9px;
font-family:@secondary-font;
- width: 158px;
padding:4px;
margin:0px 0px 5px 5px;
line-height: 14px;
@@ -2596,7 +2599,7 @@ ul#related-tags li {
float: right;
width: 14px;
line-height: 130%;
- padding: 8px 6px;
+ padding: 8px 0px;
}
.upvote {
@@ -4078,6 +4081,31 @@ p.signup_p {
font-size: 13px;
}
+.user-list {
+ margin: 0;
+ list-style: none;
+ li {
+ margin: 5px 10px 15px 0;
+ display: inline-block;
+ }
+}
+
+.user-card {
+ display: inline-block;
+ height: 35px;
+ width: 166px;
+ overflow: hidden;
+
+ .avatar-box {
+ float: left;
+ margin: 3px 6px 0 0;
+ }
+ .info {
+ height: 32px;
+ width: 134px;
+ }
+}
+
img.flag {
border: 1px solid #eee;
vertical-align: text-top;
@@ -4357,9 +4385,13 @@ textarea.tipped-input {
#ContentLeft,
#ContentFull {
padding-left: 6px;
+ }
+ #ContentRight,
+ #ContentFull {
padding-right: 6px;
}
.short-summary {
+ width: 100%;
.answers,
.views,
.votes {
@@ -4371,6 +4403,9 @@ textarea.tipped-input {
margin-right: 2px;
}
}
+ .tag-right {
+ height: 20px;
+ }
}
@media screen and (max-width: 800px) {
body {
@@ -4387,11 +4422,11 @@ textarea.tipped-input {
}
#ContentLeft {
width: 100%;
+ padding-right: 6px;
}
.main-page h1,
#askButton,
#metaNav #navBadges,
- .user-info,
.copyright,
.counts .views,
.counts .votes,
@@ -4459,7 +4494,7 @@ textarea.tipped-input {
.post-update-info {
float: none;
margin-left: 0;
- width: 100%-5;
+ width: auto;
br,
.badge1,
@@ -4467,27 +4502,15 @@ textarea.tipped-input {
.badge3,
.gravatar,
.reputation-score,
+ .user-card,
.badge-count {
display: none;
}
}
- .question-content,
- ul.post-retag input {
- width: 100%-12;
- }
.answer-table,
#question-table {
- width: 100%-15;
- }
- }
-
- .users-page {
- .userList td {
- display: block;
- width: 100%;
- .user {
- width: 100%;
- }
+ float: left;
+ margin-left: 12px;
}
}
diff --git a/askbot/models/__init__.py b/askbot/models/__init__.py
index b31d9b5d..614e3c76 100644
--- a/askbot/models/__init__.py
+++ b/askbot/models/__init__.py
@@ -2374,12 +2374,15 @@ def delete_messages(self):
self.message_set.all().delete()
#todo: find where this is used and replace with get_absolute_url
-def user_get_profile_url(self):
+def user_get_profile_url(self, profile_section=None):
"""Returns the URL for this User's profile."""
- return reverse(
- 'user_profile',
- kwargs={'id':self.id, 'slug':slugify(self.username)}
- )
+ url = reverse(
+ 'user_profile',
+ kwargs={'id':self.id, 'slug':slugify(self.username)}
+ )
+ if profile_section:
+ url += "?sort=" + profile_section
+ return url
def user_get_absolute_url(self):
return self.get_profile_url()
@@ -2467,6 +2470,9 @@ def user_get_badge_summary(self):
"""returns human readable sentence about
number of badges of different levels earned
by the user. It is assumed that user has some badges"""
+ if self.gold + self.silver + self.bronze == 0:
+ return ''
+
badge_bits = list()
if self.gold:
bit = ungettext(
@@ -2497,8 +2503,6 @@ def user_get_badge_summary(self):
badge_str = ', '.join(badge_bits)
badge_str = _('%(item1)s and %(item2)s') % \
{'item1': badge_str, 'item2': last_bit}
- else:
- raise ValueError('user must have badges to call this function')
return _("%(user)s has %(badges)s") % {'user': self.username, 'badges':badge_str}
#series of methods for user vote-type commands
@@ -2986,6 +2990,7 @@ User.add_to_class('can_moderate_user', user_can_moderate_user)
User.add_to_class('has_affinity_to_question', user_has_affinity_to_question)
User.add_to_class('moderate_user_reputation', user_moderate_user_reputation)
User.add_to_class('set_status', user_set_status)
+User.add_to_class('get_badge_summary', user_get_badge_summary)
User.add_to_class('get_status_display', user_get_status_display)
User.add_to_class('get_old_vote_for_post', user_get_old_vote_for_post)
User.add_to_class('get_unused_votes_today', user_get_unused_votes_today)
diff --git a/askbot/templates/badge.html b/askbot/templates/badge.html
index aebf5450..4a405218 100644
--- a/askbot/templates/badge.html
+++ b/askbot/templates/badge.html
@@ -16,15 +16,11 @@
</div>
<div class="clean"></div>
<div id="award-list">
- {% for recipient in badge_recipients %}
- <div class="user">
- <ul>
- <li class="thumb">{{ gravatar(recipient, 32) }}</li>
- <li><a href="{{ recipient.get_absolute_url() }}">{{recipient.username|escape}}</a></li>
- <li>{{ macros.user_score_and_badge_summary(recipient) }}</li>
- </ul>
- </div>
- {% endfor %}
+ {{ macros.user_list(
+ badge_recipients,
+ karma_mode=settings.KARMA_MODE,
+ badges_mode=settings.BADGES_MODE
+ )}}
</div>
{% endblock %}
<!-- end template badge.html -->
diff --git a/askbot/templates/macros.html b/askbot/templates/macros.html
index 57f19b00..933f47e7 100644
--- a/askbot/templates/macros.html
+++ b/askbot/templates/macros.html
@@ -57,10 +57,7 @@
<img alt="{% trans %}anonymous user{% endtrans %}" src="{{ '/images/anon.png'|media }} " class="gravatar" width="32" height="32" />
<p>{{ user.get_anonymous_name() }}</p>
{% else %}
- {{ gravatar(user, 32) }}
- {{ user.get_profile_link()}}{{ user_country_flag(user) }}<br/>
- {{ user_score_and_badge_summary(user, karma_mode = karma_mode, badges_mode = badges_mode) }}<br/>
- {{ user_website_link(user) }}
+ {{ user_card(user, karma_mode=karma_mode, badges_mode=badges_mode) }}
{% endif %}
{{ user_primary_group(user) }}
{%- endmacro -%}
@@ -558,14 +555,6 @@ for the purposes of the AJAX comment editor #}
answer {% if answer.accepted() %}accepted-answer{% endif %} {% if answer.author_id==question.author_id %} answered-by-owner{% endif %} {% if answer.deleted %}deleted{% endif -%}
{%- endmacro -%}
-{%- macro user_score_and_badge_summary(
- user,
- karma_mode = None,
- badges_mode = None
-) -%}
- {%include "widgets/user_score_and_badge_summary.html"%}
-{%- endmacro -%}
-
{%- macro follow_toggle(follow, name, alias, id) -%}
{# follow - boolean; name - object type name; alias - e.g. users name; id - object id #}
<div
@@ -639,11 +628,12 @@ answer {% if answer.accepted() %}accepted-answer{% endif %} {% if answer.author_
{{ user_country_name_and_flag(user) }}
{%- endmacro -%}
-{%- macro user_list(
- users, profile_section = None, karma_mode = None, badges_mode = None
- )
--%}
-{% include "widgets/user_list.html"%}
+{% macro user_card(user, karma_mode=None, badges_mode=None) %}
+ {% include "widgets/user_card.html" %}
+{% endmacro %}
+
+{%- macro user_list(users, karma_mode=None, badges_mode=None) -%}
+ {% include "widgets/user_list.html" %}
{%- endmacro -%}
{#todo: rename this to avatar #}
diff --git a/askbot/templates/question/question_card.html b/askbot/templates/question/question_card.html
index c787bf34..91f8ee06 100644
--- a/askbot/templates/question/question_card.html
+++ b/askbot/templates/question/question_card.html
@@ -1,38 +1,40 @@
-<div class="vote-buttons">
- {% include "question/question_vote_buttons.html" %}
- {% include "question/share_buttons.html" %}
-</div>
-<div id="post-id-{{question.id}}" class="question-content{% if question.deleted %} deleted{% endif %}">
+<div class="question-card">
+ <div class="vote-buttons">
+ {% include "question/question_vote_buttons.html" %}
+ {% include "question/share_buttons.html" %}
+ </div>
+ <div id="post-id-{{question.id}}" class="question-content{% if question.deleted %} deleted{% endif %}">
+ <div id="question-table">
+ <h1><a href="{{ question.get_absolute_url() }}">{{ thread.get_title(question)|escape }}</a></h1>
+ {% include "question/question_tags.html" %}
- <h1><a href="{{ question.get_absolute_url() }}">{{ thread.get_title(question)|escape }}</a></h1>
- {% include "question/question_tags.html" %}
+ <div class="clearfix"></div>
- <div id="question-table">
- <div class="question-body">
- <div class="post-update-info-container">
- {% include "question/question_author_info.html" %}
+ <div class="question-body">
+ <div class="post-update-info-container">
+ {% include "question/question_author_info.html" %}
+ </div>
+ {{ question.html }}
</div>
- {{ question.html }}
- </div>
- <div id="question-controls" class="post-controls">
- {% include "question/question_controls.html" %}
+ <div id="question-controls" class="post-controls">
+ {% include "question/question_controls.html" %}
+ </div>
+ <script type="text/javascript">
+ (function(){
+ if (askbot['data']['userIsAuthenticated'] === false){
+ var ctrl = document.getElementById('question-controls')
+ ctrl.parentNode.removeChild(ctrl);
+ }
+ })();
+ </script>
+ {% if thread.closed %}
+ <div class="clearfix"></div>
+ {# ==== START: question/closed_question_info.html ==== #}
+ {% include "question/closed_question_info.html" %}
+ {# ==== END: question/closed_question_info.html ==== #}
+ {% endif %}
+ {% include "question/question_comments.html" %}
</div>
- <script type="text/javascript">
- (function(){
- if (askbot['data']['userIsAuthenticated'] === false){
- var ctrl = document.getElementById('question-controls')
- ctrl.parentNode.removeChild(ctrl);
- }
- })();
- </script>
- {% if thread.closed %}
- <div class="clearfix"></div>
- {# ==== START: question/closed_question_info.html ==== #}
- {% include "question/closed_question_info.html" %}
- {# ==== END: question/closed_question_info.html ==== #}
- {% endif %}
- {% include "question/question_comments.html" %}
- </div>
+ </div>
</div>
-
diff --git a/askbot/templates/users.html b/askbot/templates/users.html
index 09a2c117..5ab4c28a 100644
--- a/askbot/templates/users.html
+++ b/askbot/templates/users.html
@@ -1,4 +1,8 @@
-{% extends "two_column_body.html" %}
+{% if settings.GROUPS_ENABLED %}
+ {% extends "two_column_body.html" %}
+{% else %}
+ {% extends "one_column_body.html" %}
+{% endif %}
{% import "macros.html" as macros %}
<!-- users.html -->
{% block title %}{% spaceless %}{% trans %}Users{% endtrans %}{% endspaceless %}{% endblock %}
diff --git a/askbot/templates/widgets/question_summary.html b/askbot/templates/widgets/question_summary.html
index 78aa2f0c..cc480e33 100644
--- a/askbot/templates/widgets/question_summary.html
+++ b/askbot/templates/widgets/question_summary.html
@@ -48,7 +48,6 @@
<span class="anonymous">{{ thread.last_activity_by.get_anonymous_name() }}</span>
{% else %}
<a href="{% url user_profile thread.last_activity_by.id, thread.last_activity_by.username|slugify %}">{{thread.last_activity_by.username|escape}}</a> {{ user_country_flag(thread.last_activity_by) }}
- {#{user_score_and_badge_summary(thread.last_activity_by)}#}
{% endif %}
{% if thread.last_activity_by.get_primary_group() %}-{% endif %}
{{ user_primary_group(thread.last_activity_by) }}
diff --git a/askbot/templates/widgets/user_card.html b/askbot/templates/widgets/user_card.html
new file mode 100644
index 00000000..af8555c0
--- /dev/null
+++ b/askbot/templates/widgets/user_card.html
@@ -0,0 +1,33 @@
+{% import "macros.html" as macros %}
+{#
+ thumbnail for the user - shown on the users listings
+ and elsewhere
+#}
+<div class="user-card">
+ {{ macros.gravatar(user, 32) }}
+ <div class="user-info">
+ <a href="{{ user.get_profile_url() }}">{{ user.username|escape }}</a>
+ {{ macros.user_country_flag(user) }}
+
+ <br/>
+
+ {% if karma_mode == 'public' %}
+ <span class="reputation-score">{{ user.reputation }}</span>
+ {% endif %}
+
+ {% if badges_mode == 'public' %}
+ <span class="badges" title="{{ user.get_badge_summary() }}">
+ {% if user.gold %}
+ <span class='badge1'>&#9679;</span><span class="badgecount">{{ user.gold }}</span>
+ {% endif %}
+ {% if user.silver %}
+ <span class='badge2'>&#9679;</span><span class="badgecount">{{ user.silver }}</span>
+ {% endif %}
+ {% if user.bronze %}
+ <span class='badge3'>&#9679;</span><span class="badgecount">{{ user.bronze }}</span>
+ {% endif %}
+ </span>
+ {% endif %}
+ {{ macros.user_website_link(user) }}
+ </div>
+</div>
diff --git a/askbot/templates/widgets/user_list.html b/askbot/templates/widgets/user_list.html
index 52cf8bd4..6f3c97cb 100644
--- a/askbot/templates/widgets/user_list.html
+++ b/askbot/templates/widgets/user_list.html
@@ -1,28 +1,8 @@
{% import "macros.html" as macros %}
-<div class="userList">
- <table class="list-table">
- <tr>
- <td class="list-td">
- {% for user in users %}
- <div class="user">
- <ul>
- <li class="thumb">{{ macros.gravatar(user, 32) }}</li>
- <li><a href="{% url user_profile user.id, user.username|slugify %}{% if profile_section %}?sort={{profile_section}}{% endif %}">{{user.username|escape}}</a>{{ macros.user_country_flag(user) }}</li>
- <li>{{
- macros.user_score_and_badge_summary(
- user,
- karma_mode = karma_mode,
- badges_mode = badges_mode
- )
- }}</li>
- </ul>
- </div>
- {% if loop.index is divisibleby 7 %}
- </td>
- <td>
- {% endif %}
- {% endfor %}
- </td>
- </tr>
- </table>
-</div>
+{% if users %}
+<ul class="user-list">
+ {% for user in users %}
+ <li>{{ macros.user_card(user, karma_mode=karma_mode, badges_mode=badges_mode) }}</li>
+ {% endfor %}
+</ul>
+{% endif %}
diff --git a/askbot/templates/widgets/user_long_score_and_badge_summary.html b/askbot/templates/widgets/user_long_score_and_badge_summary.html
index 65966376..35e4cb67 100644
--- a/askbot/templates/widgets/user_long_score_and_badge_summary.html
+++ b/askbot/templates/widgets/user_long_score_and_badge_summary.html
@@ -6,8 +6,8 @@
{%- endif -%}
{% if badges_mode == 'public' and have_badges %}
<a class="user-micro-info"
- href="{{user.get_absolute_url()}}#badges"
- ><span title="{{user.get_badge_summary}}">{% trans %}badges:{% endtrans %}
+ href="{{ user.get_absolute_url() }}#badges"
+ ><span title="{{ user.get_badge_summary() }}">{% trans %}badges:{% endtrans %}
{% if user.gold %}
<span class='badge1'>&#9679;</span>
<span class="badgecount">{{user.gold}}</span>
diff --git a/askbot/templates/widgets/user_score_and_badge_summary.html b/askbot/templates/widgets/user_score_and_badge_summary.html
deleted file mode 100644
index 80d140db..00000000
--- a/askbot/templates/widgets/user_score_and_badge_summary.html
+++ /dev/null
@@ -1,23 +0,0 @@
-{% if karma_mode == 'public' %}
-<span class="reputation-score"
- title="{{user.get_karma_summary}}"
->{{user.reputation}}</span>
-{% endif %}
-{% if badges_mode == 'public' %}
- {% if user.gold or user.silver or user.bronze %}
- <span title="{{user.get_badge_summary}}">
- {% if user.gold %}
- <span class='badge1'>&#9679;</span>
- <span class="badgecount">{{user.gold}}</span>
- {% endif %}
- {% if user.silver %}
- <span class='badge2'>&#9679;</span>
- <span class="badgecount">{{user.silver}}</span>
- {% endif %}
- {% if user.bronze %}
- <span class='badge3'>&#9679;</span>
- <span class="badgecount">{{user.bronze}}</span>
- {% endif %}
- </span>
- {% endif %}
-{% endif %}