diff --git a/journals/templates/journals/publication_detail.html b/journals/templates/journals/publication_detail.html index 1f761e64b77d43ac9a9b193ef0c1a93839528db6..c1f9f32cdadecfffa744003a1a4e0611937a0f97 100644 --- a/journals/templates/journals/publication_detail.html +++ b/journals/templates/journals/publication_detail.html @@ -148,24 +148,24 @@ {% endif %} {% if is_scipost_admin or is_edcol_admin %} - {% if publication.institutions.all %} - <div class="card"> - <div class="card-header"> - Institution{{ publication.institutions.all|pluralize }} related to this Publication (<span class="text-danger">Admin-only view, to be removed</span>) - </div> - <div class="card-content"> - <ul class="m-2"> - {% for institution in publication.institutions.all %} - <li><a href="{{ institution.get_absolute_url }}">{{ institution }}</a></li> - {% endfor %} - </ul> - </div> - </div> - {% endif %} + {% if publication.institutions.all %} + <div class="card"> + <div class="card-header"> + Institution{{ publication.institutions.all|pluralize }} related to this Publication (<span class="text-danger">Admin-only view, to be removed</span>) + </div> + <div class="card-content"> + <ul class="m-2"> + {% for institution in publication.institutions.all %} + <li><a href="{{ institution.get_absolute_url }}">{{ institution }}</a></li> + {% endfor %} + </ul> + </div> + </div> + {% endif %} {% endif %} - {% if request.user and request.user.contributor in publication.registered_authors.all %} + {% if request.user.contributor in publication.registered_authors.all %} <h3>Author actions</h3> <ul> <li><a href="{% url 'commentaries:comment_on_publication' publication.doi_label %}">Place a comment on this publication</a></li> diff --git a/scipost/templates/partials/scipost/personal_page/editorial_actions.html b/scipost/templates/partials/scipost/personal_page/editorial_actions.html index a1735062d0098986b300b262920a183cb62a2052..2271662f10137fe488cd6a4ca5deb2c133bde644 100644 --- a/scipost/templates/partials/scipost/personal_page/editorial_actions.html +++ b/scipost/templates/partials/scipost/personal_page/editorial_actions.html @@ -1,5 +1,6 @@ {% load user_groups %} {% is_scipost_admin request.user as is_scipost_admin %} + <div class="row"> <div class="col-12"> <div class="card bg-light"> @@ -14,24 +15,24 @@ <div class="col-md-4"> {% if perms.scipost.can_vet_comments or perms.scipost.can_vet_submitted_reports %} - <h3>Vetting actions</h3> - <ul> - {% if perms.scipost.can_vet_commentary_requests %} - <li><a href="{% url 'commentaries:vet_commentary_requests' %}">Vet Commentary Page requests</a> ({{ nr_commentary_page_requests_to_vet }})</li> - {% endif %} - {% if perms.scipost.can_vet_comments %} - <li><a href="{% url 'comments:vet_submitted_comments_list' %}">Vet submitted Comments</a> ({{ nr_comments_to_vet }})</li> - {% endif %} - {% if perms.scipost.can_vet_thesislink_requests %} - <li><a href="{% url 'theses:unvetted_thesislinks' %}">Vet Thesis Link Requests</a> ({{ nr_thesislink_requests_to_vet }})</li> - {% endif %} - {% if perms.scipost.can_vet_authorship_claims %} - <li><a href="{% url 'scipost:vet_authorship_claims' %}">Vet Authorship Claims</a> ({{ nr_authorship_claims_to_vet }})</li> - {% endif %} - {% if perms.scipost.can_vet_submitted_reports %} - <li><a href="{% url 'submissions:vet_submitted_reports_list' %}">Vet submitted Reports</a> ({{ nr_reports_to_vet }})</li> - {% endif %} - </ul> + <h3>Vetting actions</h3> + <ul> + {% if perms.scipost.can_vet_commentary_requests %} + <li><a href="{% url 'commentaries:vet_commentary_requests' %}">Vet Commentary Page requests</a> ({{ nr_commentary_page_requests_to_vet }})</li> + {% endif %} + {% if perms.scipost.can_vet_comments %} + <li><a href="{% url 'comments:vet_submitted_comments_list' %}">Vet submitted Comments</a> ({{ nr_comments_to_vet }})</li> + {% endif %} + {% if perms.scipost.can_vet_thesislink_requests %} + <li><a href="{% url 'theses:unvetted_thesislinks' %}">Vet Thesis Link Requests</a> ({{ nr_thesislink_requests_to_vet }})</li> + {% endif %} + {% if perms.scipost.can_vet_authorship_claims %} + <li><a href="{% url 'scipost:vet_authorship_claims' %}">Vet Authorship Claims</a> ({{ nr_authorship_claims_to_vet }})</li> + {% endif %} + {% if perms.scipost.can_vet_submitted_reports %} + <li><a href="{% url 'submissions:vet_submitted_reports_list' %}">Vet submitted Reports</a> ({{ nr_reports_to_vet }})</li> + {% endif %} + </ul> {% endif %} {% if perms.scipost.can_oversee_refereeing %} diff --git a/scipost/templates/scipost/navbar.html b/scipost/templates/scipost/navbar.html index 6903b8740ed5bed4bc331815a21a4cb96f246e00..450504c4c8b1755983bb4ade0d92ab2fd570201b 100644 --- a/scipost/templates/scipost/navbar.html +++ b/scipost/templates/scipost/navbar.html @@ -2,6 +2,9 @@ {% load staticfiles %} {% load notifications_tags %} {% load scipost_extras %} +{% load user_groups %} + +{% is_editorial_college request.user as is_editorial_college %} <nav class="navbar navbar-expand-lg main-nav"> <!-- <a class="navbar-brand mr-auto mr-lg-0" href="#">Offcanvas navbar</a> --> @@ -51,7 +54,7 @@ </span> </li> {% if user.contributor %} - {% if user.contributor.fellowships.active.exists %} + {% if is_editorial_college %} <li class="nav-item{% if '/submissions/pool/' in request.path %} active{% endif %}"> <span class="separator">·</span> <a class="nav-link" href="{% url 'submissions:pool' %}">Submissions Pool</a> diff --git a/scipost/templatetags/user_groups.py b/scipost/templatetags/user_groups.py index 21fdecf8a109e12616e830c28fe843c320dea1ec..5cc738412825fe49dfcf7cec3f04767f7de854ea 100644 --- a/scipost/templatetags/user_groups.py +++ b/scipost/templatetags/user_groups.py @@ -38,15 +38,14 @@ def is_financial_admin(user): def is_editorial_college(user): """ Assign template variable (boolean) to check if user is member of Editorial College group. - - !!! - This filter should actually be dynamic, not checking the permissions group but the current - active Fellowship instances for the user. - !!! - - This assignment is limited to a certain context block! """ - return user.groups.filter(name='Editorial College').exists() or user.is_superuser + if not hasattr(user, 'contributor'): + return False + if user.is_superuser: + return True + elif user.groups.filter(name='Editorial College').exists(): + return True + return user.contributor.fellowships.exists() @register.simple_tag diff --git a/scipost/views.py b/scipost/views.py index e18c83e88f150372f8ad3cfb19e078aa9d65d256..64ec98fcd7070cf2ba06c5a1ba82768905324705 100644 --- a/scipost/views.py +++ b/scipost/views.py @@ -463,6 +463,7 @@ def _personal_page_editorial_actions(request): 'Editorial College', 'Vetting Editors', 'Junior Ambassadors']).exists() or request.user.is_superuser + permission = permission or request.user.contributor.is_MEC() if not permission: raise PermissionDenied diff --git a/submissions/models.py b/submissions/models.py index 32bddfeee0dfe51f829319a7436cef8cc8671bb5..c54a2c812d04932c83699f8c96fb8cb085f4aa5a 100644 --- a/submissions/models.py +++ b/submissions/models.py @@ -174,14 +174,14 @@ class Submission(models.Model): Q(comments__submissions=self)).distinct() @property - def cycle_2(self): + def cycle(self): """Get cycle object that's relevant for the Submission.""" if not hasattr(self, '_cycle'): self._cycle = RegularCycle(self) return self._cycle @property - def cycle(self): + def cycle_old(self): """Get cycle object that's relevant for the Submission.""" if not hasattr(self, '__cycle'): self.set_cycle() diff --git a/submissions/templates/partials/submissions/pool/required_actions_block.html b/submissions/templates/partials/submissions/pool/required_actions_block.html index 835f3048705fda7996e73895ab72fbf928baf4b2..613296dca8301152d856cc36cb814a3fb38d8345 100644 --- a/submissions/templates/partials/submissions/pool/required_actions_block.html +++ b/submissions/templates/partials/submissions/pool/required_actions_block.html @@ -1,11 +1,11 @@ -{% if submission.cycle_2.has_required_actions %} - <div class="card {% if submission.cycle_2.has_required_actions %}bg-danger text-white{% else %}bg-white border-success text-success{% endif %} mb-3"> - <div class="card-header py-1 {% if not submission.cycle_2.has_required_actions %}bg-transparent border-0 pb-0{% endif %}"> +{% if submission.cycle.has_required_actions %} + <div class="card {% if submission.cycle.has_required_actions %}bg-danger text-white{% else %}bg-white border-success text-success{% endif %} mb-3"> + <div class="card-header py-1 {% if not submission.cycle.has_required_actions %}bg-transparent border-0 pb-0{% endif %}"> <h3 class="my-1">Required actions:</h3> </div> <div class="card-body"> <ul class="mb-0"> - {% for action in submission.cycle_2.required_actions %} + {% for action in submission.cycle.required_actions %} <li>{{action.1}}</li> {% empty %} <li>No actions required</li> diff --git a/submissions/templates/partials/submissions/pool/required_actions_tooltip.html b/submissions/templates/partials/submissions/pool/required_actions_tooltip.html index f5b3fd919c488c115f941ed03ca29d38275ad4c8..4b42c758a933bfe49aefcc6b88a2efbfc293f5b5 100644 --- a/submissions/templates/partials/submissions/pool/required_actions_tooltip.html +++ b/submissions/templates/partials/submissions/pool/required_actions_tooltip.html @@ -1,8 +1,8 @@ -{% if submission.cycle_2.has_required_actions %} +{% if submission.cycle.has_required_actions %} <i class="fa fa-exclamation-circle {{ classes }}" data-toggle="tooltip" data-html="true" title=" Required Actions: <ul class='mb-0 pl-3 text-left'> - {% for action in submission.cycle_2.required_actions %} + {% for action in submission.cycle.required_actions %} <li>{{ action.1 }}</li> {% endfor %} </ul> diff --git a/submissions/templates/partials/submissions/pool/submission_li.html b/submissions/templates/partials/submissions/pool/submission_li.html index 3115a881e26ebc5692076ef922e72aa79cb65529..708bfc31b328b65af23c9f6808eb7ea4a2b03952 100644 --- a/submissions/templates/partials/submissions/pool/submission_li.html +++ b/submissions/templates/partials/submissions/pool/submission_li.html @@ -54,7 +54,7 @@ </div> </div> - {% if submission.cycle_2.has_required_actions %} + {% if submission.cycle.has_required_actions %} <div class="card-text bg-danger text-white mt-1 py-1 px-2"> This Submission contains required actions, <a href="{% url 'submissions:pool' submission.preprint.identifier_w_vn_nr %}" class="text-white" data-toggle="dynamic" data-target="#container_{{ submission.id }}">click to see details.</a> {% include 'partials/submissions/pool/required_actions_tooltip.html' with submission=submission classes='text-white' %} </div> diff --git a/submissions/templates/partials/submissions/submission_status.html b/submissions/templates/partials/submissions/submission_status.html index 2f3e16e7fbf6782fdb84023c6dbfb5c10fccc770..3497b1b68428c19fa76ed0b684e09db1ca9e158f 100644 --- a/submissions/templates/partials/submissions/submission_status.html +++ b/submissions/templates/partials/submissions/submission_status.html @@ -3,13 +3,13 @@ <div class="status"> <span class="label label-secondary">{{submission.get_status_display}}</span> {% if submission.publication and submission.publication.is_published %} - as <a href="{{submission.publication.get_absolute_url}}"> - {% if submission.publication.in_issue %} - {{submission.publication.in_issue.in_volume.in_journal.abbreviation_citation}} <strong>{{submission.publication.in_issue.in_volume.number}}</strong>, {{submission.publication.get_paper_nr}} - {% else %} - {{submission.publication.in_journal.abbreviation_citation}}, {{submission.publication.paper_nr}} - {% endif %} - ({{submission.publication.publication_date|date:'Y'}})</a> + as + <a href="{{submission.publication.get_absolute_url}}"> + {{ submission.publication.get_journal.abbreviation_citation }} + {% if submission.publication.in_issue.in_volume %} <strong>{{ submission.publication.in_issue.in_volume.number }}</strong>,{% endif %} + {{ submission.publication.paper_nr }} + ({{ submission.publication.publication_date|date:'Y' }}) + </a> {% endif %} </div> </div> diff --git a/submissions/templates/submissions/pool/editorial_page.html b/submissions/templates/submissions/pool/editorial_page.html index 8be2b3bd217717d316cce69accf2a16908c6b814..2cf319e62264cc7f28b170aadb63f94064265394 100644 --- a/submissions/templates/submissions/pool/editorial_page.html +++ b/submissions/templates/submissions/pool/editorial_page.html @@ -80,7 +80,7 @@ <li> <a href="#editorial-status">Editorial status</a> <ul> - <li><a href="#required-actions">Required actions</a> ({{ submission.cycle_2.required_actions|length }})</li> + <li><a href="#required-actions">Required actions</a> ({{ submission.cycle.required_actions|length }})</li> <li><a href="#referee-details">Refereeing invitations</a></li> </ul> </li> @@ -111,7 +111,7 @@ <h2 id="editorial-status">Editorial status</h2> - <p>{{ submission.cycle_2 }}</p> + <p>{{ submission.cycle }}</p> <table class="table table-borderless"> <tr> <td>Submission status:</td> @@ -130,6 +130,16 @@ {% endif %} </td> </tr> + <tr> + <td>Editor-in-charge:</td> + <td> + {% if submission.editor_in_charge %} + {{ submission.editor_in_charge.formal_str }} + {% else %} + Unassigned{% if is_editorial_admin %}, <a href="{% url 'submissions:editor_invitations' submission.preprint.identifier_w_vn_nr %}">see editor invitations</a>.{% endif %} + {% endif %} + </td> + </tr> <tr> <td>Refereeing cycle:</td> <td>{{ submission.get_refereeing_cycle_display }}</td> @@ -275,16 +285,16 @@ </table> {% if full_access %} - <div class="my-5 p-3 border{% if submission.cycle_2.has_required_actions %} border-danger{% endif %}" id="required-actions"> + <div class="my-5 p-3 border{% if submission.cycle.has_required_actions %} border-danger{% endif %}" id="required-actions"> <h3> - {% if submission.cycle_2.has_required_actions %} + {% if submission.cycle.has_required_actions %} <i class="fa fa-exclamation-triangle text-danger"></i> {% else %} <i class="fa fa-check-circle"></i> {% endif %} Required actions </h3> - {{ submission.cycle_2.required_actions }} + {{ submission.cycle.required_actions }} </div> {# {% include 'partials/submissions/pool/required_actions_block.html' with submission=submission %} #} {% endif %} @@ -309,13 +319,16 @@ {% if submission.refereeing_cycle != 'direct_rec' %} <h3 class="mt-3" id="referee-details">Refereeing invitations</h3> {% if not submission.referee_invitations.exists %} - <p>You have not yet invited referees. <a href="{% url 'submissions:select_referee' identifier_w_vn_nr=submission.preprint.identifier_w_vn_nr %}">Please invite at least 3 referees</a>.</p> + <p>You have not yet invited referees. <a href="{% url 'submissions:select_referee' identifier_w_vn_nr=submission.preprint.identifier_w_vn_nr %}">Please invite at least {{ submission.cycle.minimum_number_of_referees }} referees</a>.</p> {% elif submission.eicrecommendations.active %} <p>Thank you for formulating your Editorial Recommendation. The statuses of the referee invitations might still change, see details below.</p> - {% elif submission.referee_invitations.non_cancelled|length == 1 %} - <p>You have 1 referee who {% if submission.referee_invitations.non_cancelled.first.fulfilled %}submitted a Report{% elif submission.referee_invitations.non_cancelled.first.accepted %}has accepted to referee{% else %} is invited{% endif %}. <a href="{% url 'submissions:select_referee' identifier_w_vn_nr=submission.preprint.identifier_w_vn_nr %}">Please invite at least two more referees</a>.</p> - {% elif submission.referee_invitations.non_cancelled|length < 3 %} - <p>You have {{ submission.referee_invitations.non_cancelled|length }} referee{{ submission.referee_invitations.non_cancelled|length|pluralize }} who are either invited, have accepted or submitted a Report. <a href="{% url 'submissions:select_referee' identifier_w_vn_nr=submission.preprint.identifier_w_vn_nr %}">Please invite at least 3 referees</a>.</p> + {% elif submission.referee_invitations.non_cancelled|length < submission.cycle.minimum_number_of_referees %} + {% if submission.referee_invitations.non_cancelled|length == 1 %} + <p>You have 1 referee who {% if submission.referee_invitations.non_cancelled.first.fulfilled %}submitted a Report{% elif submission.referee_invitations.non_cancelled.first.accepted %}has accepted to referee{% else %} is invited{% endif %}. + {% else %} + <p>You have {{ submission.referee_invitations.non_cancelled|length }} referee{{ submission.referee_invitations.non_cancelled|length|pluralize }} who are either invited, have accepted or submitted a Report. + {% endif %} + <a href="{% url 'submissions:select_referee' identifier_w_vn_nr=submission.preprint.identifier_w_vn_nr %}">Please invite at least {{ submission.cycle.minimum_number_of_referees }} referees</a>.</p> {% else %} <p>Currently, you have {{ submission.referee_invitations.non_cancelled|length }} referees who are either invited, have accepted or submitted a Report. See details below.</p> {% endif %} diff --git a/submissions/templates/submissions/submission_detail.html b/submissions/templates/submissions/submission_detail.html index 25c4a1861b2b30ec8ffe79f6680b9b812e1783d0..7c52f8a69f681f3abefef702b783f0bab1a8340a 100644 --- a/submissions/templates/submissions/submission_detail.html +++ b/submissions/templates/submissions/submission_detail.html @@ -54,13 +54,13 @@ <div class="pl-2 mb-1"> {% if submission.publication and submission.publication.is_published %} <h4> - - Published as <a href="{{submission.publication.get_absolute_url}}"> - {% if submission.publication.in_issue %} - {{submission.publication.in_issue.in_volume.in_journal.abbreviation_citation}} <strong>{{submission.publication.in_issue.in_volume.number}}</strong>, {{submission.publication.get_paper_nr}} - {% else %} - {{submission.publication.in_journal.abbreviation_citation}}, {{submission.publication.paper_nr}} - {% endif %} - ({{submission.publication.publication_date|date:'Y'}})</a> + - Published as + <a href="{{submission.publication.get_absolute_url}}"> + {{ submission.publication.get_journal.abbreviation_citation }} + {% if submission.publication.in_issue.in_volume %} <strong>{{ submission.publication.in_issue.in_volume.number }}</strong>,{% endif %} + {{ submission.publication.paper_nr }} + ({{ submission.publication.publication_date|date:'Y' }}) + </a> </h4> {% endif %} diff --git a/submissions/views.py b/submissions/views.py index 950f08b0c1c5fd10a8842d83fcab6e9082892677..140902de266a8acbb74a7a169e2d4c57ba1bf05f 100644 --- a/submissions/views.py +++ b/submissions/views.py @@ -803,8 +803,8 @@ def cycle_form_submit(request, identifier_w_vn_nr): form = SubmissionCycleChoiceForm(request.POST or None, instance=submission) if form.is_valid(): submission = form.save() - submission.cycle_2.reset_refereeing_round() - submission.cycle_2.reinvite_referees(form.cleaned_data['referees_reinvite'], request) + submission.cycle.reset_refereeing_round() + submission.cycle.reinvite_referees(form.cleaned_data['referees_reinvite'], request) messages.success(request, ('<h3>Your choice has been confirmed</h3>' 'The new cycle will be <em>%s</em>' % submission.get_refereeing_cycle_display()))