From: Boris Bobrov Date: Sat, 16 Aug 2014 14:41:37 +0000 (+0300) Subject: added filtering by entry state in processing panel X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=906a00b6679fc7940262dde48467b102894fa9fe;p=mediagoblin.git added filtering by entry state in processing panel --- diff --git a/mediagoblin/plugins/processing_info/templates/mediagoblin/processing_info/header_left.html b/mediagoblin/plugins/processing_info/templates/mediagoblin/processing_info/header_left.html index d635afce..1d5e724d 100644 --- a/mediagoblin/plugins/processing_info/templates/mediagoblin/processing_info/header_left.html +++ b/mediagoblin/plugins/processing_info/templates/mediagoblin/processing_info/header_left.html @@ -18,15 +18,15 @@ {#This injects some information about entries in processing #} {% if request.user and request.user.has_privilege('active') %} {% if num_queued is defined and num_queued != 0 %} -{% set panel_url = request.urlgen('mediagoblin.user_pages.processing_panel', - user=request.user.username) %} - ⏳ {{ num_queued }} + ⏳ {{ num_queued }} {% endif %} {% if num_failed is defined and num_failed != 0 %} - ☹ {{ num_failed }} + ☹ {{ num_failed }} {% endif %} {% endif %} diff --git a/mediagoblin/templates/mediagoblin/user_pages/processing_panel.html b/mediagoblin/templates/mediagoblin/user_pages/processing_panel.html index d803e51c..88eef827 100644 --- a/mediagoblin/templates/mediagoblin/user_pages/processing_panel.html +++ b/mediagoblin/templates/mediagoblin/user_pages/processing_panel.html @@ -28,6 +28,18 @@

{% trans %}You can track the state of media being processed for your gallery here.{% endtrans %}

+ +

+Show: +All, +In processing, +Failed, +Succesful +

{% if entries.count() %} diff --git a/mediagoblin/user_pages/routing.py b/mediagoblin/user_pages/routing.py index 1a1d4139..68cb0a3b 100644 --- a/mediagoblin/user_pages/routing.py +++ b/mediagoblin/user_pages/routing.py @@ -97,6 +97,11 @@ add_route('mediagoblin.user_pages.processing_panel', '/u//panel/', 'mediagoblin.user_pages.views:processing_panel') +add_route('mediagoblin.user_pages.processing_panel', + '/u//panel//', + 'mediagoblin.user_pages.views:processing_panel') + + # Stray edit routes add_route('mediagoblin.edit.edit_media', '/u//m//edit/', diff --git a/mediagoblin/user_pages/views.py b/mediagoblin/user_pages/views.py index 0de63440..97f0bac1 100644 --- a/mediagoblin/user_pages/views.py +++ b/mediagoblin/user_pages/views.py @@ -653,11 +653,18 @@ def processing_panel(request): return redirect( request, 'mediagoblin.user_pages.user_home', user=user.username) - # Get media entries which are in-processing entries = (MediaEntry.query.filter_by(uploader=user.id) .order_by(MediaEntry.created.desc())) + try: + state = request.matchdict['state'] + # no exception was thrown, filter entries by state + entries = entries.filter_by(state=state) + except KeyError: + # show all entries + pass + # Render to response return render_to_response( request,