Add moderation panel thumbnail header [#5563]
[mediagoblin.git] / mediagoblin / templates / mediagoblin / user_pages / processing_panel.html
index 9b4adeb59dd04ea82fd52bbfadb80b046ceb6097..ee7b646a636fb46df1de6a4c27e4d05d173395da 100644 (file)
@@ -1,6 +1,6 @@
 {#
 # GNU MediaGoblin -- federated, autonomous media hosting
-# Copyright (C) 2011 MediaGoblin contributors.  See AUTHORS.
+# Copyright (C) 2011, 2012 MediaGoblin contributors.  See AUTHORS.
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU Affero General Public License as published by
 #}
 {% extends "mediagoblin/base.html" %}
 
+{% from "mediagoblin/utils/pagination.html" import render_pagination %}
+
+{% block title -%}
+  {% trans %}Media processing panel{% endtrans %} — {{ super() }}
+{%- endblock %}
+
 {% block mediagoblin_content %}
 
 <h1>{% trans %}Media processing panel{% endtrans %}</h1>
 <p>
   {% trans %}You can track the state of media being processed for your gallery here.{% endtrans %}
 </p>
-    
-<h2>{% trans %}Media in-processing{% endtrans %}</h2>
 
-{% if processing_entries.count() %}
+<p>
+Show:
+<a href="{{ request.urlgen('mediagoblin.user_pages.processing_panel',
+                           user=request.user.username) }}">All</a>,
+<a href="{{ request.urlgen('mediagoblin.user_pages.processing_panel',
+                           user=request.user.username, state="processing") }}">In processing</a>,
+<a href="{{ request.urlgen('mediagoblin.user_pages.processing_panel',
+                           user=request.user.username, state="failed") }}">Failed</a>,
+<a href="{{ request.urlgen('mediagoblin.user_pages.processing_panel',
+                           user=request.user.username, state="processed") }}">Successful</a>
+</p>
+    
+{% if entries.count() %}
+  {{ render_pagination(request, pagination) }}
   <table class="media_panel processing">
     <tr>
+      <th width="210">Thumbnail</th>
       <th>Title</th>
-      <th>When submitted</th>
-      <th>Status</th>
+      <th width="20%">When submitted</th>
+      <th width="200">Transcoding progress</th>
     </tr>
-    {% for media_entry in processing_entries %}
+    {% for media_entry in entries %}
       <tr>
-        <td>{{ media_entry['title'] }}</td>
-        <td>{{ media_entry['created'].strftime("%m-%d-%Y %I:%M %p") }}</td>
-        <td></td>
+      {% if media_entry.state == 'processed' %}
+        {% set entry_url = media_entry.url_for_self(request.urlgen) %}
+        <td>
+            <div class="thumb-wrapper">
+                <a href="{{ entry_url }}">
+                    <img src="{{ media_entry.thumb_url }}" alt="{{ media_entry.title }}" />
+                </a>
+            </div>
+        </td>
+        <td><a href="{{ entry_url }}">{{ media_entry.title }}</a></td>
+        <td>{{ media_entry.created.strftime("%F %R") }}</td>
+        <td>Ready</td>
+      {% else %}
+        <td>
+            <div class="thumb-wrapper">
+                <img src="{{ media_entry.thumb_url }}" alt="{{ media_entry.title }}" />
+                {% if media_entry.state == 'processing' %}
+                <div class="thumb-overlay-status thumb-processing">Processing...</div>
+                {% elif media_entry.state == 'failed' %}
+                <div class="thumb-overlay-status thumb-failed">Failed!</div>
+                {% endif %}
+            </div>
+        </td>
+        <td>{{ media_entry.title }}</td>
+        <td>{{ media_entry.created.strftime("%F %R") }}</td>
+        {% if media_entry.transcoding_progress %}
+        <td>{{ media_entry.transcoding_progress }}%</td>
+        {% else %}
+        <td>Unknown</td>
+        {% endif %}
+      {% endif %}
       </tr>
     {% endfor %}
   </table>
+  {{ render_pagination(request, pagination) }}
 {% else %}
-  <p><i>{% trans %}No media in-processing{% endtrans %}</i></p>
-{% endif %}  
-
-{% if failed_entries.count() %}
-  <h2>{% trans %}These uploads failed to process:{% endtrans %}</h2>
-
-  <table class="media_panel failed">
-    <tr>
-      <th>Title</th>
-      <th>When submitted</th>
-      <th>Reason for failure</th>
-    </tr>
-    {% for media_entry in failed_entries %}
-      <tr>
-        <td>{{ media_entry['title'] }}</td>
-        <td>{{ media_entry['created'].strftime("%m-%d-%Y %I:%M %p") }}</td>
-        <td>{{ media_entry.get_fail_exception().general_message }}</td>
-      </tr>
-    {% endfor %}
-  </table>
+  <p><em>{% trans %}You have not uploaded anything yet!{% endtrans %}</em></p>
 {% endif %}  
 {% endblock %}