SciPost Code Repository

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

Add cite-as info on citable Reports and Comments

parent 8f46ada5
No related branches found
No related tags found
No related merge requests found
......@@ -233,3 +233,20 @@ class Comment(TimeStampedModel):
return relation
return None
@property
def citation(self):
if self.doi_string:
citation = ''
if self.anonymous:
citation += 'Anonymous, '
else:
citation += '%s %s, ' % (self.author.user.first_name, self.author.user.last_name)
if self.is_authorreply:
citation += 'SciPost Author Replies '
else:
citation += 'SciPost Comments '
citation += '(%s), doi:' % self.date_submitted.strftime('%Y')
citation += self.doi_string
return None
......@@ -17,7 +17,7 @@
<a href="{{comment.author.get_absolute_url}}">{{comment.author.user.first_name}} {{comment.author.user.last_name}}</a>
on {{comment.date_submitted|date:'Y-m-d'}}
{% endif %}
{% if comment.doi_string %}&nbsp; <small>doi: {{ comment.doi_string }}</small>{% endif %}
{% if comment.doi_string %}&nbsp; <small>{{ comment|citation }}</small>{% endif %}
</h3>
......
......@@ -523,6 +523,19 @@ class Report(SubmissionRelatedObjectMixin, models.Model):
return None
@property
def citation(self):
if self.doi_string:
citation = ''
if self.anonymous:
citation += 'Anonymous, '
else:
citation += '%s %s, ' % (self.author.user.first_name, self.author.user.last_name)
citation += 'Report on %s, ' % self.submission.arxiv_identifier_w_vn_nr
citation += 'SciPost Reports (%s), doi:' % self.date_submitted.strftime('%Y')
citation += self.doi_string
return None
##########################
# EditorialCommunication #
......
......@@ -11,7 +11,7 @@
on {{ report.date_submitted|date:'Y-n-j' }}
</h3>
<ul class="publicationClickables">
{% if report.doi_string %}<li>doi: {{ report.doi_string }}</li>{% endif %}
{% if report.doi_string %}<li>{{ report|citation }}</li>{% endif %}
{% if report.pdf_report %}
<li><a href="{% url 'submissions:report_detail_pdf' report.submission.arxiv_identifier_w_vn_nr report.report_nr %}" target="_blank">Download as PDF</a></li>
{% endif %}
......@@ -53,7 +53,7 @@
on {{ report.date_submitted|date:'Y-n-j' }}</h3>
</h3>
<ul class="publicationClickables">
{% if report.doi_string %}<li>doi: {{ report.doi_string }}</li>{% endif %}
{% if report.doi_string %}<li>{{ report|citation }}</li>{% endif %}
{% if report.pdf_report %}
<li><a href="{% url 'submissions:report_detail_pdf' report.submission.arxiv_identifier_w_vn_nr report.report_nr %}" target="_blank">Download as PDF</a></li>
{% endif %}
......
......@@ -30,3 +30,8 @@ def user_is_referee(submission, user):
@register.filter
def is_voting_fellow(submission, user):
return submission.voting_fellows.filter(contributor__user=user).exists()
@register.filter
def citation(citable):
return citable.citation
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