From b9b8d21486fac8ee4a524e2694a231924beba837 Mon Sep 17 00:00:00 2001
From: "J.-S. Caux" <J.S.Caux@uva.nl>
Date: Sat, 30 Jan 2016 11:23:30 +0100
Subject: [PATCH] Improve presentation

---
 commentaries/models.py                        | 11 ++++++
 .../commentaries/commentary_detail.html       |  8 ++--
 .../submissions/submission_detail.html        | 38 ++++++-------------
 3 files changed, 27 insertions(+), 30 deletions(-)

diff --git a/commentaries/models.py b/commentaries/models.py
index 105338d43..7f8f4e67e 100644
--- a/commentaries/models.py
+++ b/commentaries/models.py
@@ -44,3 +44,14 @@ class Commentary(models.Model):
     def __str__ (self):
         return self.pub_title
 
+    def header_as_table (self):
+        header = '<table>'
+        header += '<tr><td>Title: </td><td>&nbsp;</td><td>' + self.pub_title + '</td></tr>'
+        header += '<tr><td>Author(s): </td><td>&nbsp;</td><td>' + self.author_list + '</td></tr>'
+        if self.type == 'published':
+            header += '<tr><td>DOI: </td><td>&nbsp;</td><td><a href="' + self.pub_DOI_link + '">' + self.pub_DOI_link + '</a></td></tr>'
+        elif self.type == 'preprint':
+            header += '<tr><td>arxiv Link: </td><td>&nbsp;</td><td><a href="' + self.arxiv_link + '">' + self.arxiv_link + '</a></td></tr>'
+        header += '<tr><td>Date: </td><td>&nbsp;</td><td>' + str(self.pub_date) + '</td></tr>'
+        header += '</table>'
+        return header
diff --git a/commentaries/templates/commentaries/commentary_detail.html b/commentaries/templates/commentaries/commentary_detail.html
index 5ee30ce8f..2e75a4b68 100644
--- a/commentaries/templates/commentaries/commentary_detail.html
+++ b/commentaries/templates/commentaries/commentary_detail.html
@@ -39,19 +39,18 @@
 -->
 <section>
   <div class="flex-greybox">
-    <h1>SciPost Commentary Page &nbsp; (for non-SciPost publications)</h1>
+    <h1>SciPost Commentary Page &nbsp; (non-SciPost publications)</h1>
     <button id="ratingsbutton">Toggle ratings view</button>
   </div>
-</section>
 
-<section>
   <hr class="hr12">
   <div class="row">
     <div class="col-4">
       <h2>Original publication: </h2>
     </div>
   </div>
-
+  {{ commentary.header_as_table|safe }}
+<!--
   <table>
     <tr><td>Title: </td><td>{{ commentary.pub_title }}</td></tr>
     <tr><td>Author(s): </td><td>{{ commentary.author_list }}</td></tr>
@@ -59,6 +58,7 @@
     <tr><td>DOI Link: </td><td><a href="{{ commentary.pub_DOI_link }}">{{ commentary.pub_DOI_link }}</a></td></tr>
     <tr><td>Date published: </td><td>{{ commentary.pub_date }}</td></tr>
   </table>
+-->
 
   <h3>Abstract:</h3>
   <p>{{ commentary.pub_abstract }}</p>
diff --git a/submissions/templates/submissions/submission_detail.html b/submissions/templates/submissions/submission_detail.html
index 7f1ee7ae9..b8bdf099b 100644
--- a/submissions/templates/submissions/submission_detail.html
+++ b/submissions/templates/submissions/submission_detail.html
@@ -28,19 +28,11 @@
 {% if user.is_authenticated %}
 
 <section>
-  <hr class="hr12">
-  <div class="row">
-    <div class="col-10">
-      <h1>SciPost Submission Page &nbsp; (for papers submitted to SciPost)</h1>
-    </div>
-    <div class="col-2">
-      <br/>
-      <button id="ratingsbutton">Toggle ratings view</button>
-    </div>
+  <div class="flex-greybox">
+    <h1>SciPost Submission Page &nbsp; (for papers submitted to SciPost)</h1>
+    <button id="ratingsbutton">Toggle ratings view</button>
   </div>
-</section>
 
-<section>
   <hr class="hr12">
   <div class="row">
     <div class="col-4">
@@ -78,13 +70,9 @@
 {% if reports %}
 <section>
   <hr class="hr12">
-  <div class="row">
-    <div class="col-10">
-      <h2>Reports on this Submission</h2>
-    </div>
-    <div class="col-2">
-      <button id="reportsbutton">Toggle reports view</button>
-    </div>
+  <div class="flex-breybox">
+    <h2>Reports on this Submission</h2>
+    <button id="reportsbutton">Toggle reports view</button>
   </div>
 
   <div id="reportslist">
@@ -235,13 +223,9 @@
 {% if comments %}
 <section>
   <hr class="hr12">
-  <div class="row">
-    <div class="col-10">
-      <h2>Comments on this Submission</h2>
-    </div>
-    <div class="col-2">
-      <button id="commentsbutton">Toggle comments view</button>
-    </div>
+  <div class="flex-greybox">
+    <h2>Comments on this Submission</h2>
+    <button id="commentsbutton">Toggle comments view</button>
   </div>
 
   <div id="commentslist">
@@ -379,7 +363,9 @@
 {% if user.is_authenticated and submission.open_for_commenting and user.contributor.rank > 0 %}
 <section>
   <hr class="hr12"/>
-  <h1>Contribute a Comment:</h1>
+  <div class="flex-greybox">
+    <h1>Contribute a Comment:</h1>
+  </div>
   <form action="{% url 'submissions:submission' submission.id %}" method="post">
     {% csrf_token %}
     {% load crispy_forms_tags %}
-- 
GitLab