SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit 591771d3 authored by Jean-Sébastien Caux's avatar Jean-Sébastien Caux
Browse files

Improve submissions listing in edadmin and pool

parent 1b095010
No related branches found
No related tags found
No related merge requests found
Showing with 318 additions and 67 deletions
<h3 class="m-4">{{ submissions|length }} Submissions in this stage</h3>
{% for submission in submissions %}
{% for submission in page_obj %}
<div class="ms-3 mt-3"><strong>{{ forloop.counter0|add:start_index }} of {{ count }}</strong></div>
<details id="submission-{{ submission.pk }}-details"
class="border border-2 m-4"
class="border border-2 mx-3"
>
<summary class="px-4 py-2 bg-primary bg-opacity-10">
<div class="row">
<div class="col col-lg-10">
<table>
<tbody>
<tr>
<td>{{ submission.title }}</td>
</tr>
<tr>
<td>{{ submission.author_list }}</td>
</tr>
<tr>
<td>Submitted {{ submission.submission_date|date:"Y-m-d" }} to {{ submission.submitted_to }}</td>
</tr>
</tbody>
</table>
</div>
<div class="col col-lg-2">
<ul class="list list-unstyled">
<li class="mb-2"><a href="{% url 'submissions:submission' identifier_w_vn_nr=submission.preprint.identifier_w_vn_nr %}" target="_blank">{% include "bi/arrow-right-square-fill.html" %}submission page</a></li>
<li class="mb-2"><a href="{% url 'submissions:editorial_page' identifier_w_vn_nr=submission.preprint.identifier_w_vn_nr %}" target="_blank" class="text-danger">{% include "bi/arrow-right-square-fill.html" %}editorial page</a></li>
</ul>
</div>
</div>
<summary style="list-style: none;"
class="p-2 bg-primary bg-opacity-10"
>
{% include "submissions/pool/_submission_details_summary_contents.html" with submission=submission %}
</summary>
<div id="submission-{{ submission.pk }}-edadmin"
hx-get="{% url 'edadmin:_hx_submission' identifier_w_vn_nr=submission.preprint.identifier_w_vn_nr %}"
......@@ -38,3 +19,17 @@
{% empty %}
<p><strong>No Submission found</strong></p>
{% endfor %}
{% if page_obj.has_next %}
<div hx-get="{% url 'edadmin:_hx_submissions_in_stage' stage=stage %}?page={{ page_obj.next_page_number }}"
hx-trigger="revealed"
hx-swap="afterend"
hx-indicator="#indicator-search-page-{{ page_obj.number }}"
>
<div id="indicator-search-page-{{ page_obj.number }}" class="htmx-indicator p-2">
<button class="btn btn-warning" type="button" disabled>
<strong>Loading page {{ page_obj.next_page_number }} out of {{ page_obj.paginator.num_pages }}</strong>
<div class="spinner-grow spinner-grow-sm ms-2" role="status" aria-hidden="true"></div>
</button>
</div>
</div>
{% endif %}
......@@ -5,6 +5,7 @@ __license__ = "AGPL v3"
import operator
from django.contrib.auth.decorators import login_required, user_passes_test
from django.core.paginator import Paginator
from django.http import Http404
from django.shortcuts import get_object_or_404, render
......@@ -33,8 +34,18 @@ def _hx_submissions_in_stage(request, stage):
if stage not in Submission.STAGE_SLUGS:
raise Http404(f"This Submission stage does not exist: {stage}")
submissions = get_objects_for_user(request.user, "submissions.take_edadmin_actions")
submissions = operator.attrgetter(f"in_stage_{stage}")(submissions)()
paginator = Paginator(submissions, 16)
page_nr = request.GET.get("page")
page_obj = paginator.get_page(page_nr)
count = paginator.count
start_index = page_obj.start_index
context = {
"submissions": operator.attrgetter(f"in_stage_{stage}")(submissions)(),
"stage": stage,
"count": count,
"page_obj":
page_obj,
"start_index": start_index,
}
return render(request, "edadmin/_hx_submissions_list.html", context)
......
......@@ -120,6 +120,9 @@ class SubmissionQuerySet(models.QuerySet):
def stage_decisionmaking_completed(self):
return self.filter(status__in=self.model.STAGE_DECIDED)
def in_state_in_production(self):
return self.filter(status__in=self.model.STAGE_IN_PRODUCTION)
#### Other managers mixing statuses ####
def under_consideration(self):
......
<table class="submission summary">
<thead class="bg-info">
<th colspan="2" class="px-1 bg-info">Ontological classification</th>
</thead>
<tbody>
<tr>
<td>Academic field:</td>
<td>{{ submission.acad_field }}</td>
</tr>
<tr>
<td>Specialties:</td>
<td>
<ul class="m-0 ps-4">
{% for specialty in submission.specialties.all %}
<li>{{ specialty }}</li>
{% endfor %}
</ul>
</td>
</tr>
{% if submission.approaches %}
<tr>
<td>Approach{% if submission.approaches|length > 1 %}es{% endif %}:</td>
<td>{% for approach in submission.approaches %}{% if not forloop.first %}, {% endif %}{{ approach|capfirst }}{% endfor %}</td>
</tr>
{% endif %}
</tbody>
</table>
......@@ -102,33 +102,7 @@
</table>
</div>
<div class="mt-2 col col-xl-6">
<table class="submission summary">
<thead class="bg-info">
<th colspan="2" class="px-1 bg-info">Ontological classification</th>
</thead>
<tbody>
<tr>
<td>Academic field:</td>
<td>{{ submission.acad_field }}</td>
</tr>
<tr>
<td>Specialties:</td>
<td>
<ul class="m-0 ps-4">
{% for specialty in submission.specialties.all %}
<li>{{ specialty }}</li>
{% endfor %}
</ul>
</td>
</tr>
{% if submission.approaches %}
<tr>
<td>Approach{% if submission.approaches|length > 1 %}es{% endif %}:</td>
<td>{% for approach in submission.approaches %}{% if not forloop.first %}, {% endif %}{{ approach|capfirst }}{% endfor %}</td>
</tr>
{% endif %}
</tbody>
</table>
{% include "submissions/_submission_ontological_info_table.html" with submission=submission %}
</div>
</div>
......
{% load static %}
{% load submissions_pool %}
{% load user_groups %}
{% is_ed_admin request.user as is_ed_admin %}
<details>
<summary>
</summary>
</details>
<div class="pool-item">
<div class="row">
<div class="col-md-7">
<a href="{% url 'submissions:submission' submission.preprint.identifier_w_vn_nr %}">{{ submission.title }}</a>
<br>
<em>by {{ submission.author_list }}</em>
<br>
<div class="my-2">
<span class="text-secondary">{% include 'bi/bullseye.html' %}:&nbsp;</span>
{{ submission.submitted_to }}
</div>
</div>
<div class="col-md-5">
<ul class="bg-secondary py-1">
{% for specialty in submission.specialties.all %}
<li><small>{{ specialty }}</small></li>
{% endfor %}
</ul>
</div>
</div>
<div class="row mb-0">
<div class="col-md-3">
<small class="text-muted">Editor-in-charge</small>
<br>
<ul class="list list-unstyled">
{% if submission.status == 'seeking_assignment' %}
{% if is_ed_admin %}
<li>Seeking assignment</li>
{% else %}
<li>You can
<a href="{% url 'submissions:pool:editorial_assignment' submission.preprint.identifier_w_vn_nr %}"><strong class="text-danger">volunteer to become Editor-in-charge</strong></a>
</li>
{% endif %}
{% if request.user.contributor.is_active_senior_fellow %}
<li>As Senior Fellow: <a href="{% url 'submissions:editor_invitations' submission.preprint.identifier_w_vn_nr %}"><strong class="text-danger">view/update editor invitations</strong></a></li>
{% endif %}
{% elif submission.editor_in_charge == request.user.contributor %}
<li>
<strong>You are the EIC</strong>
<a role="button" class="btn btn-info px-1 py-0" href="{% url 'submissions:editorial_page' submission.preprint.identifier_w_vn_nr %}"><small>{% include 'bi/arrow-right.html' %} Editorial&nbsp;page</small></a>
</li>
{% else %}
<li>{{ submission.editor_in_charge }}</li>
{% endif %}
</ul>
</div>
<div class="col-md-3">
<small class="text-muted">Original submission date</small>
<br>
{{ submission.original_submission_date|date:'Y-m-d' }}
</div>
<div class="col-md-2">
<small class="text-muted">Latest activity</small>
<br>
{{ submission.latest_activity }}
</div>
<div class="col-md-4">
<small class="text-muted">Submission Status</small>
<br>
<span class="label label-sm label-secondary text-wrap">{{ submission.get_status_display }}</span>
{% with recommendation=submission.eicrecommendations.active.first %}
{% if recommendation %}
<br>
<small class="text-muted">EIC Recommendation &amp; Status</small>
<br>
<span class="label label-sm label-secondary text-wrap">{{ recommendation.get_full_status_display }}</span>
<br>
<small class="text-muted">{{ recommendation.eligible_to_vote.count }} voting: {{ recommendation.voted_for.count }} agreed, {{ recommendation.voted_against.count }} disagreed, {{ recommendation.voted_abstain.count }} abstained</small>
{% endif %}
{% endwith %}
{% if submission.editorial_decision %}
<br>
<small class="text-muted">Editorial Decision Status</small>
<br>
<span class="label label-sm label-secondary text-wrap">{{ submission.editorial_decision.get_status_display }}</span>
{% endif %}
</div>
</div>
{% if is_ed_admin and submission.has_inadequate_fellowship_composition %}
<div class="border border-danger text-danger mt-1 py-1 px-2">
<strong>
{% include 'bi/exclamation-triangle-fill.html' %}
Notice to admin: The current editor is not assigned to the pool. Therefore, the editor will not be able to reach the editorial page.
</strong>
</div>
{% endif %}
{% if submission.cycle.has_required_actions %}
<div class="card-text bg-danger text-white mt-1 py-1 px-2">
<button type="button" class="btn p-0" disabled>
<small class="text-white">This Submission contains required actions.</small>
</button>
{% if is_ed_admin %}{% include 'submissions/pool/_required_actions_tooltip.html' with submission=submission classes='text-white' %}{% endif %}
</div>
{% endif %}
{% if submission.status == 'seeking_assignment' %}
{% get_editor_invitations submission request.user as invitations %}
{% if invitations %}
<div class="border border-warning mt-1 py-1 px-2">
<span class="mt-1 px-1 text-danger">{% include 'bi/exclamation.html' %}</i>
You are invited to become Editor-in-charge of this Submission. <a href="{% url 'submissions:pool:editorial_assignment' submission.preprint.identifier_w_vn_nr %}">You can reply to this invitation here</a>.
</div>
{% endif %}
{% endif %}
<div id="details_{{ submission.id }}" class="mt-2">
<button type="button" class="btn btn-primary p-1 mx-auto"
hx-get="{% url 'submissions:pool:_hx_submission_li_details' submission.preprint.identifier_w_vn_nr %}"
hx-target="#details_{{ submission.id }}"
hx-indicator="#indicator-details-{{ submission.id }}"
>
<small>View details</small>
</button>
<span id="indicator-details-{{ submission.id }}" class="htmx-indicator p-1">
<button class="btn btn-sm btn-warning p-2" type="button" disabled>
<small><strong>Loading...</strong></small>
<div class="spinner-grow spinner-grow-sm ms-2" role="status" aria-hidden="true"></div>
</button>
</span>
</div>
</div>
{% for submission in page_obj %}
<li{% if not forloop.first %} class="mt-4"{% endif %}><strong>{{ forloop.counter0|add:start_index }} of {{ count }}</strong></li>
<li class="submission p-2 mb-2" id="submission_{{ submission.id }}">
{% include 'submissions/pool/_hx_submission_li.html' with submission=submission %}
</li>
<span>{% if not forloop.first %} class="mt-4"{% endif %}><strong>{{ forloop.counter0|add:start_index }} of {{ count }}</strong></span>
{% include 'submissions/pool/_hx_submission_details.html' with submission=submission %}
{% empty %}
<li>No Submission could be found</li>
<strong>No Submission could be found</strong>
{% endfor %}
{% if page_obj.has_next %}
<li hx-post="{% url 'submissions:pool:_hx_submissions_list' %}?page={{ page_obj.next_page_number }}"
hx-include="#search-form"
hx-trigger="revealed"
hx-swap="afterend"
hx-indicator="#indicator-search-page-{{ page_obj.number }}"
<div hx-post="{% url 'submissions:pool:_hx_submissions_list' %}?page={{ page_obj.next_page_number }}"
hx-include="#search-form"
hx-trigger="revealed"
hx-swap="afterend"
hx-indicator="#indicator-search-page-{{ page_obj.number }}"
>
<div id="indicator-search-page-{{ page_obj.number }}" class="htmx-indicator p-2">
<button class="btn btn-warning" type="button" disabled>
......@@ -19,5 +17,5 @@
<div class="spinner-grow spinner-grow-sm ms-2" role="status" aria-hidden="true"></div>
</button>
</div>
</li>
</div>
{% endif %}
<div class="row mb-0">
<div class="col col-md-9">
<table>
<tbody>
<tr>
<td><strong class="text-primary">{{ submission.title }}</strong></td>
</tr>
<tr class="mt-1">
<td><strong><em>by {{ submission.author_list }}</em></strong></td>
</tr>
</tbody>
</table>
<div class="row mt-2 mb-0">
<div class="col">
<small class="text-muted">Submitted to</small><br>
{{ submission.submitted_to }}
</div>
<div class="col">
{% if submission.is_resubmission_of %}
<table class="m-0 p-0">
<tr>
<td>
<small class="text-muted">
Resubmission:
</small>
</td>
<td class="ms-2">{{ submission.submission_date|date:"Y-m-d" }}</td>
</tr>
<tr>
<td>
<small class="text-muted">Original submission:</small>
</td>
<td class="ms-2">{{ submission.original_submission_date|date:'Y-m-d' }}</td>
</tr>
</table>
{% else %}
<small class="text-muted">Submission date</small>
<br>
{{ submission.submission_date|date:'Y-m-d' }}
{% endif %}
</div>
<div class="col">
<small class="text-muted">Submission Status</small>
<br>
{{ submission.get_status_display }}</span>
{% with recommendation=submission.eicrecommendations.active.first %}
{% if recommendation %}
<br>
<small class="text-muted">EIC Recommendation &amp; Status</small>
<br>
{{ recommendation.get_full_status_display }}
<br>
<small class="text-muted">{{ recommendation.eligible_to_vote.count }} voting: {{ recommendation.voted_for.count }} agreed, {{ recommendation.voted_against.count }} disagreed, {{ recommendation.voted_abstain.count }} abstained</small>
{% endif %}
{% endwith %}
{% if submission.editorial_decision %}
<br>
<small class="text-muted">Editorial Decision Status</small>
<br>
{{ submission.editorial_decision.get_status_display }}
{% endif %}
</div>
</div>
{% if submission.stage_preassignment_completed %}
<div class="row mt-2 mb-0">
{% if submission.editor_in_charge %}
<div class="col-md-4">
<small class="text-muted">Editor-in-charge</small>
<br>
{% if submission.editor_in_charge == request.user.contributor %}
<strong>You are the EIC</strong>
{% else %}
<strong>{{ submission.editor_in_charge }}</strong>
{% endif %}
</div>
{% elif request.user.contributor.is_ed_admin or request.user.contributor.is_active_senior_fellow %}
<div class="col-md-4">
<a class="btn btn-primary" href="{% url 'submissions:editor_invitations' submission.preprint.identifier_w_vn_nr %}"><small>View/update invitations</small></a>
</div>
{% else %}
<div class="col-md-4">
<a class="btn btn-success" href="{% url 'submissions:pool:editorial_assignment' submission.preprint.identifier_w_vn_nr %}"><small>Volunteer as EiC</small></a>
</div>
{% endif %}
</div>
{% endif %}
</div>
<div class="col col-md-3 border-start">
<ul class="ms-2 p-0">
{% for specialty in submission.specialties.all %}
<li><small>{{ specialty }}</small></li>
{% endfor %}
</ul>
<ul class="ms-2 list list-unstyled">
<li class="mb-2"><a href="{% url 'submissions:submission' identifier_w_vn_nr=submission.preprint.identifier_w_vn_nr %}" target="_blank">{% include "bi/arrow-right-square-fill.html" %}submission page</a></li>
{% if request.user.contributor.is_ed_admin or request.user.contributor == submission.editor_in_charge %}
<li class="mb-2"><a href="{% url 'submissions:editorial_page' identifier_w_vn_nr=submission.preprint.identifier_w_vn_nr %}" target="_blank">
<span class="text-danger">
{% include "bi/arrow-right-square-fill.html" %}
editorial page
</span>
</a></li>
{% endif %}
</ul>
</div>
</div>
......@@ -96,7 +96,7 @@
<div class="spinner-grow spinner-grow-sm ms-2" role="status" aria-hidden="true"></div>
</button>
</div>
<ul id="search-results" class="list-unstyled pool-list mt-2"></ul>
<div id="search-results" class="mt-2"></div>
{% endblock content %}
{% block footer_script %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment