Skip to content

Commit

Permalink
Adding editorial queue (#66)
Browse files Browse the repository at this point in the history
* Adding editorial queue

* Removing print line

* Changing page heading

* Change wording
  • Loading branch information
Dimithri authored Jun 28, 2022
1 parent d5c72b5 commit df727f6
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 1 deletion.
28 changes: 28 additions & 0 deletions signbank/editorial_queue.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
from .dictionary.models import Gloss
from django.shortcuts import render
from django_comments import get_model as django_comments_get_model


def get_queue_items(request):
"""
As per the first comment of N2-92, get the glosses which are assigned to you
"""
user = request.user
glosses = Gloss.objects.filter(assigned_user=user)
gloss_data = []
for gloss in glosses:
comments = django_comments_get_model().objects.filter(
object_pk=str(gloss.id),
is_removed=False,
).order_by('-submit_date')[:3]
gloss_data.append({
'gloss': gloss,
'comments': comments
})

if 'details/' in request.path:
template = 'editorial_queue/queue_gloss_details.html'
else:
template = 'editorial_queue/queue.html'

return render(request, template, {'glosses': gloss_data})
5 changes: 5 additions & 0 deletions signbank/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from .comments import edit_comment, latest_comments, latest_comments_page, CommentListView, remove_tag
import notifications.urls
from .sitemaps import GlossSitemap, SignbankFlatPageSiteMap, StaticViewSitemap
from .editorial_queue import get_queue_items
# Forms
from .customregistration.forms import CustomUserForm

Expand Down Expand Up @@ -75,6 +76,10 @@

# Infopage, where we store some links and statistics
path('info/', infopage, name='infopage'),

# Editorial queue
path('queue/', get_queue_items, name='queue'),
path('queue/details/', get_queue_items, name='details'),
]
if settings.DEBUG:
import debug_toolbar
Expand Down
6 changes: 6 additions & 0 deletions templates/editorial_queue/queue.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{% extends "baselayout.html" %}
{% load i18n %}
{% block bootstrap3_title %}{% blocktrans %}Editorial Queue{% endblocktrans %} | {% endblock %}
{% block content %}
{% include "editorial_queue/queue_gloss_details.html" %}
{% endblock %}
32 changes: 32 additions & 0 deletions templates/editorial_queue/queue_gloss_details.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{% load i18n %}
<div class="latest_comments">
<h2><a href="{% url 'queue' %}">{% blocktrans %}Editorial Queue{% endblocktrans %}</a></h2>
{% for gloss in glosses %}
{% load tagging_tags %}
{% tags_for_object gloss.gloss as tag_list %}
<article class="gloss">
<header>
<h4 class="gloss-header"><a href="{{gloss.gloss.get_absolute_url}}"><strong>{{gloss.gloss.idgloss}}</strong>
<span class="glyphicon glyphicon-time" aria-hidden="true"></span> <em>{{gloss.gloss.updated_at}}</em> -
<span class="glyphicon glyphicon-user" aria-hidden="true"></span> {{gloss.gloss.assigned_user}}</a>
{% if tag_list %}
{% for tag in tag_list %}
<div class="comment-tags" style="display:inline;">
<span class="label label-info" style="font-size:60%;">{{tag}}</span>
</div>
{% endfor %}
{% endif %}
</h4>
</header>
{% if gloss.comments %}
<div class="panel panel-default">
{% for comment in gloss.comments %}
<div class="panel-body">
<p><b>{{comment.comment}}</b> <em>{{ comment.submit_date }}</em>, <em>{{ comment.user }}</em></p>
</div>
{% endfor %}
</div>
{% endif %}
</article>
{% endfor %}
</div>
2 changes: 1 addition & 1 deletion templates/flatpages/frontpage.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
{% if perms.dictionary.search_gloss %}
<script type="text/javascript">
$(document).ready(function() {
$('#front-right').load('/comments/latest/');
$('#front-right').load('/queue/details/');
});
</script>
{% endif %}
Expand Down

0 comments on commit df727f6

Please sign in to comment.