uses render_divs for the comments form in media.html for completeness
[mediagoblin.git] / mediagoblin / templates / mediagoblin / user_pages / media.html
index 39770f395e78b6049b85c89174b5fefb0d737f89..9c0a1cca848e5c2c3d4a82f54442f9cc82b1f0d9 100644 (file)
 {% extends "mediagoblin/base.html" %}
 
 {% import "/mediagoblin/utils/wtforms.html" as wtforms_util %}
+{% from "mediagoblin/utils/pagination.html" import render_pagination %}
 
 {% block mediagoblin_content %}
-  {# temporarily, an "image gallery" that isn't one really ;) #}
   {% if media %}
-    <div class="grid_8 alpha media_image">
-      <img src="{{ request.app.public_store.file_url(
-                    media.media_files.main) }}" />
+    <div class="grid_11 alpha">
+      <div class="media_image_container">
+        <img class="media_image"
+             src="{{ request.app.public_store.file_url(
+                         media.get_display_media(media.media_files)) }}" />
+      </div>
+
       <h2>
         {{media.title}}
       </h2>
       {% endautoescape %}
 
       <p>
-        &mdash;&nbsp;uploaded on
-        {{ "%4d-%02d-%02d"|format(media.created.year,
-                                  media.created.month, media.created.day) }}
-        by
-        <a href="{{ request.urlgen('mediagoblin.user_pages.user_home',
-                                   user= media.uploader().username) }}">
-          {{- media.uploader().username }}</a>
+        {% trans date="%4d-%02d-%02d"|format(
+                   media.created.year,
+                   media.created.month, media.created.day),
+                 user_url=request.urlgen(
+                   'mediagoblin.user_pages.user_home',
+                   user=media.uploader().username),
+                 username=media.uploader().username -%}
+          &mdash;&nbsp;uploaded on {{ date }} by <a href="{{ user_url }}">{{ username }}</a>
+        {%- endtrans %}
       </p>
-      <br /><br />
+      <br />
 
-      <h3>Comments</h3>
+      <h3>{% trans %}Comments{% endtrans %}</h3>
       {% if request.user %}
         <form action="{{ request.urlgen('mediagoblin.user_pages.media_post_comment', 
                                          user= media.uploader().username,
                                          media=media._id) }}" method="POST">
-          {{ wtforms_util.render_field_div(comment_form.comment) }}
+          {{ wtforms_util.render_divs(comment_form) }}
           <div class="form_submit_buttons">
-            <input type="submit" value="Post comment!" class="button" />
+            <input type="submit" value="{% trans %}Post comment!{% endtrans %}" class="button" />
           </div>
         </form>
       {% endif %}
 
       {% if comments %}
         {% for comment in comments %}
-          <div class="comment_wrapper" id="comment-{{ comment['_id'] }}">
+          {% set comment_author = comment.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 }}
             </div>
             <div class="comment_author">&mdash; 
               <a href="{{ request.urlgen('mediagoblin.user_pages.user_home',
-                                user = comment['author']['username']) }}">
-              {{ comment['author']['username'] }}</a> at 
+                                user = comment_author['username']) }}">
+              {{ comment_author['username'] }}</a> {% trans %}at{% endtrans %} 
             <!--</div>
             <div class="comment_datetime">-->
-              <a href="#comment-{{ comment['_id'] }}">
+              <a href="{{ request.urlgen('mediagoblin.user_pages.media_home.view_comment',
+                      comment = comment['_id'],
+                      user = media.uploader().username,
+                      media = media._id) }}#comment">
                 {{ "%4d-%02d-%02d %02d:%02d"|format(comment.created.year,
                                          comment.created.month,
                                          comment.created.day,
           </div>
         {% endfor %}
 
-        {% include "mediagoblin/utils/pagination.html" %}
+        {{ render_pagination(request, pagination, 
+             request.urlgen('mediagoblin.user_pages.media_home',
+             user = media.uploader().username,
+             media = media._id)) }}
       </div>
     {% endif %}
-    <div class="grid_4 omega media_sidebar">
-      <h3>Sidebar content here!</h3>
-      <p>
-        {% if media['uploader'] == request.user['_id'] %}
+
+    <div class="grid_5 omega">
+      {% include "mediagoblin/utils/prev_next.html" %}
+        {% if media['uploader'] == request.user['_id'] or 
+                                   request.user['is_admin'] %}
+          <h3>Temporary button holder</h3>
           <p>
             <a href="{{ request.urlgen('mediagoblin.edit.edit_media',
                                        user= media.uploader().username,
           </p>
           <p>
             <img src="{{ request.staticdirect('/images/icon_delete.png') }}"
-                 class="media_icon" />
-            delete
+                 class="media_icon" />{% trans %}delete{% endtrans %}
           </p>
         {% endif %}
-      </p>
+
+      {% if media.tags %}
+        {% include "mediagoblin/utils/tags.html" %}
+      {% endif %}
     </div>
   {% else %}
-    <p>Sorry, no such media found.<p/>
+    <p>{% trans %}Sorry, no such media found.{% endtrans %}<p/>
   {% endif %}
 {% endblock %}