diff --git a/submissions/templates/partials/submissions/recommendation_author_content.html b/submissions/templates/partials/submissions/recommendation_author_content.html index 56dd822c2ad5cf135b4c992144deea73eb9fb2ab..5cec245aa0dc650be230bdf0d638af569f43fbb6 100644 --- a/submissions/templates/partials/submissions/recommendation_author_content.html +++ b/submissions/templates/partials/submissions/recommendation_author_content.html @@ -1,5 +1,6 @@ <div class="border px-3 py-2 my-3" id="rec-{{ recommendation.id }}"> - <div {% if not recommendation.active %}style="display: none;"{% endif %} class="mb-4 {% if not recommendation.active %}pt-2{% endif %}"> + + <div class="mb-4 {% if not recommendation.active %}pt-2{% endif %}"> {% if recommendation.is_deprecated %}<h4 class="mb-0"><i class="fa fa-exclamation-circle text-danger"></i> Deprecated</h4>{% endif %} <h2 class="my-2">Editorial Recommendation</h2> {% block recommendation_header %} @@ -30,18 +31,19 @@ <p class="pl-md-3">{{ recommendation.remarks_for_authors|default:'-' }}</p> <h3 class="pb-0">Requested changes</h3> - <p class="pl-md-3">{{recommendation.requested_changes|default:'-'}}</p> + <p class="pl-md-3">{{ recommendation.requested_changes|default:'-' }}</p> - {% block recommendation_before_recommendation %}{% endblock %} + {% block recommendation_remarks_for_editorial_college %}{% endblock %} <h3 class="pb-0">Recommendation</h3> <p class="pl-md-3 mb-0">For Journal <em>{{ recommendation.for_journal }}:</em> <strong>{{ recommendation.get_recommendation_display }}</strong></p> - </div> - {% if not recommendation.active %} - <a href="javascript:;" data-toggle="toggle" data-target="#rec-{{ recommendation.id }} > div" class="d-block my-2">Show/hide Editorial Recommendation {{ recommendation.version }} (status: {{ recommendation.get_status_display }}) →</a> - {% endif %} + {% block recommendation_reformulation %} + {% endblock %} + + {% block recommendation_voting_card %} + {% endblock recommendation_voting_card %} + + </div> - {% block recommendation_footer %} - {% endblock %} </div> diff --git a/submissions/templates/partials/submissions/recommendation_fellow_content.html b/submissions/templates/partials/submissions/recommendation_fellow_content.html index da6e22a2f052d9fec7ccaa41e398fe120c0f2f60..c131816ca7e11458b6708b909d7d33d58d99c817 100644 --- a/submissions/templates/partials/submissions/recommendation_fellow_content.html +++ b/submissions/templates/partials/submissions/recommendation_fellow_content.html @@ -1,16 +1,129 @@ {% extends 'partials/submissions/recommendation_author_content.html' %} +{% load scipost_extras %} + {% block recommendation_header %} <h4 class="text-muted mb-2">By {{ recommendation.submission.editor_in_charge.get_title_display }} {{ recommendation.submission.editor_in_charge.user.first_name }} {{ recommendation.submission.editor_in_charge.user.last_name }}, formulated on {{ recommendation.date_submitted }}</h4> {% endblock %} -{% block recommendation_before_recommendation %} +{% block recommendation_remarks_for_editorial_college %} <h3 class="pb-0">Remarks for Editorial College</h3> <p class="pl-md-3">{{ recommendation.remarks_for_editorial_college|default:'-' }}</p> {% endblock %} -{% block recommendation_footer %} +{% block recommendation_reformulation %} {% if recommendation.may_be_reformulated %} <a href="{% url 'submissions:reformulate_eic_recommendation' recommendation.submission.preprint.identifier_w_vn_nr %}" class="d-block my-2">Reformulate Editorial Recommendation</a> {% endif %} {% endblock %} + +{% block recommendation_voting_card %} + + <div class="card{% if not recommendation.active %} text-secondary{% endif %} mt-2"> + <h2 class="card-header"> + Voting + </h2> + + <div class="card-body"> + + <h3 class="card-title">Fellows eligible to vote:</h3> + <ul> + {% for eligible in recommendation.eligible_to_vote.all|sort_by:'user__last_name' %} + <li>{{ eligible.user.first_name }} {{ eligible.user.last_name }}</li> + {% endfor %} + </ul> + + <h3 class="card-title">Voting results up to now:</h3> + <ul> + <li> + Agreed ({{ recommendation.voted_for.all.count }}): + {% for agreed in recommendation.voted_for.all|sort_by:'user__last_name' %} + {{ agreed.user.last_name }}{% if not forloop.last %},{% endif %} + {% endfor %} + </li> + <li> + Disagreed ({{ recommendation.voted_against.all.count }}): + {% for disagreed in recommendation.voted_against.all|sort_by:'user__last_name' %} + {{ disagreed.user.last_name }}{% if not forloop.last %},{% endif %} + {% endfor %} + </li> + <li> + Abstained ({{ recommendation.voted_abstain.all.count }}): + {% for abstained in recommendation.voted_abstain.all|sort_by:'user__last_name' %} + {{ abstained.user.last_name }}{% if not forloop.last %},{% endif %} + {% endfor %} + </li> + </ul> + + {% if recommendation.submission.tierings.all|length > 0 %} + <h3>Tierings for this Submission, as indicated by voting Fellows who agreed with publication</h3> + <table class="table table-bordered"> + <thead> + <tr> + <th class="py-1">Fellow</th> + <th class="py-1">For Journal</th> + <th class="py-1">Tier</th> + </tr> + </thead> + <tbody> + {% for tiering in recommendation.submission.tierings.all %} + <tr> + <td>{{ tiering.fellow }}</td> + <td>{{ tiering.for_journal }}</td> + <td>{{ tiering.get_tier_display }}</td> + </tr> + {% endfor %} + </tbody> + </table> + {% endif %} + + {% if recommendation.alternativerecommendation_set.all|length > 0 %} + <h3>Alternative recommendations offered during voting by Fellows who disagreed:</h3> + <table class="table table-bordered"> + <thead> + <tr> + <th class="py-1">Fellow</th> + <th class="py-1">For Journal</th> + <th class="py-1">Alternative Recommendation</th> + </tr> + </thead> + <tbody> + {% for altrec in recommendation.alternativerecommendation_set.all %} + <tr> + <td>{{ altrec.fellow }}</td> + <td>{{ altrec.for_journal }}</td> + <td>{{ altrec.get_recommendation_display }}</td> + </tr> + {% endfor %} + </tbody> + </table> + {% endif %} + + <h3 class="card-title">Remarks:</h3> + <ul> + {% for rem in recommendation.remarks.all %} + <li>{% include 'partials/submissions/remark_small.html' with remark=rem %}</li> + {% empty %} + <li><em>No remarks</em></li> + {% endfor %} + </ul> + + </div> + + {% if perms.scipost.can_fix_College_decision %} + {% if recommendation.active %} + <div class="card-footer bg-light py-3"> + <h3 class="card-title mb-3">Administrative actions on recommendations undergoing voting:</h3> + <ul class="mb-1"> + <li class="list-item my-2"><a class="btn btn-secondary" href="{% url 'submissions:remind_Fellows_to_vote' %}" role="button">Send an email reminder to each Fellow with at least one voting duty</a><br>(this is a one-click action, for all Submissions)</li> + <li class="list-item my-2"><a class="btn btn-warning" href="{% url 'submissions:communication' identifier_w_vn_nr=recommendation.submission.preprint.identifier_w_vn_nr comtype='StoE' %}" role="button">Send a communication to the Editor-in-charge</a><br>(for example to request a reformulation of the recommendation)</li> + <li class="list-item my-2"> + <a class="btn btn-primary" href="{% url 'submissions:editorial_decision_create' recommendation.submission.preprint.identifier_w_vn_nr %}" role="button">Initiate the process to fix the editorial decision</a> + </li> + </ul> + </div> + {% endif %} + {% endif %} + </div> + +{% endblock recommendation_voting_card %} diff --git a/submissions/templates/submissions/pool/recommendation.html b/submissions/templates/submissions/pool/recommendation.html index f46e45af2939c6d64cb7f76574eba6caec59ccb2..345dc65610bd7235c579f63baabff7b2b78f3a4a 100644 --- a/submissions/templates/submissions/pool/recommendation.html +++ b/submissions/templates/submissions/pool/recommendation.html @@ -41,183 +41,40 @@ {% include 'partials/submissions/pool/submission_info_table.html' with submission=recommendation.submission %} <br> + {% if recommendation.get_other_versions %} + <div class="card text-white bg-dark"> - <div class="card-header"> - <a class="btn btn-secondary text-white bg-dark" data-toggle="collapse" href="#previousEdRecs" role="button" aria-expanded="false" aria-controls="previousEdRecs">Deprecated versions of Editorial Recommendations for this Submission (click to expand/collapse)</a> - </div> - <div class="collapse" id="previousEdRecs"> - <div class="card-body"> + <h3 class="card-header"> + Deprecated versions of Editorial Recommendations for this Submission + </h3> + + <div class="card-body"> + <div class="accordion" id="previousRecAccordion"> {% for old_rec in recommendation.get_other_versions %} - {% include 'partials/submissions/recommendation_fellow_content.html' with recommendation=old_rec %} - <h3 class="card-title">Fellows eligible to vote:</h3> - <ul> - {% for eligible in old_rec.eligible_to_vote.all|sort_by:'user__last_name' %} - <li>{{ eligible.user.first_name }} {{ eligible.user.last_name }}</li> - {% endfor %} - </ul> - <h3 class="card-title">Voting results:</h3> - <ul> - <li> - Agreed ({{ old_rec.voted_for.all.count }}): - {% for agreed in old_rec.voted_for.all|sort_by:'user__last_name' %} - {{ agreed.user.last_name }}{% if not forloop.last %},{% endif %} - {% endfor %} - </li> - <li> - Disagreed ({{ old_rec.voted_against.all.count }}): - {% for disagreed in old_rec.voted_against.all|sort_by:'user__last_name' %} - {{ disagreed.user.last_name }}{% if not forloop.last %},{% endif %} - {% endfor %} - </li> - <li> - Abstained ({{ old_rec.voted_abstain.all.count }}): - {% for abstained in old_rec.voted_abstain.all|sort_by:'user__last_name' %} - {{ abstained.user.last_name }}{% if not forloop.last %},{% endif %} - {% endfor %} - </li> - </ul> - {% if old_rec.submission.tierings.all|length > 0 %} - <h3>Tierings specified by voting Fellows</h3> - <ul> - {% for tiering in old_rec.submission.tierings.all %} - <li>{{ tiering.fellow }}: for Journal <em>{{ tiering.for_journal }}</em>: {{ tiering.get_tier_display }}</li> - {% endfor %} - </ul> - {% endif %} - {% if old_rec.alternativerecommendation_set.all|length > 0 %} - <h3>Alternative recommendations offered during voting by Fellows who disagreed:</h3> - <ul> - {% for altrec in old_rec.alternativerecommendation_set.all %} - <li>{{ altrec.fellow }}: for Journal <em>{{ altrec.for_journal }}</em>: <strong>{{ altrec.get_recommendation_display }}</strong></li> - {% endfor %} - </ul> - {% endif %} - <h3 class="card-title">Remarks:</h3> - <ul> - {% for rem in old_rec.remarks.all %} - <li>{% include 'partials/submissions/remark_small.html' with remark=rem %}</li> - {% empty %} - <li><em>No remarks</em></li> - {% endfor %} - </ul> + <div class="card{% if not old_rec.active %} text-secondary{% endif %}"> + <div class="card-header" id="recCard{{ old_rec.version }}"> + <h2 class="mb=0"> + <button class="btn btn-warning collapsed" type="button" data-toggle="collapse" data-target="#collapserecCard{{ old_rec.version }}" aria-expanded="false" aria-controls="collapserecCard{{ old_rec.version }}">Show/hide Editorial Recommendation {{ old_rec.version }} (status: {{ old_rec.get_status_display }}) ↓</button> + </h2> + </div> + <div id="collapserecCard{{ old_rec.version }}" class="collapse" aria-labelledby="collapserecCard{{ old_rec.version }}" data-parent="#previousRecAccordion"> + <div class="card-body"> + {% include 'partials/submissions/recommendation_fellow_content.html' with recommendation=old_rec %} + </div> + </div> + </div> {% endfor %} </div> </div> </div> {% endif %} - <h2 class="highlight">Editorial Recommendation (latest)</h2> - {% include 'partials/submissions/recommendation_fellow_content.html' with recommendation=recommendation %} - - <div class="card"> - <div class="card-body"> - - <h3 class="card-title">Fellows eligible to vote:</h3> - <ul> - {% for eligible in recommendation.eligible_to_vote.all|sort_by:'user__last_name' %} - <li>{{ eligible.user.first_name }} {{ eligible.user.last_name }}</li> - {% endfor %} - </ul> - - <h3 class="card-title">Voting results up to now:</h3> - <ul> - <li> - Agreed ({{ recommendation.voted_for.all.count }}): - {% for agreed in recommendation.voted_for.all|sort_by:'user__last_name' %} - {{ agreed.user.last_name }}{% if not forloop.last %},{% endif %} - {% endfor %} - </li> - <li> - Disagreed ({{ recommendation.voted_against.all.count }}): - {% for disagreed in recommendation.voted_against.all|sort_by:'user__last_name' %} - {{ disagreed.user.last_name }}{% if not forloop.last %},{% endif %} - {% endfor %} - </li> - <li> - Abstained ({{ recommendation.voted_abstain.all.count }}): - {% for abstained in recommendation.voted_abstain.all|sort_by:'user__last_name' %} - {{ abstained.user.last_name }}{% if not forloop.last %},{% endif %} - {% endfor %} - </li> - </ul> - {% if recommendation.submission.tierings.all|length > 0 %} - <h3>Tierings for this Submission, as indicated by voting Fellows who agreed with publication</h3> - <table class="table table-bordered"> - <thead> - <tr> - <th class="py-1">Fellow</th> - <th class="py-1">For Journal</th> - <th class="py-1">Tier</th> - </tr> - </thead> - <tbody> - {% for tiering in recommendation.submission.tierings.all %} - <tr> - <td>{{ tiering.fellow }}</td> - <td>{{ tiering.for_journal }}</td> - <td>{{ tiering.get_tier_display }}</td> - </tr> - {% endfor %} - </tbody> - </table> - {% endif %} - {% if recommendation.alternativerecommendation_set.all|length > 0 %} - <h3>Alternative recommendations offered during voting by Fellows who disagreed:</h3> - <table class="table table-bordered"> - <thead> - <tr> - <th class="py-1">Fellow</th> - <th class="py-1">For Journal</th> - <th class="py-1">Alternative Recommendation</th> - </tr> - </thead> - <tbody> - {% for altrec in recommendation.alternativerecommendation_set.all %} - <tr> - <td>{{ altrec.fellow }}</td> - <td>{{ altrec.for_journal }}</td> - <td>{{ altrec.get_recommendation_display }}</td> - </tr> - {% endfor %} - </tbody> - </table> - {% endif %} - - <h3 class="card-title">Remarks:</h3> - <ul> - {% for rem in recommendation.remarks.all %} - <li>{% include 'partials/submissions/remark_small.html' with remark=rem %}</li> - {% empty %} - <li><em>No remarks</em></li> - {% endfor %} - </ul> - - </div> + <h2 class="highlight">Editorial Recommendation (latest)</h2> + {% include 'partials/submissions/recommendation_fellow_content.html' with recommendation=recommendation %} - {% if perms.scipost.can_fix_College_decision %} - <div class="card-footer bg-light py-3"> - <h3 class="card-title mb-3">Administrative actions on recommendations undergoing voting:</h3> - <ul class="mb-1"> - <li class="list-item my-2"><a class="btn btn-secondary" href="{% url 'submissions:remind_Fellows_to_vote' %}" role="button">Send an email reminder to each Fellow with at least one voting duty</a><br>(this is a one-click action, for all Submissions)</li> - <li class="list-item my-2"><a class="btn btn-warning" href="{% url 'submissions:communication' identifier_w_vn_nr=recommendation.submission.preprint.identifier_w_vn_nr comtype='StoE' %}" role="button">Send a communication to the Editor-in-charge</a><br>(for example to request a reformulation of the recommendation)</li> - <li class="list-item my-2"> - <!-- The current Editorial Recommendation is for Journal {{ recommendation.for_journal }}: {{ recommendation.get_recommendation_display }}. - <br> --> - <a class="btn btn-primary" href="{% url 'submissions:editorial_decision_create' recommendation.submission.preprint.identifier_w_vn_nr %}" role="button">Initiate the process to fix the editorial decision</a> - <!-- <br> - <form method="post" action="{% url 'submissions:eic_recommendation_detail' recommendation.submission.preprint.identifier_w_vn_nr recommendation.id %}" class="d-inline-block my-2"> - {% csrf_token %} - <button type="submit" name="action" value="fix" class="btn btn-primary btn-sm mr-2">Fix College decision</button> - <button type="submit" name="action" value="deprecate" class="btn btn-danger btn-sm text-white">Deprecate College decision</button> - </form> --> - </li> - </ul> - </div> - {% endif %} - </div> {% if voting_form %} <h3 class="mt-4" id="votingForm">Your position on this recommendation</h3> diff --git a/submissions/views.py b/submissions/views.py index 4bab987eaa956625a0aae1ca306594604d31c5af..47acc62145281108cac764e7ba6869b853818262 100644 --- a/submissions/views.py +++ b/submissions/views.py @@ -1971,8 +1971,8 @@ class EICRecommendationDetailView(UserPassesTestMixin, DetailView): eicrec = get_object_or_404(EICRecommendation, pk=self.kwargs.get('rec_id')) if eicrec.eligible_to_vote.filter(user=self.request.user).exists(): return True - if eicrec.submission.authors.filter(user=self.request.user).exists(): - return True + # if eicrec.submission.authors.filter(user=self.request.user).exists(): + # return True return False