Fix #712: Comment counter always uses plural

This commit is contained in:
Jef van Schendel 2011-12-30 20:17:59 +01:00
parent 6f55906078
commit 694e965f45

View File

@ -81,18 +81,25 @@
<a class="button_action" href="{{ delete_url }}">{% trans %}Delete{% endtrans %}</a> <a class="button_action" href="{{ delete_url }}">{% trans %}Delete{% endtrans %}</a>
{% endif %} {% endif %}
</p> </p>
<h3>{% trans comment_count=comments.count() -%}{{ comment_count }} comments{%- endtrans %} {% if comments %}
<div class="right_align"> <h3>
<a {% if comments.count()==1 %}
{% if not request.user %} {% trans comment_count=comments.count() -%}{{ comment_count }} comment{%- endtrans %}
href="{{ request.urlgen('mediagoblin.auth.login') }}" {% elif comments.count()>1 %}
{% endif %} {% trans comment_count=comments.count() -%}{{ comment_count }} comments{%- endtrans %}
class="button_action" id="button_addcomment" title="Add a comment"> {% else %}
{% trans %}Add one{% endtrans %} {% trans %}No comments yet.{% endtrans %}
</a> {% endif %}
</div> <div class="right_align">
</h3> <a
{# 0 comments. Be the first to add one! #} {% if not request.user %}
href="{{ request.urlgen('mediagoblin.auth.login') }}"
{% endif %}
class="button_action" id="button_addcomment" title="Add a comment">
{% trans %}Add one{% endtrans %}
</a>
</div>
</h3>
{% if request.user %} {% if request.user %}
<form action="{{ request.urlgen('mediagoblin.user_pages.media_post_comment', <form action="{{ request.urlgen('mediagoblin.user_pages.media_post_comment',
user= media.get_uploader.username, user= media.get_uploader.username,
@ -107,34 +114,33 @@
</div> </div>
</form> </form>
{% endif %} {% endif %}
{% if comments %} {% for comment in comments %}
{% for comment in comments %} {% set comment_author = comment.get_author %}
{% set comment_author = comment.get_author %} {% if pagination.active_id == comment._id %}
{% if pagination.active_id == comment._id %} <div class="comment_wrapper comment_active" id="comment-{{ comment._id }}">
<div class="comment_wrapper comment_active" id="comment-{{ comment._id }}"> <a name="comment" id="comment"></a>
<a name="comment" id="comment"></a> {% else %}
{% else %} <div class="comment_wrapper" id="comment-{{ comment._id }}">
<div class="comment_wrapper" id="comment-{{ comment._id }}"> {% endif %}
{% endif %} <div class="comment_content">
<div class="comment_content"> {% autoescape False %}
{% autoescape False %} {{ comment.content_html }}
{{ comment.content_html }} {% endautoescape %}
{% endautoescape %} <img src="{{ request.staticdirect('/images/icon_comment.png') }}" />
<img src="{{ request.staticdirect('/images/icon_comment.png') }}" /> <a href="{{ request.urlgen('mediagoblin.user_pages.user_home',
<a href="{{ request.urlgen('mediagoblin.user_pages.user_home', user = comment_author.username) }}">
user = comment_author.username) }}"> {{ comment_author.username }}
{{ comment_author.username }} </a>
</a> {% trans %}at{% endtrans %}
{% trans %}at{% endtrans %} <a href="{{ request.urlgen('mediagoblin.user_pages.media_home.view_comment',
<a href="{{ request.urlgen('mediagoblin.user_pages.media_home.view_comment', comment = comment._id,
comment = comment._id, user = media.get_uploader.username,
user = media.get_uploader.username, media = media.slug) }}#comment">
media = media.slug) }}#comment"> {{ comment.created.strftime("%I:%M%p %Y-%m-%d") }}
{{ comment.created.strftime("%I:%M%p %Y-%m-%d") }} </a>
</a> </div>
</div> </div>
</div> {% endfor %}
{% endfor %}
{{ render_pagination(request, pagination, {{ render_pagination(request, pagination,
media.url_for_self(request.urlgen)) }} media.url_for_self(request.urlgen)) }}
{% endif %} {% endif %}