From 697104d59c564ad4280039b0329b4ea681cb2a67 Mon Sep 17 00:00:00 2001
From: "J.-S. Caux" <J.S.Caux@uva.nl>
Date: Mon, 28 Mar 2016 22:41:01 +0200
Subject: [PATCH] Move group and permission creation to management command
 add_groups_and_permissions, STATIC_ROOT nin settings.py

---
 SciPost_v1/settings.py                        |   2 +-
 scipost/management/__init__.py                |   0
 scipost/management/commands/__init__.py       |   0
 .../commands/add_groups_and_permissions.py    |  33 ++++
 scipost/models.py                             |  15 +-
 scipost/utils.py                              |  34 ++--
 scipost/views.py                              |  26 ---
 static/scipost/SciPost.css                    | 185 ++++++------------
 8 files changed, 113 insertions(+), 182 deletions(-)
 create mode 100644 scipost/management/__init__.py
 create mode 100644 scipost/management/commands/__init__.py
 create mode 100644 scipost/management/commands/add_groups_and_permissions.py

diff --git a/SciPost_v1/settings.py b/SciPost_v1/settings.py
index 34fe4a198..b11eafcb4 100644
--- a/SciPost_v1/settings.py
+++ b/SciPost_v1/settings.py
@@ -142,7 +142,7 @@ USE_TZ = True
 # https://docs.djangoproject.com/en/1.8/howto/static-files/
 
 STATIC_URL = host_settings["STATIC_URL"]
-STATIC_ROOT = host_settings["STATIC_ROOT"]
+STATIC_ROOT = os.path.join(BASE_DIR, "static")
 
 # Email
 EMAIL_BACKEND = host_settings["EMAIL_BACKEND"]
diff --git a/scipost/management/__init__.py b/scipost/management/__init__.py
new file mode 100644
index 000000000..e69de29bb
diff --git a/scipost/management/commands/__init__.py b/scipost/management/commands/__init__.py
new file mode 100644
index 000000000..e69de29bb
diff --git a/scipost/management/commands/add_groups_and_permissions.py b/scipost/management/commands/add_groups_and_permissions.py
new file mode 100644
index 000000000..1216016bb
--- /dev/null
+++ b/scipost/management/commands/add_groups_and_permissions.py
@@ -0,0 +1,33 @@
+from django.core.management.base import BaseCommand, CommandError
+
+from django.contrib.auth.models import Group, Permission
+
+class Command(BaseCommand):
+    help = 'Defines groups and permissions'
+
+    def handle(self, *args, **options):
+        SciPostAdmin, created = Group.objects.get_or_create(name='SciPost Administrators')
+        AdvisoryBoard, created = Group.objects.get_or_create(name='Advisory Board')
+        EditorialCollege, created = Group.objects.get_or_create(name='Editorial College')
+        VettingEditors, created = Group.objects.get_or_create(name='Vetting Editors')
+        RegisteredContributors, created = Group.objects.get_or_create(name='Registered Contributors')
+        # Registration
+        can_manage_registration_invitations = Permission.objects.get(codename='can_manage_registration_invitations')
+        can_vet_registration_requests = Permission.objects.get(codename='can_vet_registration_requests')
+        # Vetting of simple objects
+        can_vet_commentary_requests = Permission.objects.get(codename='can_vet_commentary_requests')
+        can_vet_thesislink_requests = Permission.objects.get(codename='can_vet_thesislink_requests')
+        can_vet_authorship_claims = Permission.objects.get(codename='can_vet_authorship_claims')
+        can_vet_comments = Permission.objects.get(codename='can_vet_comments')
+        # Submission handling
+        can_process_incoming_submissions = Permission.objects.get(codename='can_process_incoming_submissions')
+        can_vet_submitted_reports = Permission.objects.get(codename='can_vet_submitted_reports')
+        SciPostAdmin.permissions.add(can_manage_registration_invitations,
+                                     can_vet_registration_requests,
+                                     can_vet_commentary_requests, can_vet_thesislink_requests,
+                                     can_vet_authorship_claims, can_vet_comments,
+                                     )
+        VettingEditors.permissions.add(can_vet_commentary_requests, can_vet_thesislink_requests,
+                                       can_vet_authorship_claims, can_vet_comments,
+                                       )
+        self.stdout.write(self.style.SUCCESS('Successfully created groups and permissions'))
diff --git a/scipost/models.py b/scipost/models.py
index 724e626e5..182ed707d 100644
--- a/scipost/models.py
+++ b/scipost/models.py
@@ -100,22 +100,11 @@ class Contributor(models.Model):
 
 
 
+
 ##################
-#### Groups ######
+## Invitations ###
 ##################
 
-SciPostAdmin, created = Group.objects.get_or_create(name='SciPost Administrators')
-
-AdvisoryBoard, created = Group.objects.get_or_create(name='Advisory Board')
-
-EditorialCollege, created = Group.objects.get_or_create(name='Editorial College')
-
-VettingEditors, created = Group.objects.get_or_create(name='Vetting Editors')
-
-RegisteredContributors, created = Group.objects.get_or_create(name='Registered Contributors')
-
-
-
 INVITATION_TYPE = (
     ('F', 'Editorial Fellow'),
     ('C', 'Contributor'),
diff --git a/scipost/utils.py b/scipost/utils.py
index 5e6fd5f46..2bb549723 100644
--- a/scipost/utils.py
+++ b/scipost/utils.py
@@ -124,28 +124,28 @@ class Utils(object):
         email_text +=  ',\n\n'
         if cls.invitation.personal_message is not None:
             email_text += cls.invitation.personal_message + '\n\n'
-        email_text += ('You will have noticed that the world of scientific publishing is currently undergoing many changes, but you will ll perhaps agree that it is not completely clear that the best interests of science and scientists are being served. In recent times, and after much thinking of how best to address this issue, I have decided to forge ahead and implement a new online publication portal by and for scientists.\n\nThe initiative, called SciPost, can in a sense be viewed as an extra layer on arXiv.org. To summarize, SciPost will be a complete scientific publication platform, run by and for professional scientists, providing:\n\n' +
-                       '- a means to comment on all existing literature\n\n' +
-                       '- a repository of links to theses (Habilitation, PhD, Master’s)\n\n' +
-                       '- most importantly, a collection of community-run two-way open access (no subscription fees, no author fees) journals with extremely stringent (peer-witnessed) refereeing. The main innovations are thus a redesigned, more accountable refereeing process (addressing some of the weaknesses identified in current habits), together with a new concept for the editorial process, based on our Editorial College, designed to minimize the burden of the editorial workflow while ensuring the highest achievable quality.\n\n')
+        email_text += ("You will have noticed that the world of scientific publishing is currently undergoing many changes, but you will ll perhaps agree that it is not completely clear that the best interests of science and scientists are being served. In recent times, and after much thinking of how best to address this issue, I have decided to forge ahead and implement a new online publication portal by and for scientists.\n\nThe initiative, called SciPost, can in a sense be viewed as an extra layer on arXiv.org. To summarize, SciPost will be a complete scientific publication platform, run by and for professional scientists, providing:\n\n" +
+                       "- a means to comment on all existing literature\n\n" +
+                       "- a repository of links to theses (Habilitation, PhD, Master’s)\n\n" +
+                       "- most importantly, a collection of community-run two-way open access (no subscription fees, no author fees) journals with extremely stringent (peer-witnessed) refereeing. The main innovations are thus a redesigned, more accountable refereeing process (addressing some of the weaknesses identified in current habits), together with a new concept for the editorial process, based on our Editorial College, designed to minimize the burden of the editorial workflow while ensuring the highest achievable quality.\n\n")
         if cls.invitation.invitation_type == 'F':
-            email_text += ('The portal has been intensively developed over the last few months. It is legally based on a not-for-profit Foundation and will perpetually operate as a non-commercial entity at the service of the academic sector. We are now entering the next phase in the implementation, which is to build up the community of professional academics who will help operate it.\n\n' +
-                           'To go straight to the point, on behalf of the Foundation, I hereby have the honour to invite you to become an Editorial Fellow and thus join the Editorial College of SciPost Physics.\n\n' +
-                           'Please note that only well-known and respected senior academics are being contacted. Academic reputation is the most important criterion guiding our considerations of who should belong to the Editorial College.\n\n' +
-                           'To help you in considering this, it’s perhaps best if you take the time to take a look at the website itself. At the moment, registration is by invitation only, and the site is temporarily stripped of content for non-registered users. You can personally register by visiting the following single-use link within the next 2 weeks: \n\n' + 
+            email_text += ("The portal has been intensively developed over the last few months. It is legally based on a not-for-profit Foundation and will perpetually operate as a non-commercial entity at the service of the academic sector. We are now entering the next phase in the implementation, which is to build up the community of professional academics who will help operate it.\n\n" +
+                           "To go straight to the point, on behalf of the Foundation, I hereby have the honour to invite you to become an Editorial Fellow and thus join the Editorial College of SciPost Physics.\n\n" +
+                           "Please note that only well-known and respected senior academics are being contacted. Academic reputation is the most important criterion guiding our considerations of who should belong to the Editorial College.\n\n" +
+                           "To help you in considering this, it’s perhaps best if you take the time to take a look at the website itself. At the moment, registration is by invitation only, and the site is temporarily stripped of content for non-registered users. You can personally register by visiting the following single-use link within the next 2 weeks: \n\n" + 
                            'https://scipost.org/invitation/' + cls.invitation.invitation_key + '\n\n' +
-                           'I will then activate your account, allowing you to directly see all the contents. Many details about the initiative can be found at scipost.org/about and at scipost.org/FAQ.\n\n' +
-                           'Since this initiative has no chance of success without the involvement of the people it’s meant to serve, we’d be very grateful if you gave due consideration to this offer. To make things clear, we would expect you to commit only 2-4 hours per month to help perform Editorial duties. The number of Editorial Fellows will be adapted in order to keep things this way. You could try it out for 6 months or a year and of course quit anytime if you felt that things weren’t to your taste. If you do develop sympathy for the initiative, we’d be even more grateful if you considered submitting a publication to one of the journals within the near future, in order to help establish their reputation.\n\n' +
-                           'I’ll be happy to provide you with more detail if you require. In view of our development plans, could I possibly ask you to react (by replying to this email) within the next two or three weeks if possible? I’ll be looking forward to your reaction, your comments and suggestions, be they positive or negative. If you need more time to consider, that’s also fine, please let me know.\n\n')
+                           "I will then activate your account, allowing you to directly see all the contents. Many details about the initiative can be found at scipost.org/about and at scipost.org/FAQ.\n\n" +
+                           "Since this initiative has no chance of success without the involvement of the people it’s meant to serve, we’d be very grateful if you gave due consideration to this offer. To make things clear, we would expect you to commit only 2-4 hours per month to help perform Editorial duties. The number of Editorial Fellows will be adapted in order to keep things this way. You could try it out for 6 months or a year and of course quit anytime if you felt that things weren’t to your taste. If you do develop sympathy for the initiative, we’d be even more grateful if you considered submitting a publication to one of the journals within the near future, in order to help establish their reputation.\n\n" +
+                           "I’ll be happy to provide you with more detail if you require. In view of our development plans, could I possibly ask you to react (by replying to this email) within the next two or three weeks if possible? I’ll be looking forward to your reaction, your comments and suggestions, be they positive or negative. If you need more time to consider, that’s also fine, please let me know.\n\n")
         elif cls.invitation.invitation_type == 'C':
-            email_text += ('The portal has been intensively developed over the last few months. It is legally based on a not-for-profit Foundation and will perpetually operate as a non-commercial entity at the service of the academic sector. We are now entering the next phase in the implementation, which is to build up the community of professional academics who will hopefully make use of the portal in their daily activities.\n\n' +
-                           'It’s perhaps best if you take the time to take a look at the website itself. At the moment, registration is by invitation only, and the site is temporarily stripped of content for non-registered users. You can personally register by visiting the following single-use link within the next 2 weeks: \n\n' +
+            email_text += ("The portal has been intensively developed over the last few months. It is legally based on a not-for-profit Foundation and will perpetually operate as a non-commercial entity at the service of the academic sector. We are now entering the next phase in the implementation, which is to build up the community of professional academics who will hopefully make use of the portal in their daily activities.\n\n" +
+                           "It’s perhaps best if you take the time to take a look at the website itself. At the moment, registration is by invitation only, and the site is temporarily stripped of content for non-registered users. You can personally register by visiting the following single-use link within the next 2 weeks: \n\n" +
                            'https://scipost.org/invitation/' + cls.invitation.invitation_key + '\n\n' +
-                           'I will then activate your account, allowing you to directly see all the contents. Many details about the initiative can be found at scipost.org/about and at scipost.org/FAQ.\n\n' +
-                           'If you do develop sympathy for the initiative, besides participating in the online platform, we’d be very grateful if you considered submitting a publication to one of the journals within the near future, in order to help establish their reputation. I’ll also be looking forward to your reaction, your comments and suggestions, be they positive or negative.\n\n')
+                           "I will then activate your account, allowing you to directly see all the contents. Many details about the initiative can be found at scipost.org/about and at scipost.org/FAQ.\n\n" +
+                           "If you do develop sympathy for the initiative, besides participating in the online platform, we’d be very grateful if you considered submitting a publication to one of the journals within the near future, in order to help establish their reputation. I’ll also be looking forward to your reaction, your comments and suggestions, be they positive or negative.\n\n")
 
-        email_text += ('On behalf of the SciPost Foundation,\n\n' +
-                       'Prof. dr Jean-Sébastien Caux\n---------------------------------------------\nInstitute for Theoretial Physics\nUniversity of Amsterdam\nScience Park 904\n1098 XH Amsterdam\nThe Netherlands\n---------------------------------------------\ntel.: +31(0)20 5255775\nfax: +31 (0)20 5255778\n---------------------------------------------')
+        email_text += ("On behalf of the SciPost Foundation,\n\n" +
+                       "Prof. dr Jean-Sébastien Caux\n---------------------------------------------\nInstitute for Theoretial Physics\nUniversity of Amsterdam\nScience Park 904\n1098 XH Amsterdam\nThe Netherlands\n---------------------------------------------\ntel.: +31(0)20 5255775\nfax: +31 (0)20 5255778\n---------------------------------------------")
 
         emailmessage = EmailMessage(
             'SciPost registration invitation', email_text, 'jscaux@scipost.org',
diff --git a/scipost/views.py b/scipost/views.py
index cbf207c1e..505ceebd6 100644
--- a/scipost/views.py
+++ b/scipost/views.py
@@ -34,32 +34,6 @@ from theses.models import ThesisLink
 from theses.forms import ThesisLinkSearchForm
 
 
-################################
-# Assign permissions to groups #
-################################
-
-# Registration
-can_manage_registration_invitations = Permission.objects.get(codename='can_manage_registration_invitations')
-can_vet_registration_requests = Permission.objects.get(codename='can_vet_registration_requests')
-# Vetting of simple objects
-can_vet_commentary_requests = Permission.objects.get(codename='can_vet_commentary_requests')
-can_vet_thesislink_requests = Permission.objects.get(codename='can_vet_thesislink_requests')
-can_vet_authorship_claims = Permission.objects.get(codename='can_vet_authorship_claims')
-can_vet_comments = Permission.objects.get(codename='can_vet_comments')
-# Submission handling
-can_process_incoming_submissions = Permission.objects.get(codename='can_process_incoming_submissions')
-can_vet_submitted_reports = Permission.objects.get(codename='can_vet_submitted_reports')
-
-SciPostAdmin.permissions.add(can_manage_registration_invitations,
-                             can_vet_registration_requests,
-                             can_vet_commentary_requests, can_vet_thesislink_requests, 
-                             can_vet_authorship_claims, can_vet_comments,
-                             )
-VettingEditors.permissions.add(can_vet_commentary_requests, can_vet_thesislink_requests, 
-                               can_vet_authorship_claims, can_vet_comments,
-                               )
-
-
 ##############
 # Utilitites #
 ##############
diff --git a/static/scipost/SciPost.css b/static/scipost/SciPost.css
index c0eefa280..fc956d5a4 100644
--- a/static/scipost/SciPost.css
+++ b/static/scipost/SciPost.css
@@ -54,6 +54,7 @@ hr.hr12 {
 }
 .commentcategorydisplay {
   display: inline-block;
+  font-size: 10px;
   margin: 2px 2px;
   padding: 1px;
   box-shadow: 1px 1px 3px #888888;
@@ -66,7 +67,7 @@ hr.hr12 {
 }
 .commentcategorydisplay li {
   display: inline-block;
-  margin: 0px;
+  margin: 2px;
   padding: 4px 8px;
   background-color: #dddddd;
   font-size: 90%;
@@ -74,94 +75,11 @@ hr.hr12 {
 
 .commentid {
   display: inline-block;
-  box-shadow: 5px 5px 10px #888888;
-  background: linear-gradient(to right,#f8f8f8, #e0e0e0);
+/*  box-shadow: 1px 1px 3px #888888;*/
+/*  background: linear-gradient(to right,#f8f8f8, #e0e0e0);*/
+  font-size: 10px;
 }
 
-.ratings {
-  margin: 4px 4px;
-  padding: 1px;
-  display: inline-block;
-  box-shadow: 1px 1px 3px #888888;
-  background: linear-gradient(to right,#fcfcfc, #f0f0f0);
-}
-.ratings h4 {
-  display: inline-block;
-}
-.ratings ul {
-  display: inline-block;
-}
-.ratings li {
-  display: inline-block;
-  margin: 2px;
-  padding: 4px 8px;
-  color: #ffffff;
-  background-color: #204080;
-  font-size: 80%;
-}
-
-.ratingsinput {
-  margin: 1px;
-  padding: 4px;
-  display: inline-block;
-}
-.ratingsinput h4, .ratingsinput form {
-  display: inline-block;
-}
-.ratingsinput ul {
-  display: inline-block;
-  background-color: #204080;
-  color: #ffffff;
-  padding: 2px;
-  box-shadow: 1px 1px 3px #888888;
-}
-.ratingsinput ul li {
-  display: inline-block;
-  margin: 0px;
-  padding: 0px 4px;
-}
-.ratingsinput label {
-  color: #ffffff;
-  font-size: 80%;
-}
-.ratingsinput input {
-  margin: 0px;
-}
-.ratingsinput select {
-  margin: 0px;
-  padding: 0px;
-  height: 6px;
-}
-
-.ratingsform {
-  margin: 1px;
-  padding: 4px;
-  display: inline-block;
-  background-color: #204080;
-}
-.ratingsform ul {
-  display: inline-block;
-  color: #ffffff;
-  padding: 2px;
-  box-shadow: 1px 1px 3px #888888;
-}
-.ratingsform ul li {
-  display: inline-block;
-  margin: 0px;
-  padding: 0px 4px;
-}
-.ratingsform label {
-  color: #ffffff;
-  font-size: 80%;
-}
-.ratingsform input {
-  margin: 0px;
-}
-.ratingsform select {
-  margin: 0px;
-  padding: 0px;
-  height: 6px;
-}
 
 .reportid {
   display: inline-block;
@@ -203,6 +121,13 @@ hr.hr12 {
   align-self: center;
   margin-left: auto;
 }
+.flex-commentbox {
+/*  background-color: #f4f4f4; */
+  margin: 0px;
+  padding: 0px;
+  box-shadow: 1px 1px 3px #888888;
+  background: linear-gradient(to right,#f8f8f8, #e0e0e0);
+}
 .flex-greybox {
   background-color: #f4f4f4; 
   margin: 10px;
@@ -243,7 +168,10 @@ hr.hr12 {
   padding: 3px 5px;
   background-color: #f4f4f4;
   border-radius: 4px;
-  border: 1px solid orange;
+}
+
+.tableofInvitees td {
+  padding: 0px 4px;
 }
 
 body {
@@ -317,9 +245,12 @@ nav {
   padding:0px;
   float:center;
   clear:both;
-  font-size: 16px;
+  font-size: 14px;
   font-weight: 500;
 }
+nav #loggedinas {
+  font-size: 12px;
+}
 nav ul {
   margin: 0;
   padding: 5px;
@@ -439,60 +370,64 @@ section ul li {
   padding: 2px;
 }
 
-section ul.ratingsdata {
-  display: inline-block;
-  padding: 2px;
-  margin: 2px;
-  background-color: #204080;
-  color: #ffffff;
-  border-radius: 2px;
-  font-size: 90%;
-}
-section ul.ratingsdata li{
-  padding: 2px 2px;
-  color: #ffffff;
-}
-section form.ratingsdata ul {
-  display: inline-block;
-  padding: 2px;
-  margin: 2px;
-  background-color: #204080;
-  color: #ffffff;
-  border-radius: 2px;
-  font-size: 90%;
-}
-section form.ratingsdata ul li {
-  padding: 0px 2px; 
-  color: #ffffff;
-}
-section form.ratingsdata ul li label {
-  color: #ffffff;
-}
-
 .opinionsDisplay {
+  font-family: 'Merriweather Sans';
+  font-size: 10px;
   margin: 0px 4px;
   padding: 1px;
   display: inline-block;
-  box-shadow: 1px 1px 3px #888888;
+  box-shadow: 1px 1px 1px #888888;
   background: linear-gradient(to right,#fcfcfc, #f0f0f0);
-  font-size: 90%;
 }
-.opinionsDisplay form {
+.opinionsDisplay ul {
+  color: #ffffff;
   display: inline-block;
+  font-family: 'Merriweather Sans';
+  margin: 0px;
+  padding: 2px 1px;
 }
-.opinionsDisplay ul {
+.opinionsDisplay_old ul {
   border-radius: 2px;
   color: #ffffff;
   display: inline-block;
   margin: 0px;
-  padding: 2px;
+  padding: 0px;
+}
+.opinionsDisplay ul li {
+  border: 1px solid black;
+  display: inline-block;
+  font-family: 'Merriweather Sans';
+  font-size: 8px;
+  margin: 1px 2px;
+  padding: 3px 6px;
 }
-.opinionsDisplay li {
+.opinionsDisplay_old ul li {
   display: inline-block;
   background-color: #204080;
   margin: 1px 3px;
   padding: 2px 4px;
 }
+.opinionsDisplay form {
+  display: inline-block;
+  font-family: 'Merriweather Sans';
+  font-size: 8px;
+  margin: 2px;
+}
+.opinionsDisplay form input[type=submit] {
+  color: #ffffff;
+  font-family: 'Merriweather Sans';
+  font-size: 8px;
+}
+.opinionsDisplay form input[type=submit].agree {
+  background-color: #000099;
+}
+.opinionsDisplay form input[type=submit].notsure {
+  background-color: #555555;
+}
+.opinionsDisplay form input[type=submit].disagree {
+  background-color: #990000;
+}
+
 
 article {
   background-color:#eeeeee;
-- 
GitLab