SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit e065bbb4 authored by Jorran de Wit's avatar Jorran de Wit
Browse files

Improve personal (comment) page

parent a17c51b5
No related branches found
No related tags found
No related merge requests found
......@@ -9,3 +9,9 @@ class CommentQuerySet(models.QuerySet):
def awaiting_vetting(self):
return self.filter(status=STATUS_PENDING)
def regular_comments(self):
return self.filter(is_author_reply=False)
def author_replies(self):
return self.filter(is_author_reply=True)
......@@ -57,7 +57,8 @@ class Comment(TimeStampedModel):
# Author info
is_author_reply = models.BooleanField(default=False)
author = models.ForeignKey('scipost.Contributor', on_delete=models.CASCADE)
author = models.ForeignKey('scipost.Contributor', on_delete=models.CASCADE,
related_name='comments')
anonymous = models.BooleanField(default=False, verbose_name='Publish anonymously')
# Categories:
......
<div class="card-block card-comment">
{% block card_block_header %}{% endblock %}
<p class="card-text">
<span class="text-blue">
<a href="{{comment.author.get_absolute_url}}">{{comment.author.user.first_name}} {{comment.author.user.last_name}}</a>:
</span>
<a href="{{comment.author.get_absolute_url}}">{{comment.author.user.first_name}} {{comment.author.user.last_name}}</a>:
<a href="{{comment.get_absolute_url}">
"{{comment.comment_text|slice:'30'}}{% if comment.comment_text|length > 30 %}...{% endif %}"
......
<div class="card-block card-comment">
<div class="mb-4 mt-2">
<div class="d-inline-block mr-1">Nr {{comment.id}}</div>
{% include 'comments/_comment_voting_summary.html' with comment=comment class='small' %}
</div>
<p>"{{comment.comment_text|linebreaksbr}}"</p>
<p class="card-text">by <a href="{{comment.author.get_absolute_url}}">{{comment.author.user.first_name}} {{comment.author.user.last_name}}</a> in {{comment.content_type|capfirst}} on <a href="{{comment.content_object.get_absolute_url}}" class="pubtitleli">{{comment.title}}</a> {% if comment.content_object.author_list %} <span class="text-muted">by {{comment.content_object.author_list}}</span>{% endif %}</p>
{% comment %}
Using 'by xxx' on non-submission comments here would be ambigious. Does the `by xxx` apply to the
other object (eg. Report), or the Submission, the Comment, etc?
{% endcomment %}
<p class="card-text text-muted">Comment submitted {{comment.date_submitted}}</p>
<p class="card-text">Status: <span class="{% if comment.status == 1 %} text-success{% elif comment.status == 0 %} text-danger{% endif %}">{{comment.get_status_display}}</span></p>
</div>
......@@ -58,10 +58,14 @@
<a class="nav-link" data-toggle="tab" href="#theses">Theses</a>
</li>
<li class="nav-item btn btn-secondary">
<a class="nav-link" data-toggle="tab" href="#comments">Comments</a>
{% with request.user.contributor.comments.regular_comments.awaiting_vetting.count as count %}
<a class="nav-link" data-toggle="tab" href="#comments">Comments{% if count %} ({{count}} unvetted){% endif %}</a>
{% endwith %}
</li>
<li class="nav-item btn btn-secondary">
<a class="nav-link" data-toggle="tab" href="#author-replies">Author Replies</a>
{% with request.user.contributor.comments.author_replies.awaiting_vetting.count as count %}
<a class="nav-link" data-toggle="tab" href="#author-replies">Author Replies{% if count %} ({{count}} unvetted){% endif %}</a>
{% endwith %}
</li>
</ul>
</div>
......@@ -580,7 +584,7 @@
<ul class="list-group list-group-flush">
{% for own_comment in own_comments %}
<li class="list-group-item">
{% include 'comments/_comment_card_extended_content.html' with comment=own_comment %}
{% include 'comments/_comment_card_extended_for_author.html' with comment=own_comment %}
</li>
{% empty %}
<li class="list-group-item"><em>You have not commented yet.</em></li>
......@@ -607,7 +611,7 @@
<ul class="list-group list-group-flush">
{% for own_reply in own_authorreplies %}
<li class="list-group-item">
{% include 'comments/_comment_card_extended_content.html' with comment=own_reply %}
{% include 'comments/_comment_card_extended_for_author.html' with comment=own_reply %}
</li>
{% empty %}
<li class="list-group-item"><em>You do not have Author Replies yet.</em></li>
......
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