From dd192ab04ef7d5597f48b08eff9515cd89c0eb02 Mon Sep 17 00:00:00 2001 From: "J.-S. Caux" <J.S.Caux@uva.nl> Date: Wed, 3 Feb 2016 20:29:25 +0100 Subject: [PATCH] Improve report, commentary list --- SciPost_v1/settings.py | 4 +- commentaries/models.py | 19 +++++++ .../templates/commentaries/browse.html | 53 ------------------- .../templates/commentaries/commentaries.html | 25 +++++++-- .../commentaries/request_commentary.html | 8 +-- commentaries/urls.py | 1 + commentaries/views.py | 8 +-- scipost/static/scipost/SciPost.css | 5 +- submissions/forms.py | 9 +++- submissions/models.py | 23 +++++++- .../templates/submissions/submissions.html | 2 +- .../templates/submissions/submit_report.html | 25 +++++---- submissions/views.py | 2 + 13 files changed, 101 insertions(+), 83 deletions(-) delete mode 100644 commentaries/templates/commentaries/browse.html diff --git a/SciPost_v1/settings.py b/SciPost_v1/settings.py index 1fecf7eb0..9bbcfbd05 100644 --- a/SciPost_v1/settings.py +++ b/SciPost_v1/settings.py @@ -131,7 +131,9 @@ TIME_ZONE = 'CET' USE_I18N = True -USE_L10N = True +USE_L10N = False +DATE_FORMAT = 'Y-m-d' +DATETIME_FORMAT = 'Y-m-d H:i' USE_TZ = True diff --git a/commentaries/models.py b/commentaries/models.py index 7f8f4e67e..8b3352cd7 100644 --- a/commentaries/models.py +++ b/commentaries/models.py @@ -55,3 +55,22 @@ class Commentary(models.Model): header += '<tr><td>Date: </td><td> </td><td>' + str(self.pub_date) + '</td></tr>' header += '</table>' return header + + def header_as_li (self): +# header = '<li><table><tr><td><a href="{% url \'commentaries:commentary\' ' + str(self.id) + ' %}">' + self.pub_title + '</a></td></tr>' +# header += '<tr><td>by ' + self.author_list + '</td></tr><tr><td> (published ' + str(self.pub_date) + ')</td></tr></table></li>' +# header = '<li><ul><li><a href="{% url \'commentaries:commentary\' ' + str(self.id) + ' %}">' + self.pub_title + '</a></li>' +# header += '<li>by ' + self.author_list + '</li><li> (published ' + str(self.pub_date) + ')</li></ul></li>' +# header = '<li><p><a href="{% url \'commentaries:commentary\' ' + str(self.id) + ' %}">' + self.pub_title + '</a></p>' +# header += '<p>by ' + self.author_list + '</p><p> (published ' + str(self.pub_date) + ')</p></li>' + header = '<li><div class="flex-container">' + header += '<div class="flex-whitebox0"><p><a href="/commentaries/commentary/' + str(self.id) + '">' + self.pub_title + '</a></p>' + header += '<p>by ' + self.author_list + '</p><p> (published ' + str(self.pub_date) + ')</p></div>' + header += '<div class="flex-whitebox0"><p>Latest activity: ' + self.latest_activity.strftime('%Y-%m-%d %H:%M') + '</p></div>' + header += '</div></li>' + #header = '<li>' + #header += '<p><a href="{% url \'commentaries:commentary\' commentary_id=' + str(self.id) + ' %}">' + self.pub_title + '</a></p>' + #header += '<p>by ' + self.author_list + '</p><p> (published ' + str(self.pub_date) + ')</p>' + #header += '<p>Latest activity: ' + str(self.latest_activity) + '</p>' + #header += '</li>' + return header diff --git a/commentaries/templates/commentaries/browse.html b/commentaries/templates/commentaries/browse.html deleted file mode 100644 index e8f5bc20c..000000000 --- a/commentaries/templates/commentaries/browse.html +++ /dev/null @@ -1,53 +0,0 @@ -{% extends 'scipost/base.html' %} - -{% block pagetitle %}: Commentaries{% endblock pagetitle %} - -{% block headsup %} -<script type="text/javascript" async src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"></script> -{% endblock headsup %} - -{% block bodysup %} - -<!-- Temporary strip for online version --> -{% if user.is_authenticated %} - -<section> - <div class="flex-container"> - <div class="flex-greybox320"> - <h1>SciPost Commentaries</h1> - <h3><a href="{% url 'commentaries:howto' %}">SciPost Commentaries how-to</a></h3> - <h3><a href="{% url 'commentaries:request_commentary' %}">Request a new Commentary Page</a></h3> - </div> - <div class="flex-greybox320"> - <h2>Search SciPost Commentaries:</h2> - <form action="{% url 'commentaries:commentaries' %}" method="post"> - {% csrf_token %} - <table> - {{ form.as_table }} - </table> - <input type="submit" name="Submit" /> - </form> - </div> - <div class="flex-greybox320"> - <h2>View SciPost Commentaries</h2> - <ul> - <li>Physics: last <a href="{% url 'commentaries:browse' discipline='physics' nrweeksback=1 %}">week</a> <a href="{% url 'commentaries:browse' discipline='physics' nrweeksback=4 %}">month</a> <a href="{% url 'commentaries:browse' discipline='physics' nrweeksback=52 %}">year</a> </li> - </ul> - </div> - </div> - - {% if commentary_list %} - <br /> - <h3>Commentaries in {{ discipline }} in the last {{ nrweeksback }} weeks:</h3> - <ul> - {% for commentary in commentary_list %} - <li><a href="{% url 'commentaries:commentary' commentary.id %}">{{ commentary.pub_title }}</a> by {{ commentary.author_list }} (published {{ commentary.pub_date }}) </li> - {% endfor %} - </ul> - {% endif %} - -</section> - -{% endif %} <!-- Temporary strip --> - -{% endblock bodysup %} diff --git a/commentaries/templates/commentaries/commentaries.html b/commentaries/templates/commentaries/commentaries.html index e8edc55eb..7a1092752 100644 --- a/commentaries/templates/commentaries/commentaries.html +++ b/commentaries/templates/commentaries/commentaries.html @@ -31,7 +31,7 @@ <div class="flex-greybox320"> <h2>View SciPost Commentaries</h2> <ul> - <li>Physics: last <a href="{% url 'commentaries:browse' discipline='physics' nrweeksback=1 %}">week</a> <a href="{% url 'commentaries:browse' discipline='physics' nrweeksback=4 %}">month</a> <a href="{% url 'commentaries:browse' discipline='physics' nrweeksback=52 %}">year</a> </li> + <li>Physics: last <a href="{% url 'commentaries:browse' discipline='physics' nrweeksback=1 %}">week</a>, <a href="{% url 'commentaries:browse' discipline='physics' nrweeksback=4 %}">month</a> or <a href="{% url 'commentaries:browse' discipline='physics' nrweeksback=52 %}">year</a> </li> </ul> </div> </div> @@ -42,7 +42,14 @@ <h3>Search results:</h3> <ul> {% for commentary in commentary_search_list %} - <li><a href="{% url 'commentaries:commentary' commentary.id %}">{{ commentary.pub_title }}</a> by {{ commentary.author_list }} (published {{ commentary.pub_date }}) </li> + <!-- + <li> + <p><a href="{% url 'commentaries:commentary' commentary.id %}">{{ commentary.pub_title }}</a></p> + <p>by {{ commentary.author_list }}</p> + <p>(published {{ commentary.pub_date }})</p> + </li> + --> + {{ commentary.header_as_li|safe }} {% endfor %} </ul> {% elif form.has_changed %} @@ -57,12 +64,24 @@ <h2>Recently active Commentaries:</h2> <ul> {% for commentary in commentary_recent_list %} - <li><a href="{% url 'commentaries:commentary' commentary.id %}">{{ commentary.pub_title }}</a> by {{ commentary.author_list }} (published {{ commentary.pub_date }}) </li> + {{ commentary.header_as_li|safe }} {% endfor %} </ul> </section> {% endif %} +{% if commentary_browse_list %} +<section> + <hr class="hr12"> + <h2>Commentaries in {{ discipline }} in the last {{ nrweeksback }} weeks:</h2> + <ul> + {% for commentary in commentary_browse_list %} + {{ commentary.header_as_li|safe }} + {% endfor %} + </ul> + {% endif %} +</section> + {% endif %} <!-- Temporary strip --> diff --git a/commentaries/templates/commentaries/request_commentary.html b/commentaries/templates/commentaries/request_commentary.html index 0333aa821..7d8a5c1d9 100644 --- a/commentaries/templates/commentaries/request_commentary.html +++ b/commentaries/templates/commentaries/request_commentary.html @@ -7,16 +7,12 @@ <script> $(document).ready(function(){ - // Looking at the DOM we can see that all the relevant stuff we want to hide/show is packed in a table. Hint: to play around with jquery, go to devtools, and just write your selectors there. $('tbody') will grab the table from the DOM I just mentioned. - - // Hiding all the rows for initial set-up - var allToggableRows = $('tr').slice(1) // Slices off the first element of the array. Read the documentation on this one, its quite useful. Same for .each and .map in upcoming code. + var allToggableRows = $('tr').slice(1) allToggableRows.each(function(index){ - $(this).hide() // this is the object we're handling in the current iteration of the loop. It is wrapped in $(' ... ') to make it an jQuery object, so that we can call a jQuery function on it like .hide() + $(this).hide() }) - // Indices to remove in order to show thing named by variable name var preprint = [3,5] var published = [4] diff --git a/commentaries/urls.py b/commentaries/urls.py index 1129587e8..09adf1c9b 100644 --- a/commentaries/urls.py +++ b/commentaries/urls.py @@ -6,6 +6,7 @@ urlpatterns = [ # Commentaries url(r'^$', views.commentaries, name='commentaries'), url(r'^browse/(?P<discipline>[a-z]+)/(?P<nrweeksback>[0-9]+)/$', views.browse, name='browse'), + #url(r'^(?P<discipline>[a-z]+)/(?P<nrweeksback>[0-9]+)/$', views.browse), url(r'^howto$', views.howto, name='howto'), url(r'^commentary/(?P<commentary_id>[0-9]+)/$', views.commentary_detail, name='commentary'), url(r'^request_commentary$', views.request_commentary, name='request_commentary'), diff --git a/commentaries/views.py b/commentaries/views.py index 73f7d0949..d795bde09 100644 --- a/commentaries/views.py +++ b/commentaries/views.py @@ -147,9 +147,11 @@ def browse(request, discipline, nrweeksback): return HttpResponseRedirect(request, 'commentaries/commentaries.html', context) else: form = CommentarySearchForm() - commentary_list = Commentary.objects.filter(vetted=True, discipline=discipline, latest_activity__gte=timezone.now() + datetime.timedelta(weeks=-int(nrweeksback))) - context = {'form': form, 'discipline': discipline, 'nrweeksback': nrweeksback, 'commentary_list': commentary_list } - return render(request, 'commentaries/browse.html', context) + commentary_browse_list = Commentary.objects.filter(vetted=True, discipline=discipline, latest_activity__gte=timezone.now() + datetime.timedelta(weeks=-int(nrweeksback))) + context = {'form': form, 'discipline': discipline, 'nrweeksback': nrweeksback, 'commentary_browse_list': commentary_browse_list } + #return render(request, 'commentaries/browse.html', context) + #return HttpResponseRedirect(request, 'commentaries/commentaries.html', context) + return render(request, 'commentaries/commentaries.html', context) def commentary_detail(request, commentary_id): diff --git a/scipost/static/scipost/SciPost.css b/scipost/static/scipost/SciPost.css index 07e346186..367ee078d 100644 --- a/scipost/static/scipost/SciPost.css +++ b/scipost/static/scipost/SciPost.css @@ -187,7 +187,10 @@ hr.hr12 { margin: 10px; padding: 10px; } - +.flex-whitebox0 { + margin: 0px; + padding: 0px; +} body { /* font-family: Merriweather, sans-serif; */ diff --git a/submissions/forms.py b/submissions/forms.py index f7463f0bb..4cea397ac 100644 --- a/submissions/forms.py +++ b/submissions/forms.py @@ -58,7 +58,14 @@ REPORT_REFUSAL_CHOICES = ( class ReportForm(forms.ModelForm): class Meta: model = Report - fields = ['qualification', 'strengths', 'weaknesses', 'report', 'requested_changes', 'recommendation'] + fields = ['qualification', 'strengths', 'weaknesses', 'report', 'requested_changes', 'formatting', 'grammar', 'recommendation'] + def __init__(self, *args, **kwargs): + super(ReportForm, self).__init__(*args, **kwargs) + self.fields['strengths'].widget.attrs.update({'placeholder': 'Give a point-by-point (numbered 1-, 2-, ...) list of the paper\'s strengths', 'rows': 10, 'cols': 100}) + self.fields['weaknesses'].widget.attrs.update({'placeholder': 'Give a point-by-point (numbered 1-, 2-, ...) list of the paper\'s weaknesses', 'rows': 10, 'cols': 100}) + self.fields['report'].widget.attrs.update({'placeholder': 'Your general remarks', 'rows': 10, 'cols': 100}) + self.fields['requested_changes'].widget.attrs.update({'placeholder': 'Give a numbered (1-, 2-, ...) list of specifically requested changes', 'cols': 100}) + class VetReportForm(forms.Form): action_option = forms.ChoiceField(widget=forms.RadioSelect, choices=REPORT_ACTION_CHOICES, required=True, label='Action') diff --git a/submissions/models.py b/submissions/models.py index 395362d43..8fa225e48 100644 --- a/submissions/models.py +++ b/submissions/models.py @@ -82,6 +82,25 @@ class Submission(models.Model): # Reports: ########### +REFEREE_QUALIFICATION = ( + (0, 'not qualified'), + (1, 'generally qualified'), + (2, 'knowledgeable in this subject'), + (3, 'very knowledgeable in this subject'), + (4, 'expert in this subject'), + ) +ref_qualif_dict = dict(REFEREE_QUALIFICATION) + +QUALITY_SPEC = ( + (0, 'mediocre'), + (1, 'below threshold'), + (2, 'acceptable'), + (3, 'reasonable'), + (4, 'good'), + (5, 'excellent'), + (6, 'perfect'), + ) + REPORT_REC = ( (1, 'Publish as Tier I (top 10% of papers in this journal)'), (2, 'Publish as Tier II (top 50% of papers in this journal)'), @@ -102,11 +121,13 @@ class Report(models.Model): status = models.SmallIntegerField(default=0) submission = models.ForeignKey(Submission) author = models.ForeignKey(Contributor) - qualification = models.PositiveSmallIntegerField(default=0) + qualification = models.PositiveSmallIntegerField(choices=REFEREE_QUALIFICATION, verbose_name="Qualification to referee this: I am ", blank=True) strengths = models.TextField() weaknesses = models.TextField() report = models.TextField() requested_changes = models.TextField(verbose_name="requested changes") + formatting = models.SmallIntegerField(choices=QUALITY_SPEC, blank=True, default=0, verbose_name="Quality of paper formatting") + grammar = models.SmallIntegerField(choices=QUALITY_SPEC, blank=True, default=0, verbose_name="Quality of English grammar") recommendation = models.SmallIntegerField(choices=REPORT_REC) date_invited = models.DateTimeField('date invited', blank=True, null=True) invited_by = models.ForeignKey(Contributor, blank=True, null=True, related_name='invited_by') diff --git a/submissions/templates/submissions/submissions.html b/submissions/templates/submissions/submissions.html index b1f48f5f9..02e08b444 100644 --- a/submissions/templates/submissions/submissions.html +++ b/submissions/templates/submissions/submissions.html @@ -13,7 +13,7 @@ <div class="flex-container"> <div class="flex-greybox320"> <h1>SciPost Submissions</h1> - <h3><a href="{% url 'submissions:submit_manuscript' %}">Submit an arXiv preprint to a SciPost Journal</a></h3> + <h3><a href="{% url 'submissions:submit_manuscript' %}">Submit a manuscript to SciPost</a></h3> </div> <div class="flex-greybox320"> <h2>Search SciPost Submissions:</h2> diff --git a/submissions/templates/submissions/submit_report.html b/submissions/templates/submissions/submit_report.html index 7deb34a00..ca1cdbf57 100644 --- a/submissions/templates/submissions/submit_report.html +++ b/submissions/templates/submissions/submit_report.html @@ -6,19 +6,15 @@ {% if user.is_authenticated %} <section> - <h1>Submit a Report on a SciPost Submission</h1> -</section> + <div class="flex-greybox"> + <h1>Submit a Report on a SciPost Submission</h1> + </div> -<section> - <h2>Submission summary and link</h2> - <br> - <table> - <tr><td>Title: </td><td>{{ submission.title }}</td></tr> - <tr><td>Author(s): </td><td>{{ submission.author_list }}</td></tr> - <tr><td>arXiv link: </td><td>{{ submission.arxiv_link }}</td></tr> - <tr><td>Date submitted: </td><td>{{ submission.submission_date }}</td></tr> - <tr><td>Submitted to: </td><td>{{ submission.submitted_to_journal }}</td></tr> - </table> + <hr class="hr12"> + <div class="flex-greybox"> + <h2>Submission summary and link</h2> + </div> + {{ submission.header_as_table|safe }} <br /> <h3>Abstract:</h3> <p>{{ submission.abstract }}</p> @@ -26,7 +22,10 @@ </section> <section> - <h1>Your report:</h1> + <hr class="hr12"> + <div class="flex-greybox"> + <h1>Your report:</h1> + </div> <form action="{% url 'submissions:submit_report' submission.id %}" method="post"> {% csrf_token %} <table> diff --git a/submissions/views.py b/submissions/views.py index 72c343ec0..4fa74952d 100644 --- a/submissions/views.py +++ b/submissions/views.py @@ -195,6 +195,8 @@ def submit_report(request, submission_id): weaknesses = form.cleaned_data['weaknesses'], report = form.cleaned_data['report'], requested_changes = form.cleaned_data['requested_changes'], + formatting = form.cleaned_data['formatting'], + grammar = form.cleaned_data['grammar'], recommendation = form.cleaned_data['recommendation'], date_submitted = timezone.now(), ) -- GitLab