SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit fda001ed authored by Jean-Sébastien Caux's avatar Jean-Sébastien Caux
Browse files

Improve comments listing

parent b0b596ff
No related branches found
No related tags found
No related merge requests found
...@@ -49,6 +49,19 @@ ...@@ -49,6 +49,19 @@
</section> </section>
{% if comment_recent_list %}
<section>
<hr class="hr12">
<h2>Recent Comments</h2>
<ul>
{% for comment in comment_recent_list %}
{{ comment.simple_header_as_li }}
{% endfor %}
</ul>
</section>
{% endif %}
{% if commentary_recent_list %} {% if commentary_recent_list %}
<section> <section>
<hr class="hr12"> <hr class="hr12">
......
...@@ -308,9 +308,13 @@ def commentaries(request): ...@@ -308,9 +308,13 @@ def commentaries(request):
form = CommentarySearchForm() form = CommentarySearchForm()
commentary_search_list = [] commentary_search_list = []
comment_recent_list = (Comment.objects.filter(status='1')
.order_by('-date_submitted')[:10])
commentary_recent_list = (Commentary.objects.filter(vetted=True) commentary_recent_list = (Commentary.objects.filter(vetted=True)
.order_by('-latest_activity')[:10]) .order_by('-latest_activity')[:10])
context = {'form': form, 'commentary_search_list': commentary_search_list, context = {'form': form, 'commentary_search_list': commentary_search_list,
'comment_recent_list': comment_recent_list,
'commentary_recent_list': commentary_recent_list } 'commentary_recent_list': commentary_recent_list }
return render(request, 'commentaries/commentaries.html', context) return render(request, 'commentaries/commentaries.html', context)
......
...@@ -248,6 +248,8 @@ class Comment(models.Model): ...@@ -248,6 +248,8 @@ class Comment(models.Model):
if len(self.comment_text) > 30: if len(self.comment_text) > 30:
text_cut += '...' text_cut += '...'
context['text_cut'] = text_cut context['text_cut'] = text_cut
context['name'] = self.author.user.first_name + ' ' + self.author.user.last_name
header += '{{ name }}, '
if self.submission is not None: if self.submission is not None:
header += '<a href="/submission/{{ submission_id }}#comment_id{{ id }}"> \"{{ text_cut }}\"</a>' header += '<a href="/submission/{{ submission_id }}#comment_id{{ id }}"> \"{{ text_cut }}\"</a>'
header += (' in submission on <a href="/submission/{{ submission_id }}" class="pubtitleli">' + header += (' in submission on <a href="/submission/{{ submission_id }}" class="pubtitleli">' +
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment