added filtering by entry state in processing panel
This commit is contained in:
parent
be9262b4d4
commit
906a00b667
@ -18,15 +18,15 @@
|
|||||||
{#This injects some information about entries in processing #}
|
{#This injects some information about entries in processing #}
|
||||||
{% if request.user and request.user.has_privilege('active') %}
|
{% if request.user and request.user.has_privilege('active') %}
|
||||||
{% if num_queued is defined and num_queued != 0 %}
|
{% if num_queued is defined and num_queued != 0 %}
|
||||||
{% set panel_url = request.urlgen('mediagoblin.user_pages.processing_panel',
|
|
||||||
user=request.user.username) %}
|
|
||||||
<span class="num_queued status_icon">
|
<span class="num_queued status_icon">
|
||||||
<a href="{{ panel_url }}">⏳ {{ num_queued }}</a>
|
<a href="{{ request.urlgen('mediagoblin.user_pages.processing_panel',
|
||||||
|
user=request.user.username, state="processing") }}">⏳ {{ num_queued }}</a>
|
||||||
</span>
|
</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if num_failed is defined and num_failed != 0 %}
|
{% if num_failed is defined and num_failed != 0 %}
|
||||||
<span class="num_failed status_icon">
|
<span class="num_failed status_icon">
|
||||||
<a href="{{ panel_url }}">☹ {{ num_failed }}</a>
|
<a href="{{ request.urlgen('mediagoblin.user_pages.processing_panel',
|
||||||
|
user=request.user.username, state="failed") }}">☹ {{ num_failed }}</a>
|
||||||
</span>
|
</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -28,6 +28,18 @@
|
|||||||
<p>
|
<p>
|
||||||
{% trans %}You can track the state of media being processed for your gallery here.{% endtrans %}
|
{% trans %}You can track the state of media being processed for your gallery here.{% endtrans %}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<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") }}">Succesful</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
{% if entries.count() %}
|
{% if entries.count() %}
|
||||||
<table class="media_panel processing">
|
<table class="media_panel processing">
|
||||||
|
@ -97,6 +97,11 @@ add_route('mediagoblin.user_pages.processing_panel',
|
|||||||
'/u/<string:user>/panel/',
|
'/u/<string:user>/panel/',
|
||||||
'mediagoblin.user_pages.views:processing_panel')
|
'mediagoblin.user_pages.views:processing_panel')
|
||||||
|
|
||||||
|
add_route('mediagoblin.user_pages.processing_panel',
|
||||||
|
'/u/<string:user>/panel/<any(processed, processing, failed):state>/',
|
||||||
|
'mediagoblin.user_pages.views:processing_panel')
|
||||||
|
|
||||||
|
|
||||||
# Stray edit routes
|
# Stray edit routes
|
||||||
add_route('mediagoblin.edit.edit_media',
|
add_route('mediagoblin.edit.edit_media',
|
||||||
'/u/<string:user>/m/<int:media_id>/edit/',
|
'/u/<string:user>/m/<int:media_id>/edit/',
|
||||||
|
@ -653,11 +653,18 @@ def processing_panel(request):
|
|||||||
return redirect(
|
return redirect(
|
||||||
request, 'mediagoblin.user_pages.user_home',
|
request, 'mediagoblin.user_pages.user_home',
|
||||||
user=user.username)
|
user=user.username)
|
||||||
|
|
||||||
# Get media entries which are in-processing
|
# Get media entries which are in-processing
|
||||||
entries = (MediaEntry.query.filter_by(uploader=user.id)
|
entries = (MediaEntry.query.filter_by(uploader=user.id)
|
||||||
.order_by(MediaEntry.created.desc()))
|
.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
|
# Render to response
|
||||||
return render_to_response(
|
return render_to_response(
|
||||||
request,
|
request,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user