From 59c2e036974ff1693ae3f030d7f23b0c39e02a76 Mon Sep 17 00:00:00 2001 From: Jorran de Wit <jorrandewit@outlook.com> Date: Fri, 21 Dec 2018 11:49:30 +0100 Subject: [PATCH] Ready --- scipost/static/scipost/assets/css/_alert.scss | 7 ++- .../static/scipost/assets/css/_tooltip.scss | 4 ++ submissions/refereeing_cycles.py | 23 +++---- .../submission_refereeing_history.html | 2 +- .../submissions/pool/editorial_page.html | 36 ++++++----- .../templates/submissions/select_referee.html | 61 ++++++++++--------- submissions/views.py | 9 +++ 7 files changed, 81 insertions(+), 61 deletions(-) diff --git a/scipost/static/scipost/assets/css/_alert.scss b/scipost/static/scipost/assets/css/_alert.scss index 0e046a8f5..cb7db9256 100644 --- a/scipost/static/scipost/assets/css/_alert.scss +++ b/scipost/static/scipost/assets/css/_alert.scss @@ -1,10 +1,11 @@ .alert { - padding: 0.75rem 2.5rem 0.75rem 1.25rem; + padding: 1.0rem 2.5rem 1.0rem 1.25rem; margin-bottom: 0.5rem; position: relative; clear: both; float: left; - min-width: 20%; + width: 100%; + box-shadow: 0 0 5px 0px #f3f3f3; form &, .form & { @@ -34,7 +35,7 @@ @mixin scipost-alert-variant($background, $border, $color) { background-color: $white; - border-top: 3px solid $color; + border: 1px solid $color; } @each $color, $value in $theme-colors { diff --git a/scipost/static/scipost/assets/css/_tooltip.scss b/scipost/static/scipost/assets/css/_tooltip.scss index 11b5c6cf5..87c7fa9a0 100644 --- a/scipost/static/scipost/assets/css/_tooltip.scss +++ b/scipost/static/scipost/assets/css/_tooltip.scss @@ -15,4 +15,8 @@ margin: 0.25rem 0; box-shadow: none; } + + a { + color: inherit; + } } diff --git a/submissions/refereeing_cycles.py b/submissions/refereeing_cycles.py index ea310ad15..a29f2e9a1 100644 --- a/submissions/refereeing_cycles.py +++ b/submissions/refereeing_cycles.py @@ -13,7 +13,8 @@ from . import constants @html_safe class RequiredActionsDict(dict): - """A collection of required actions. + """ + A collection of required actions. The required action, meant for the editors-in-charge know how to display itself in various formats. Dictionary keys are the action-codes, the values are the texts @@ -62,14 +63,11 @@ class BaseAction: submission = None def __init__(self, object=None, **kwargs): - self._objects = [] - self.add(object) - - self.id = object.__class__.__name__ if object else self.__class__.__name__ + self._objects = [object] if object else [] + self.id = '%s.%i' % (object.__class__.__name__, object.id) if object else self.__class__.__name__ - def add(self, object=None): - if object: - self._objects.append(object) + def __repr__(self): + return '<%s: %s>' % (self.__class__.__name__, self.id) def _format_text(self, text, obj=None): if obj is None and self._objects: @@ -81,6 +79,7 @@ class BaseAction: if hasattr(obj, 'date_invited'): timedelta = timezone.now() - obj.date_invited if hasattr(obj, 'submission'): + print deadline = obj.submission.reporting_deadline - timezone.now() return text.format( @@ -100,7 +99,7 @@ class BaseAction: def __iter__(self): if self._objects: for obj in self._objects: - yield format_html(self._format_text(self.txt)) + yield format_html(self._format_text(self.txt, obj=obj)) else: yield format_html(self._format_text(self.txt)) @@ -220,10 +219,8 @@ class BaseCycle: def add_action(self, action): if action not in self.required_actions: - self._required_actions[action] = action - else: - self._required_actions[action].add(action) - self._required_actions[action].submission = self._submission + self.required_actions[action] = action + self.required_actions[action].submission = self._submission def update_required_actions(self): """Gather the required actions list and populate self._required_actions.""" diff --git a/submissions/templates/partials/submissions/submission_refereeing_history.html b/submissions/templates/partials/submissions/submission_refereeing_history.html index 236903d49..3c00e2a51 100644 --- a/submissions/templates/partials/submissions/submission_refereeing_history.html +++ b/submissions/templates/partials/submissions/submission_refereeing_history.html @@ -15,6 +15,6 @@ {% include 'partials/comments/comments_list.html' with comments=sibling.comments.vetted css_class='my-2 pl-4' target_blank=target_blank %} {% empty %} - <h5 class="mt-4">There are no publicly visible links available yet.</h5> + <em>There are no publicly visible links available yet.</em> {% endfor %} </div> diff --git a/submissions/templates/submissions/pool/editorial_page.html b/submissions/templates/submissions/pool/editorial_page.html index 4a24c7fcb..dec98e861 100644 --- a/submissions/templates/submissions/pool/editorial_page.html +++ b/submissions/templates/submissions/pool/editorial_page.html @@ -200,8 +200,10 @@ <i class="fa fa-times-circle text-danger" aria-hidden="true"></i> <span class="text-muted"> Refereeing closed. - <br> - <em>Invited referees may still submit a Report, as long as their invitation is not finished nor cancelled.</em> + {% if submission.referee_invitations.exists %} + <br> + <em>Invited referees may still submit a Report, as long as their invitation is not finished nor cancelled.</em> + {% endif %} </span> {% endif %} {% if submission.in_refereeing_phase %} @@ -329,20 +331,22 @@ <a href="{% url 'submissions:extend_refereeing_deadline' identifier_w_vn_nr=submission.preprint.identifier_w_vn_nr days=14 %}">2 weeks</a> </li> {% endif %} - <li> - Set refereeing deadline: - <form class="form-inline d-inline-block" action="{% url 'submissions:set_refereeing_deadline' identifier_w_vn_nr=submission.preprint.identifier_w_vn_nr %}" method="post"> - {% csrf_token %} - <div class="d-inline-block mx-2"> - {% for field in set_deadline_form.visible_fields %} - {{ field|add_css_class:'form-control' }} - {{ field }} - {% endfor %} - </div> - - <input class="btn btn-outline-secondary btn-sm" type="submit" value="Set deadline"/> - </form> - </li> + {% if submission.can_reset_reporting_deadline %} + <li> + Set refereeing deadline: + <form class="form-inline d-inline-block" action="{% url 'submissions:set_refereeing_deadline' identifier_w_vn_nr=submission.preprint.identifier_w_vn_nr %}" method="post"> + {% csrf_token %} + <div class="d-inline-block mx-2"> + {% for field in set_deadline_form.visible_fields %} + {{ field|add_css_class:'form-control' }} + {{ field }} + {% endfor %} + </div> + + <input class="btn btn-outline-secondary btn-sm" type="submit" value="Set deadline"/> + </form> + </li> + {% endif %} {% if submission.is_open_for_reporting %} <li><a href="{% url 'submissions:close_refereeing_round' identifier_w_vn_nr=submission.preprint.identifier_w_vn_nr %}">Close the refereeing round</a> (deactivates submission of new Reports and Comments)</li> diff --git a/submissions/templates/submissions/select_referee.html b/submissions/templates/submissions/select_referee.html index efbfefd86..edfffc089 100644 --- a/submissions/templates/submissions/select_referee.html +++ b/submissions/templates/submissions/select_referee.html @@ -73,52 +73,57 @@ <div class="row"> <div class="col-12"> {% if workdays_left_to_report < 15 %} - <div class="border border-danger bg-light p-2 mb-4"> + <div class="my-5 p-3 border border-danger" style="border-width: 2px !important;"> + <i class="fa fa-exclamation-triangle text-warning"></i> <strong class="text-danger"> Warning: there are {{ workdays_left_to_report }} working days left before the refereeing deadline. </strong> - <div class="text-muted my-2">Standard refereeing period for {{ submission.submitted_to }}: <strong>{{ submission.submitted_to.refereeing_period.days }} days</strong>.</div> + <div class="my-2">Standard refereeing period for {{ submission.submitted_to }}: <strong>{{ submission.submitted_to.refereeing_period.days }} days</strong>.</div> Consider resetting the refereeing deadline at the <a href="{% url 'submissions:editorial_page' identifier_w_vn_nr=submission.preprint.identifier_w_vn_nr %}">Editorial Page</a> before inviting a referee. </div> {% endif %} {% if profiles_found %} - <h3>Matching people in our database:</h3> - <table class="table"> - <tr> - <th>Name</th> - <th>Registered<br/>Contributor?</th> - <th>Email<br/>known?</th> - <th>Action<br/><span class="text-muted"><small>(Unregistered people will also automatically receive a registration invitation)</small></span></th> - </tr> - {% for profile in profiles_found %} + <h3 class="mt-4">Matching people in our database:</h3> + <table class="table table-light table-hover v-center"> + <thead class="thead-light"> <tr> - <td>{{ profile }}</td> - <td>{% if profile.contributor %}<i class="fa fa-check-circle text-success"></i>{% else %}<i class="fa fa-times-circle text-danger"></i>{% endif %}</td> - <td>{% if profile.email %}<i class="fa fa-check-circle text-success"></i>{% else %}<i class="fa fa-times-circle text-danger"></i>{% endif %}</td> - <td>{% if profile.email %}Send refereeing invitation <a href="{% url 'submissions:invite_referee' identifier_w_vn_nr=submission.preprint.identifier_w_vn_nr profile_id=profile.id auto_reminders_allowed=1 %}">with</a> or <a href="{% url 'submissions:invite_referee' identifier_w_vn_nr=submission.preprint.identifier_w_vn_nr profile_id=profile.id auto_reminders_allowed=0 %}">without</a> auto-reminders {% include 'partials/submissions/refinv_auto_reminders_tooltip.html' %}{% else %}<span class="text-danger">Cannot send an invitation without an email</span> <i class="fa fa-arrow-right"></i> Add one: - <form class="form-inline" action="{% url 'profiles:add_profile_email' profile_id=profile.id %}" method="post"> - {% csrf_token %} - {{ profile_email_form|bootstrap }} - <input type="hidden" name="next" value="{{ request.get_full_path }}"> - <input class="btn btn-outline-secondary" type="submit" value="Add"> - </form> - {% endif %} - </td> + <th>Name<br/><br/></th> + <th>Registered Contributor?<br/><br/></th> + <th>Email known?<br/><br/></th> + <th>Action<br/><span class="text-muted font-weight-normal">(Unregistered people will also automatically receive a registration invitation)</span></th> </tr> - {% empty %} + </thead> + <tbody> + {% for profile in profiles_found %} + <tr> + <td>{{ profile }}</td> + <td>{% if profile.contributor %}<i class="fa fa-check-circle text-success"></i>{% else %}<i class="fa fa-times-circle text-danger"></i>{% endif %}</td> + <td>{% if profile.email %}<i class="fa fa-check-circle text-success"></i>{% else %}<i class="fa fa-times-circle text-danger"></i>{% endif %}</td> + <td>{% if profile.email %}Send refereeing invitation <a href="{% url 'submissions:invite_referee' identifier_w_vn_nr=submission.preprint.identifier_w_vn_nr profile_id=profile.id auto_reminders_allowed=1 %}">with</a> or <a href="{% url 'submissions:invite_referee' identifier_w_vn_nr=submission.preprint.identifier_w_vn_nr profile_id=profile.id auto_reminders_allowed=0 %}">without</a> auto-reminders {% include 'partials/submissions/refinv_auto_reminders_tooltip.html' %}{% else %}<span class="text-danger">Cannot send an invitation without an email</span> <i class="fa fa-arrow-right"></i> Add one: + <form class="form-inline" action="{% url 'profiles:add_profile_email' profile_id=profile.id %}" method="post"> + {% csrf_token %} + {{ profile_email_form|bootstrap }} + <input type="hidden" name="next" value="{{ request.get_full_path }}"> + <input class="btn btn-outline-secondary" type="submit" value="Add"> + </form> + {% endif %} + </td> + </tr> + {% empty %} <tr> - <td>No Profiles found</td> - <td></td> + <td>No Profiles found</td> + <td></td> </tr> - {% endfor %} + {% endfor %} + </tbody> </table> {% endif %} {% if profile_form %} - <h3 class="mb-2">Not found? Then add to our database by filling this form:</h3> + <h3 class="mb-3 mt-5">Not found? Then add to our database by filling this form:</h3> <form action="{% url 'submissions:add_referee_profile' identifier_w_vn_nr=submission.preprint.identifier_w_vn_nr %}" method="post"> {% csrf_token %} {{ profile_form|bootstrap }} diff --git a/submissions/views.py b/submissions/views.py index 256949f22..1d7f257cc 100644 --- a/submissions/views.py +++ b/submissions/views.py @@ -923,6 +923,15 @@ def select_referee(request, identifier_w_vn_nr): """ submission = get_object_or_404(Submission.objects.filter_for_eic(request.user), preprint__identifier_w_vn_nr=identifier_w_vn_nr) + + if not submission.is_open_for_reporting: + txt = ( + 'The refereeing deadline has passed. You cannot invite a referee anymore.' + ' Please, first extend the deadline of the refereeing to invite a referee.') + messages.error(request, txt) + return redirect( + reverse('submissions:editorial_page', args=(submission.preprint.identifier_w_vn_nr,))) + context = {} queryresults = '' form = RefereeSearchForm(request.GET or None) -- GitLab