diff options
-rw-r--r-- | mediagoblin/templates/mediagoblin/user_pages/media.html | 86 |
1 files changed, 46 insertions, 40 deletions
diff --git a/mediagoblin/templates/mediagoblin/user_pages/media.html b/mediagoblin/templates/mediagoblin/user_pages/media.html index 13fa1baa..4c255112 100644 --- a/mediagoblin/templates/mediagoblin/user_pages/media.html +++ b/mediagoblin/templates/mediagoblin/user_pages/media.html @@ -81,18 +81,25 @@ <a class="button_action" href="{{ delete_url }}">{% trans %}Delete{% endtrans %}</a> {% endif %} </p> - <h3>{% trans comment_count=comments.count() -%}{{ comment_count }} comments{%- endtrans %} - <div class="right_align"> - <a - {% 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> - {# 0 comments. Be the first to add one! #} + {% if comments %} + <h3> + {% if comments.count()==1 %} + {% trans comment_count=comments.count() -%}{{ comment_count }} comment{%- endtrans %} + {% elif comments.count()>1 %} + {% trans comment_count=comments.count() -%}{{ comment_count }} comments{%- endtrans %} + {% else %} + {% trans %}No comments yet.{% endtrans %} + {% endif %} + <div class="right_align"> + <a + {% 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 %} <form action="{{ request.urlgen('mediagoblin.user_pages.media_post_comment', user= media.get_uploader.username, @@ -107,34 +114,33 @@ </div> </form> {% endif %} - {% if comments %} - {% for comment in comments %} - {% set comment_author = comment.get_author %} - {% if pagination.active_id == comment._id %} - <div class="comment_wrapper comment_active" id="comment-{{ comment._id }}"> - <a name="comment" id="comment"></a> - {% else %} - <div class="comment_wrapper" id="comment-{{ comment._id }}"> - {% endif %} - <div class="comment_content"> - {% autoescape False %} - {{ comment.content_html }} - {% endautoescape %} - <img src="{{ request.staticdirect('/images/icon_comment.png') }}" /> - <a href="{{ request.urlgen('mediagoblin.user_pages.user_home', - user = comment_author.username) }}"> - {{ comment_author.username }} - </a> - {% trans %}at{% endtrans %} - <a href="{{ request.urlgen('mediagoblin.user_pages.media_home.view_comment', - comment = comment._id, - user = media.get_uploader.username, - media = media.slug) }}#comment"> - {{ comment.created.strftime("%I:%M%p %Y-%m-%d") }} - </a> - </div> - </div> - {% endfor %} + {% for comment in comments %} + {% set comment_author = comment.get_author %} + {% if pagination.active_id == comment._id %} + <div class="comment_wrapper comment_active" id="comment-{{ comment._id }}"> + <a name="comment" id="comment"></a> + {% else %} + <div class="comment_wrapper" id="comment-{{ comment._id }}"> + {% endif %} + <div class="comment_content"> + {% autoescape False %} + {{ comment.content_html }} + {% endautoescape %} + <img src="{{ request.staticdirect('/images/icon_comment.png') }}" /> + <a href="{{ request.urlgen('mediagoblin.user_pages.user_home', + user = comment_author.username) }}"> + {{ comment_author.username }} + </a> + {% trans %}at{% endtrans %} + <a href="{{ request.urlgen('mediagoblin.user_pages.media_home.view_comment', + comment = comment._id, + user = media.get_uploader.username, + media = media.slug) }}#comment"> + {{ comment.created.strftime("%I:%M%p %Y-%m-%d") }} + </a> + </div> + </div> + {% endfor %} {{ render_pagination(request, pagination, media.url_for_self(request.urlgen)) }} {% endif %} |