From ad8756170f6676c1289910c8722406c2972d2a88 Mon Sep 17 00:00:00 2001 From: George Katsikas <giorgakis.katsikas@gmail.com> Date: Wed, 21 Feb 2024 17:00:51 +0100 Subject: [PATCH] refactor refereeing invitations into partials add complete table of profile emails in refereeing invitations --- .../submissions/_hx_select_referee_table.html | 37 ++++++ .../_hx_select_referee_table_row.html | 107 ++++++++++++++++++ .../_refinv_auto_reminders_tooltip.html | 4 +- .../templates/submissions/select_referee.html | 88 +++----------- 4 files changed, 162 insertions(+), 74 deletions(-) create mode 100644 scipost_django/submissions/templates/submissions/_hx_select_referee_table.html create mode 100644 scipost_django/submissions/templates/submissions/_hx_select_referee_table_row.html diff --git a/scipost_django/submissions/templates/submissions/_hx_select_referee_table.html b/scipost_django/submissions/templates/submissions/_hx_select_referee_table.html new file mode 100644 index 000000000..a662ed68e --- /dev/null +++ b/scipost_django/submissions/templates/submissions/_hx_select_referee_table.html @@ -0,0 +1,37 @@ +<table class="table align-center"> + <thead class="table-light align-top"> + <tr> + <th> + Name + <br /> + <small class="text-muted">Click to add emails etc.</small> + </th> + <th>Registered</th> + <th> + Emails + <br /> + <small class="text-muted">Primary, Valid, Verified, Address</small> + </th> + <th> + Accepts + <br /> + requests? + </th> + <th>Action</th> + </tr> + </thead> + <tbody> + + {% for profile in profiles_found %} + {% include "submissions/_hx_select_referee_table_row.html" %} + {% empty %} + <tr> + + <td>No Profiles found</td> + + <td></td> + </tr> + {% endfor %} + + </tbody> +</table> diff --git a/scipost_django/submissions/templates/submissions/_hx_select_referee_table_row.html b/scipost_django/submissions/templates/submissions/_hx_select_referee_table_row.html new file mode 100644 index 000000000..c43e60eda --- /dev/null +++ b/scipost_django/submissions/templates/submissions/_hx_select_referee_table_row.html @@ -0,0 +1,107 @@ +<tr> + <td> + <a href="{{ profile.get_absolute_url }}">{{ profile }}</a> + </td> + <td> + + {% if profile.contributor %} + <span class="text-success">{% include "bi/check-circle-fill.html" %}</span> + {% else %} + <span class="text-danger">{% include "bi/x-circle-fill.html" %}</span> + {% endif %} + + </td> + <td> + + {% comment %} {% if profile.email %} + <span class="text-success">{% include "bi/check-circle-fill.html" %}</span> <span class="text-muted">{{ profile.email }}</span> + {% else %} + <span class="text-danger">{% include "bi/x-circle-fill.html" %}</span> + {% endif %} {% endcomment %} + + {% if profile.email %} + <table> + + {% for email in profile.emails.all %} + <tr> + <td> + + {% if email.primary %} + <span class="text-primary" title="Primary">{% include "bi/check-circle-fill.html" %}</span> + {% endif %} + + </td> + <td> + + {% if email.still_valid %} + <span class="text-success" title="Valid">{% include "bi/check-circle-fill.html" %}</span> + {% else %} + <span class="text-danger" title="Deprecated">{% include "bi/x-circle-fill.html" %}</span> + {% endif %} + + </td> + <td> + + {% if email.verified %} + <span class="text-success" title="Verified">{% include "bi/check-circle-fill.html" %}</span> + {% else %} + <span class="text-warning" title="Unverified">{% include "bi/question-circle-fill.html" %}</span> + {% endif %} + + </td> + + <td>{{ email.email }}</td> + {% endfor %} + + </table> + {% endif %} + + </td> + <td> + + {% if profile.accepts_refereeing_requests %} + <span class="text-success">{% include "bi/check-circle-fill.html" %}</span> + {% else %} + <span class="text-danger">{% include "bi/x-circle-fill.html" %}</span> + {% endif %} + + </td> + <td> + + {% if profile.accepts_refereeing_requests %} + + {% 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 "submissions/_refinv_auto_reminders_tooltip.html" %} + {% else %} + <span class="text-danger">Cannot send an invitation without an email.</span> + <a href="{{ profile.get_absolute_url }}">Add one here!</a> + {% endif %} + + {% else %} + <span class="text-danger">This person does not accept refereeing requests</span> + {% endif %} + + </td> + </tr> + {% with profile.responsiveness_as_referee as stats %} + + {% if stats.sent %} + <tr> + <td colspan="5"> + <em class="ms-4"> + {% include "bi/arrow-return-right.html" %} + + Responsiveness (last 5 years) -- + Sent: {{ stats.sent }}, + Accepted: {{ stats.accepted }}, + Declined: {{ stats.declined }}, + Cancelled: {{ stats.cancelled }}, + Fulfilled: {{ stats.fulfilled }} + </em> + </td> + </tr> + {% endif %} + + {% endwith %} +</tr> diff --git a/scipost_django/submissions/templates/submissions/_refinv_auto_reminders_tooltip.html b/scipost_django/submissions/templates/submissions/_refinv_auto_reminders_tooltip.html index d0c594231..dd53aa57a 100644 --- a/scipost_django/submissions/templates/submissions/_refinv_auto_reminders_tooltip.html +++ b/scipost_django/submissions/templates/submissions/_refinv_auto_reminders_tooltip.html @@ -1,3 +1,5 @@ -<button type="button" class="btn btn-link p-0" data-bs-toggle="tooltip" data-bs-html="true" title="In case of no response to initial invitation, reminders will be sent automatically after 2, then 4 weekdays (with cc to EIC).<br>If there is no response after a week, you (as EIC) will be notified.<br>If accepted, a reminder will be sent to the referee 1 week before deadline."> +<button type="button" class="btn btn-link p-0" data-bs-toggle="tooltip" data-bs-html="true" title="In case of no response to initial invitation, reminders will be sent automatically after 2, then 4 weekdays (with cc to EIC).<br> + If there is no response after a week, you (as EIC) will be notified.<br> + If accepted, a reminder will be sent to the referee 1 week before deadline."> {% include 'bi/info-circle-fill.html' %} </button> diff --git a/scipost_django/submissions/templates/submissions/select_referee.html b/scipost_django/submissions/templates/submissions/select_referee.html index febde94f5..30b292ae9 100644 --- a/scipost_django/submissions/templates/submissions/select_referee.html +++ b/scipost_django/submissions/templates/submissions/select_referee.html @@ -41,6 +41,19 @@ <div class="col-12"> <h2 class="highlight" id="form">Select an additional Referee</h2> + {% if workdays_left_to_report < 15 %} + <div class="mb-3 p-3 border border-danger border-2"> + <span class="text-warning">{% include 'bi/exclamation-triangle-fill.html' %}</span> + <strong class="text-danger"> + Warning: there are {{ workdays_left_to_report }} working days left before the refereeing deadline. + </strong> + + <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 %} + <form action="{% url 'submissions:select_referee' identifier_w_vn_nr=submission.preprint.identifier_w_vn_nr %}" method="get"> {{ referee_search_form|bootstrap }} <input class="btn btn-primary" type="submit" value="Find referee"> @@ -72,81 +85,10 @@ <div class="row"> <div class="col-12"> - {% if workdays_left_to_report < 15 %} - <div class="my-5 p-3 border border-danger" style="border-width: 2px !important;"> - <span class="text-warning">{% include 'bi/exclamation-triangle-fill.html' %}</span> - <strong class="text-danger"> - Warning: there are {{ workdays_left_to_report }} working days left before the refereeing deadline. - </strong> - - <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 class="mt-4">Matching people in our database:</h3> - <table class="table table-light table-hover v-center"> - <thead class="table-light"> - <tr> - <th>Name<br/><br/></th> - <th>Registered<br>Contributor?<br/><br/></th> - <th>Email<br>known?<br/><br/></th> - <th>Accepts<br/>requests?</th> - <th>Action<br/><span class="text-muted fw-normal">(Unregistered people will also automatically receive a registration invitation)</span></th> - </tr> - </thead> - <tbody> - {% for profile in profiles_found %} - <tr> - <td><a href="{{ profile.get_absolute_url }}">{{ profile }}</a></td> - <td>{% if profile.contributor %}<span class="text-success">{% include 'bi/check-circle-fill.html' %}</span>{% else %}<span class="text-danger">{% include 'bi/x-circle-fill.html' %}</span>{% endif %}</td> - <td>{% if profile.email %}<span class="text-success">{% include 'bi/check-circle-fill.html' %}</span> <span class="text-muted">{{ profile.email }}</span>{% else %}<span class="text-danger">{% include 'bi/x-circle-fill.html' %}</span>{% endif %}</td> - <td> - {% if profile.accepts_refereeing_requests %} - <span class="text-success">{% include 'bi/check-circle-fill.html' %}</span>{% else %}<span class="text-danger">{% include 'bi/x-circle-fill.html' %}</span> - {% endif %} - </td> - <td> - {% if profile.accepts_refereeing_requests %} - {% 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 'submissions/_refinv_auto_reminders_tooltip.html' %} - {% else %} - <span class="text-danger">Cannot send an invitation without an email</span> - {% endif %} - {% else %} - <span class="text-danger">This person does not accept refereeing requests</span> - {% endif %} - </td> - </tr> - {% with profile.responsiveness_as_referee as stats %} - {% if stats.sent %} - <tr> - <td colspan="5"> - <em class="ms-4"> - {% include "bi/arrow-return-right.html" %} - Responsiveness (last 5 years) -- - Sent: {{ stats.sent }}, - Accepted: {{ stats.accepted }}, - Declined: {{ stats.declined }}, - Cancelled: {{ stats.cancelled }}, - Fulfilled: {{ stats.fulfilled }} - </em> - </td> - </tr> - {% endif %} - {% endwith %} - {% empty %} - <tr> - <td>No Profiles found</td> - <td></td> - </tr> - {% endfor %} - </tbody> - </table> + <h3 class="mt-4">Matching Profiles in our database:</h3> + {% include "submissions/_hx_select_referee_table.html" %} {% endif %} - - {% if profile_form %} <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"> -- GitLab