diff options
Diffstat (limited to 'askbot/skins')
11 files changed, 122 insertions, 135 deletions
diff --git a/askbot/skins/default/templates/avatar/confirm_delete.html b/askbot/skins/default/templates/avatar/confirm_delete.html index 282d72fa..ee3d10d7 100644 --- a/askbot/skins/default/templates/avatar/confirm_delete.html +++ b/askbot/skins/default/templates/avatar/confirm_delete.html @@ -1,5 +1,4 @@ {% extends "user_profile/user.html" %} -{% import "macros.html" as macros %} {% block profilesection %}{% trans %}delete avatar{% endtrans %}{% endblock %} {% block usercontent %} <p>{% trans %}Please select the avatars that you would like to delete.{% endtrans %}</p> diff --git a/askbot/skins/default/templates/blocks/header.html b/askbot/skins/default/templates/blocks/header.html index d18be8db..5ee9e52d 100644 --- a/askbot/skins/default/templates/blocks/header.html +++ b/askbot/skins/default/templates/blocks/header.html @@ -1,5 +1,5 @@ <!-- template header.html --> -{% import "macros/macros.html" as macros %} +{% import "macros/utils_macros.html" as utils_macros %} {% import "macros/user_macros.html" as user_macros %} <div id="header"> <div class="content-wrapper"> diff --git a/askbot/skins/default/templates/blocks/paginator.html b/askbot/skins/default/templates/blocks/paginator.html index d633f9df..af4f335f 100644 --- a/askbot/skins/default/templates/blocks/paginator.html +++ b/askbot/skins/default/templates/blocks/paginator.html @@ -1,4 +1,4 @@ <!-- paginator.html --> -{% import "macros/macros.html" as macros %} -{{ macros.paginator(paginator_context)}} +{% import "macros/utils_macros.html" as utils_macros %} +{{ utils_macros.paginator(paginator_context)}} <!-- end paginator.html --> diff --git a/askbot/skins/default/templates/blocks/user_navigation.html b/askbot/skins/default/templates/blocks/user_navigation.html index 23d0ccb7..537b615d 100644 --- a/askbot/skins/default/templates/blocks/user_navigation.html +++ b/askbot/skins/default/templates/blocks/user_navigation.html @@ -1,8 +1,8 @@ {% if request.user.is_authenticated() %} <a href="{{ request.user.get_absolute_url() }}">{{ request.user.username }}</a> <span class="user-info"> - {{ macros.inbox_link(request.user) }} - {{ macros.moderation_items_link(request.user, moderation_items) }} + {{ utils_macros.inbox_link(request.user) }} + {{ utils_macros.moderation_items_link(request.user, moderation_items) }} ({{ user_macros.user_long_score_and_badge_summary(user) }}) </span> <a href="{{ settings.LOGOUT_URL }}?next={{ settings.LOGOUT_REDIRECT_URL }}">{% trans %}logout{% endtrans %}</a> diff --git a/askbot/skins/default/templates/macros/macros.html b/askbot/skins/default/templates/macros/macros.html index 73f52975..b024a34f 100644 --- a/askbot/skins/default/templates/macros/macros.html +++ b/askbot/skins/default/templates/macros/macros.html @@ -1,3 +1,4 @@ +{% from "macros/user_macros.html" import user_country_flag, gravatar %} {%- macro share(site = None, site_label = None, icon = False) -%} <a class="{{ site }}-share{% if icon == True %} icon{% endif %}" title="{% trans %}Share this question on {{site}}{% endtrans %}" @@ -21,84 +22,6 @@ </div> {%- endmacro -%} -{%- macro paginator(p, position='left') -%}{# p is paginator context dictionary #} -{% spaceless %} - {% if p.is_paginated %} - <div class="paginator" style="float:{{position}}"> - {% if p.has_previous %} - <span class="prev"><a href="{{p.base_url}}page={{ p.previous }}{{ p.extend_url }}" title="{% trans %}previous{% endtrans %}"> - « {% trans %}previous{% endtrans %}</a></span> - {% endif %} - {% if not p.in_leading_range %} - {% for num in p.pages_outside_trailing_range %} - <span class="page"><a href="{{p.base_url}}page={{ num }}{{ p.extend_url }}" >{{ num }}</a></span> - {% endfor %} - ... - {% endif %} - - {% for num in p.page_numbers %} - {% if num == p.page and p.pages != 1%} - <span class="curr" title="{% trans %}current page{% endtrans %}">{{ num }}</span> - {% else %} - <span class="page"><a href="{{p.base_url}}page={{ num }}{{ p.extend_url }}" title="{% trans %}page number {{num}}{% endtrans %}">{{ num }}</a></span> - {% endif %} - {% endfor %} - - {% if not p.in_trailing_range %} - ... - {% for num in p.pages_outside_leading_range|reverse %} - <span class="page"><a href="{{p.base_url}}page={{ num }}{{ p.extend_url }}" title="{% trans %}page number {{ num }}{% endtrans %}">{{ num }}</a></span> - {% endfor %} - {% endif %} - {% if p.has_next %} - <span class="next"><a href="{{p.base_url}}page={{ p.next }}{{ p.extend_url }}" title="{% trans %}next page{% endtrans %}">{% trans %}next page{% endtrans %} »</a></span> - {% endif %} - </div> - {% endif %} -{% endspaceless %} -{%- endmacro -%} - -{%- macro pagesize_switch(p, position='left') -%}{# p is paginator context #} -{% spaceless %} -{% if p.is_paginated %} - <div class="paginator" style="float:{{position}}"> - <span class="text">{% trans %}posts per page{% endtrans %}</span> - {% if p.page_size == 10 %} - <span class="curr">10</span> - {% else %} - <span class="page"><a href="{{p.base_url}}page_size=10">10</a></span> - {% endif %} - - {% if p.page_size == 30 %} - <span class="curr">30</span> - {% else %} - <span class="page"><a href="{{p.base_url}}page_size=30">30</a></span> - {% endif %} - - {% if p.page_size == 50 %} - <span class="curr">50</span> - {% else %} - <span class="page"><a href="{{p.base_url}}page_size=50">50</a></span> - {% endif %} - </div> -{% endif %} -{% endspaceless %} -{%- endmacro -%} - -{#todo: rename this to avatar #} -{%- macro gravatar(user, size) -%} -{% spaceless %} -<a style="text-decoration:none" - href="{{ user.get_absolute_url() }}" -><img class="gravatar" - width="{{size}}" height="{{size}}" - src="{{ user.get_avatar_url(size) }}" - title="{{user.username}}" - alt="{% trans username=user.username %}{{username}} gravatar image{% endtrans %}" -/></a> -{% endspaceless %} -{%- endmacro -%} - {%- macro post_contributor_avatar_and_credentials(post, user) -%} {% if post.is_anonymous %} <img alt="{% trans %}anonymous user{% endtrans %}" src="{{ '/images/anon.png'|media }} " class="gravatar" width="32" height="32" /> @@ -573,48 +496,6 @@ for the purposes of the AJAX comment editor #} <div id="previewer" class="wmd-preview"></div> {%- endmacro -%} -{%- macro inbox_link(user) -%} - {% if user.new_response_count > 0 or user.seen_response_count > 0 %} - <a id='ab-responses' href="{{user.get_absolute_url()}}?sort=inbox§ion=forum"> - <img - alt="{% trans username=user.username %}responses for {{username}}{% endtrans %}" - {% if user.new_response_count > 0 %} - src="{{ "/images/mail-envelope-full.png"|media }}" - title="{% trans response_count=user.new_response_count %}you have a new response{% pluralize %}you have {{response_count}} new responses{% endtrans %}" - {% elif user.seen_response_count > 0 %} - src="{{ "/images/mail-envelope-empty.png"|media }}" - title="{% trans %}no new responses yet{% endtrans %}" - {% endif %} - /> - </a> - {% endif %} -{%- endmacro -%} - -{%- macro moderation_items_link(user, moderation_items) -%} - {% if moderation_items %} - <a id="ab-responses" - href="{{user.get_absolute_url()}}?sort=inbox§ion=flags" - > - {% if moderation_items['new_count'] > 0 %} - <img src="{{'/images/dialog-warning.png'|media}}" - {% if moderation_items['seen_count'] > 0 %} - alt="{% trans new=moderation_items['new_count'], seen=moderation_items['seen_count']%}{{new}} new flagged posts and {{seen}} previous{% endtrans %}" - title="{% trans new=moderation_items['new_count'], seen=moderation_items['seen_count']%}{{new}} new flagged posts and {{seen}} previous{% endtrans %}" - {% else %} - alt="{% trans new=moderation_items['new_count'] %}{{new}} new flagged posts{% endtrans %}" - title="{% trans new=moderation_items['new_count'] %}{{new}} new flagged posts{% endtrans %}" - {% endif %} - /> - {% elif moderation_items['seen_count'] > 0 %} - <img src={{'/images/dialog-warning-off.png'|media}} - alt="{% trans seen=moderation_items['seen_count'] %}{{seen}} flagged posts{% endtrans %}" - title="{% trans seen=moderation_items['seen_count'] %}{{seen}} flagged posts{% endtrans %}" - /> - {% endif %} - </a> - {% endif %} -{%- endmacro -%} - {%- macro tag_autocomplete_js(id = '#id_tags') -%} var tagAc = new AutoCompleter({ url: '{% url "get_tag_list" %}', diff --git a/askbot/skins/default/templates/macros/utils_macros.html b/askbot/skins/default/templates/macros/utils_macros.html new file mode 100644 index 00000000..c4634d2f --- /dev/null +++ b/askbot/skins/default/templates/macros/utils_macros.html @@ -0,0 +1,105 @@ +{%- macro paginator(p, position='left') -%}{# p is paginator context dictionary #} +{% spaceless %} + {% if p.is_paginated %} + <div class="paginator" style="float:{{position}}"> + {% if p.has_previous %} + <span class="prev"><a href="{{p.base_url}}page={{ p.previous }}{{ p.extend_url }}" title="{% trans %}previous{% endtrans %}"> + « {% trans %}previous{% endtrans %}</a></span> + {% endif %} + {% if not p.in_leading_range %} + {% for num in p.pages_outside_trailing_range %} + <span class="page"><a href="{{p.base_url}}page={{ num }}{{ p.extend_url }}" >{{ num }}</a></span> + {% endfor %} + ... + {% endif %} + + {% for num in p.page_numbers %} + {% if num == p.page and p.pages != 1%} + <span class="curr" title="{% trans %}current page{% endtrans %}">{{ num }}</span> + {% else %} + <span class="page"><a href="{{p.base_url}}page={{ num }}{{ p.extend_url }}" title="{% trans %}page number {{num}}{% endtrans %}">{{ num }}</a></span> + {% endif %} + {% endfor %} + + {% if not p.in_trailing_range %} + ... + {% for num in p.pages_outside_leading_range|reverse %} + <span class="page"><a href="{{p.base_url}}page={{ num }}{{ p.extend_url }}" title="{% trans %}page number {{ num }}{% endtrans %}">{{ num }}</a></span> + {% endfor %} + {% endif %} + {% if p.has_next %} + <span class="next"><a href="{{p.base_url}}page={{ p.next }}{{ p.extend_url }}" title="{% trans %}next page{% endtrans %}">{% trans %}next page{% endtrans %} »</a></span> + {% endif %} + </div> + {% endif %} +{% endspaceless %} +{%- endmacro -%} + +{%- macro pagesize_switch(p, position='left') -%}{# p is paginator context #} +{% spaceless %} +{% if p.is_paginated %} + <div class="paginator" style="float:{{position}}"> + <span class="text">{% trans %}posts per page{% endtrans %}</span> + {% if p.page_size == 10 %} + <span class="curr">10</span> + {% else %} + <span class="page"><a href="{{p.base_url}}page_size=10">10</a></span> + {% endif %} + + {% if p.page_size == 30 %} + <span class="curr">30</span> + {% else %} + <span class="page"><a href="{{p.base_url}}page_size=30">30</a></span> + {% endif %} + + {% if p.page_size == 50 %} + <span class="curr">50</span> + {% else %} + <span class="page"><a href="{{p.base_url}}page_size=50">50</a></span> + {% endif %} + </div> +{% endif %} +{% endspaceless %} +{%- endmacro -%} + +{%- macro inbox_link(user) -%} + {% if user.new_response_count > 0 or user.seen_response_count > 0 %} + <a id='ab-responses' href="{{user.get_absolute_url()}}?sort=inbox§ion=forum"> + <img + alt="{% trans username=user.username %}responses for {{username}}{% endtrans %}" + {% if user.new_response_count > 0 %} + src="{{ "/images/mail-envelope-full.png"|media }}" + title="{% trans response_count=user.new_response_count %}you have a new response{% pluralize %}you have {{response_count}} new responses{% endtrans %}" + {% elif user.seen_response_count > 0 %} + src="{{ "/images/mail-envelope-empty.png"|media }}" + title="{% trans %}no new responses yet{% endtrans %}" + {% endif %} + /> + </a> + {% endif %} +{%- endmacro -%} + +{%- macro moderation_items_link(user, moderation_items) -%} + {% if moderation_items %} + <a id="ab-responses" + href="{{user.get_absolute_url()}}?sort=inbox§ion=flags" + > + {% if moderation_items['new_count'] > 0 %} + <img src="{{'/images/dialog-warning.png'|media}}" + {% if moderation_items['seen_count'] > 0 %} + alt="{% trans new=moderation_items['new_count'], seen=moderation_items['seen_count']%}{{new}} new flagged posts and {{seen}} previous{% endtrans %}" + title="{% trans new=moderation_items['new_count'], seen=moderation_items['seen_count']%}{{new}} new flagged posts and {{seen}} previous{% endtrans %}" + {% else %} + alt="{% trans new=moderation_items['new_count'] %}{{new}} new flagged posts{% endtrans %}" + title="{% trans new=moderation_items['new_count'] %}{{new}} new flagged posts{% endtrans %}" + {% endif %} + /> + {% elif moderation_items['seen_count'] > 0 %} + <img src={{'/images/dialog-warning-off.png'|media}} + alt="{% trans seen=moderation_items['seen_count'] %}{{seen}} flagged posts{% endtrans %}" + title="{% trans seen=moderation_items['seen_count'] %}{{seen}} flagged posts{% endtrans %}" + /> + {% endif %} + </a> + {% endif %} +{%- endmacro -%} diff --git a/askbot/skins/default/templates/main_page/paginator.html b/askbot/skins/default/templates/main_page/paginator.html index 643d9242..070a8e34 100644 --- a/askbot/skins/default/templates/main_page/paginator.html +++ b/askbot/skins/default/templates/main_page/paginator.html @@ -1,7 +1,7 @@ -{% import "macros/macros.html" as macros %} +{% import "macros/utils_macros.html" as utils_macros %} {% if questions_count > 10 %}{# todo: remove magic number #} <div id="pager" class="pager"> - {{ macros.paginator(context|setup_paginator, position='left') }} - {{ macros.pagesize_switch(context, position='right') }} + {{ utils_macros.paginator(context|setup_paginator, position='left') }} + {{ utils_macros.pagesize_switch(context, position='right') }} </div> {% endif %} diff --git a/askbot/skins/default/templates/question.html b/askbot/skins/default/templates/question.html index 4631bd0f..886d256b 100644 --- a/askbot/skins/default/templates/question.html +++ b/askbot/skins/default/templates/question.html @@ -1,5 +1,6 @@ {% extends "two_column_body.html" %} {% import "macros/macros.html" as macros %} +{% import "macros/utils_macros.html" as utils_macros %} <!-- question.html --> {% block title %}{% spaceless %}{{ question.get_question_title() }}{% endspaceless %}{% endblock %} {% block meta_description %} @@ -166,7 +167,7 @@ ><span>{% trans %}popular answers{% endtrans %}</span></a> </div> </div> - {{ macros.paginator(paginator_context) }} + {{ utils_macros.paginator(paginator_context) }} {% for answer in answers %} <a name="{{ answer.id }}"></a> @@ -291,7 +292,7 @@ </table> </div> {% endfor %} - {{ macros.paginator(paginator_context) }} + {{ utils_macros.paginator(paginator_context) }} {% else %} {% set question_url=settings.APP_URL+question.get_absolute_url()|urlencode %} <h2 class="share-question">{% trans %}Know someone who can answer? Share a <a href="{{ question_url }}">link</a> to this question via{% endtrans %} diff --git a/askbot/skins/default/templates/tags.html b/askbot/skins/default/templates/tags.html index aa1e55d5..43235e23 100644 --- a/askbot/skins/default/templates/tags.html +++ b/askbot/skins/default/templates/tags.html @@ -1,5 +1,6 @@ {% extends "two_column_body.html" %} {% import "macros/macros.html" as macros %} +{% import "macros/utils_macros.html" as utils_macros%} <!-- tags.html --> {% block title %}{% spaceless %}{% trans %}Tag list{% endtrans %}{% endspaceless %}{% endblock %} {% block content %} @@ -47,7 +48,7 @@ {% endfor %} </ul> <div class="pager"> - {{macros.paginator(paginator_context)}} + {{utils_macros.paginator(paginator_context)}} </div> {% endif %} {% else %} diff --git a/askbot/skins/default/templates/users.html b/askbot/skins/default/templates/users.html index 790be537..2604297f 100644 --- a/askbot/skins/default/templates/users.html +++ b/askbot/skins/default/templates/users.html @@ -1,6 +1,6 @@ {% extends "two_column_body.html" %} -{% import "macros/macros.html" as macros %} {% import "macros/user_macros.html" as user_macros %} +{% import "macros/utils_macros.html" as utils_macros %} <!-- users.html --> {% block title %}{% spaceless %}{% trans %}Users{% endtrans %}{% endspaceless %}{% endblock %} {% block content %} @@ -43,7 +43,7 @@ </p> {{ user_macros.user_list(users.object_list) }} <div class="pager"> - {{ macros.paginator(paginator_context) }} + {{ utils_macros.paginator(paginator_context) }} </div> {% endblock %} {% block endjs %} diff --git a/askbot/skins/default/templates/widgets/tag_selector.html b/askbot/skins/default/templates/widgets/tag_selector.html index be456ad1..8054ef63 100644 --- a/askbot/skins/default/templates/widgets/tag_selector.html +++ b/askbot/skins/default/templates/widgets/tag_selector.html @@ -1,5 +1,5 @@ {# todo - maybe disable navigation from ignored tags here when "hide" is on - with js? #} -{% import "macros.html" as macros %} +{% import "macros/macros.html" as macros %} <div id="tagSelector" class="box"> <h2>{% trans %}Interesting tags{% endtrans %}</h2> {{ |