diff options
author | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2013-04-18 04:47:12 -0400 |
---|---|---|
committer | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2013-04-18 04:47:12 -0400 |
commit | 69a9a36c69c4f5dea2852588717f3e3db648b548 (patch) | |
tree | e5ad36dbe258a57408f371f87b4eaf47761eef80 /askbot/templates | |
parent | 84d8999fedae759887d4dae3cb0e13c2b16ff4f7 (diff) | |
download | askbot-69a9a36c69c4f5dea2852588717f3e3db648b548.tar.gz askbot-69a9a36c69c4f5dea2852588717f3e3db648b548.tar.bz2 askbot-69a9a36c69c4f5dea2852588717f3e3db648b548.zip |
some work on improving responsive layout
Diffstat (limited to 'askbot/templates')
-rw-r--r-- | askbot/templates/badge.html | 14 | ||||
-rw-r--r-- | askbot/templates/macros.html | 24 | ||||
-rw-r--r-- | askbot/templates/question/question_card.html | 66 | ||||
-rw-r--r-- | askbot/templates/users.html | 6 | ||||
-rw-r--r-- | askbot/templates/widgets/question_summary.html | 1 | ||||
-rw-r--r-- | askbot/templates/widgets/user_card.html | 33 | ||||
-rw-r--r-- | askbot/templates/widgets/user_list.html | 34 | ||||
-rw-r--r-- | askbot/templates/widgets/user_long_score_and_badge_summary.html | 4 |
8 files changed, 93 insertions, 89 deletions
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'>●</span><span class="badgecount">{{ user.gold }}</span> + {% endif %} + {% if user.silver %} + <span class='badge2'>●</span><span class="badgecount">{{ user.silver }}</span> + {% endif %} + {% if user.bronze %} + <span class='badge3'>●</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'>●</span> <span class="badgecount">{{user.gold}}</span> |