From eb97d3cc4b1e724ad6da5860166f2bfa15a381d1 Mon Sep 17 00:00:00 2001
From: "J.-S. Caux" <J.S.Caux@uva.nl>
Date: Sat, 9 Sep 2017 20:12:34 +0200
Subject: [PATCH] Improve presentation of DOIs for Reports and Comments

---
 comments/models.py                                |  7 +++++++
 .../templates/comments/_comment_identifier.html   |  2 ++
 .../journals/generic_metadata_xml_deposit.html    |  2 +-
 submissions/models.py                             |  2 ++
 .../submissions/_report_tex_template.html         |  1 -
 .../_single_public_report_without_comments.html   | 15 +++++++++------
 6 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/comments/models.py b/comments/models.py
index 648f74062..06225901f 100644
--- a/comments/models.py
+++ b/comments/models.py
@@ -137,6 +137,13 @@ class Comment(TimeStampedModel):
         self.doi_label = 'SciPost.Comment.' + str(self.id)
         self.save()
 
+    @property
+    def doi_string(self):
+        if self.doi_label:
+            return '10.21468/' + self.doi_label
+        else:
+            return None
+
     def get_absolute_url(self):
         return self.content_object.get_absolute_url().split('#')[0] + '#comment_id' + str(self.id)
 
diff --git a/comments/templates/comments/_comment_identifier.html b/comments/templates/comments/_comment_identifier.html
index 5e668b933..9c6b31277 100644
--- a/comments/templates/comments/_comment_identifier.html
+++ b/comments/templates/comments/_comment_identifier.html
@@ -6,8 +6,10 @@
 
         <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'}}
+	{% if comment.doi_string %}&nbsp; <small>doi:  {{ comment.doi_string }}</small>{% endif %}
     </h3>
 
+
     {% if comment|is_reply_to_comment %}
         (in reply to <a href="{{comment.get_absolute_url}}">{{comment.content_object.author.user.first_name}} {{comment.content_object.author.user.last_name}}</a> on {{comment.content_object.date_submitted|date:'Y-m-d'}})
     {% elif comment|is_reply_to_report %}
diff --git a/journals/templates/journals/generic_metadata_xml_deposit.html b/journals/templates/journals/generic_metadata_xml_deposit.html
index a91ff6e38..535368b03 100644
--- a/journals/templates/journals/generic_metadata_xml_deposit.html
+++ b/journals/templates/journals/generic_metadata_xml_deposit.html
@@ -26,7 +26,7 @@
   <h3 class="mt-3">Response text:</h3>
   <p>{{ response_text|linebreaks }}</p>
 
-  <h3>Return to the <a href="{% url 'journals:manage_report_metadata' %}">report</a> or to the <a href="{% url 'journals:manage_comment_metadata' %}">commentt</a> metadata management page</h3>
+  <h3>Return to the <a href="{% url 'journals:manage_report_metadata' %}">report</a> or to the <a href="{% url 'journals:manage_comment_metadata' %}">comment</a> metadata management page</h3>
 
   </div>
 </div>
diff --git a/submissions/models.py b/submissions/models.py
index 3514ca2ee..597d71e0a 100644
--- a/submissions/models.py
+++ b/submissions/models.py
@@ -422,6 +422,8 @@ class Report(SubmissionRelatedObjectMixin, models.Model):
     def doi_string(self):
         if self.doi_label:
             return '10.21468/' + self.doi_label
+        else:
+            return None
 
     @cached_property
     def title(self):
diff --git a/submissions/templates/submissions/_report_tex_template.html b/submissions/templates/submissions/_report_tex_template.html
index edb59afc1..466bd507f 100644
--- a/submissions/templates/submissions/_report_tex_template.html
+++ b/submissions/templates/submissions/_report_tex_template.html
@@ -63,7 +63,6 @@ Report by {% if report.anonymous %}anonymous{% else %}{{report.author.user.first
 %%%%%%%%%% COPYRIGHT
 
 {\small Copyright {% if report.anonymous %}anonymous{% else %}{{report.author.user.first_name}} {{report.author.user.last_name}}{% endif %}. \newline
-
 This work is licensed under the Creative Commons \newline
 \href{http://creativecommons.org/licenses/by/4.0/}{Attribution 4.0 International License}. \newline
 Published by the SciPost Foundation.
diff --git a/submissions/templates/submissions/_single_public_report_without_comments.html b/submissions/templates/submissions/_single_public_report_without_comments.html
index 289f2169d..9c322add2 100644
--- a/submissions/templates/submissions/_single_public_report_without_comments.html
+++ b/submissions/templates/submissions/_single_public_report_without_comments.html
@@ -8,15 +8,18 @@
 
                 <div class="reportid">
                     <h3>{% if report.anonymous %}(chose public anonymity) {% endif %}<a href="{{report.author.get_absolute_url}}">{{ report.author.user.first_name }} {{ report.author.user.last_name }}</a>
-                        on {{ report.date_submitted|date:'Y-n-j' }}</h3>
+                      on {{ report.date_submitted|date:'Y-n-j' }}
                     </h3>
-                    {% if report.pdf_report %}
-                        <a href="{% url 'submissions:report_detail_pdf' report.submission.arxiv_identifier_w_vn_nr report.report_nr %}" target="_blank">Download as PDF</a>
+		    <ul class="publicationClickables">
+		      {% if report.doi_string %}<li>doi:  {{ report.doi_string }}</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 %}
                     {% if perms.scipost.can_manage_reports %}
-                        {% if report.pdf_report %}&middot; {% endif %}<a href="{% url 'submissions:report_pdf_compile' report.id %}">Update/Compile the Report pdf</a>
-                    {% endif %}
-                </div>
+                      <li><a href="{% url 'submissions:report_pdf_compile' report.id %}">Update/Compile the Report pdf</a></li>
+                      {% endif %}
+		    </ul>
+</div>
 
                 {% if report.flagged %}
                     <h4 class="text-danger font-weight-bold">CAUTION: check if this referee has been flagged by the authors</h4>
-- 
GitLab