diff --git a/scipost_django/scipost/templates/scipost/portal/_hx_submissions.html b/scipost_django/scipost/templates/scipost/portal/_hx_submissions.html index a97314a37e2b98f354efc07d366e94f5c8e47c98..84783caef54a60b505b88c88ad8318407fc86495 100644 --- a/scipost_django/scipost/templates/scipost/portal/_hx_submissions.html +++ b/scipost_django/scipost/templates/scipost/portal/_hx_submissions.html @@ -1,50 +1,7 @@ -{% load journals_extras %} - {% load crispy_forms_tags %} -<div class="d-flex justify-content-between"> - <button class="btn btn-outline-primary" data-bs-toggle="collapse" data-bs-target="#submissionsSearch" aria-expanded="false" aria-controls="submissionsSearch"> - {% include 'bi/search.html' %} Simple search / filter - </button> - <a class="btn btn-outline-primary ms-2" href="{% url 'scipost:search' %}"> - {% include 'bi/binoculars-fill.html' %}... or use our advanced search API {% include 'bi/arrow-right.html' %} - </a> -</div> -<div class="collapse" id="submissionsSearch"> - <div class="card card-body"> - <form - hx-post="{% url 'scipost:portal_hx_submissions_page' %}?page=1" - hx-trigger="load, keyup delay: 500ms, change" - hx-target="#submissions-search-results" - hx-indicator="#indicator-submissions-search" - > - <div id="submissions-search-form">{% crispy submissions_search_form %}</div> - </form> - </div> - <div id="indicator-submissions-search" class="htmx-indicator p-2"> - <button class="btn btn-warning" type="button" disabled> - <strong>Loading...</strong> - <div class="spinner-grow spinner-grow-sm ms-2" role="status" aria-hidden="true"></div> - </button> - </div> -</div> - -<h2 class="highlight mb-0">Submissions in {{ session_acad_field }}: {% if session_specialty %}{{ session_specialty }}{% else %}(all specialties){% endif %}</h2> - -<ul id="submissions-search-results" class="list-unstyled pool-list mt-2"></ul> - - - -{% block footer_script %} - <script nonce="{{ requeest.csp_nonce }}"> - /* If Proceedings is chosen as Journal, display Proceedings selector */ - document.getElementById("id_submitted_to").addEventListener("change", () => { - var e = document.getElementById("id_submitted_to") - if (e.options[e.selectedIndex].text.includes('Proceedings')) { - document.getElementById("row_proceedings").style.display = 'block' - } else { - document.getElementById("row_proceedings").style.display = 'none' - document.getElementById("id_proceedings").value = null - } - }) -{% endblock footer_script %} +{% if reports_needed %} + {% include 'scipost/portal/_hx_submissions_base.html' with form=submissions_search_form name='reports_needed' reports_needed=reports_needed %} +{% else %} + {% include 'scipost/portal/_hx_submissions_base.html' with form=submissions_search_form name='submissions' reports_needed=reports_needed %} +{% endif %} diff --git a/scipost_django/scipost/templates/scipost/portal/_hx_submissions_base.html b/scipost_django/scipost/templates/scipost/portal/_hx_submissions_base.html new file mode 100644 index 0000000000000000000000000000000000000000..2ec2ec1e40839d376eb9db23f79499b683f85ad3 --- /dev/null +++ b/scipost_django/scipost/templates/scipost/portal/_hx_submissions_base.html @@ -0,0 +1,66 @@ +{% load journals_extras %} + +{% load crispy_forms_tags %} + +<div class="d-flex justify-content-between"> + <button class="btn btn-outline-primary" data-bs-toggle="collapse" data-bs-target="#{{ name }}Search" aria-expanded="false" aria-controls="{{ name }}Search"> + {% include 'bi/search.html' %} Simple search / filter + </button> + <a class="btn btn-outline-primary ms-2" href="{% url 'scipost:search' %}"> + {% include 'bi/binoculars-fill.html' %}... or use our advanced search API {% include 'bi/arrow-right.html' %} + </a> +</div> +<div class="collapse" id="{{ name }}Search"> + <div class="card card-body"> + <form + hx-post="{% url 'scipost:portal_hx_submissions_page' %}?page=1{% if reports_needed %}&reports_needed=1{% endif %}" + hx-trigger="load, keyup delay: 500ms, change" + hx-target="#{{ name }}-search-results" + hx-indicator="#indicator-{{ name }}-search" + > + <div id="{{ name }}-search-form">{% crispy form %}</div> + </form> + </div> + <div id="indicator-{{ name }}-search" class="htmx-indicator p-2"> + <button class="btn btn-warning" type="button" disabled> + <strong>Loading...</strong> + <div class="spinner-grow spinner-grow-sm ms-2" role="status" aria-hidden="true"></div> + </button> + </div> +</div> + +<h2 class="highlight mb-0">Submissions in {{ session_acad_field }}: {% if session_specialty %}{{ session_specialty }}{% else %}(all specialties){% endif %}</h2> + +{% if reports_needed %} + <div class="card m-2 border-2 text-center"> + <div class="card-header m-0 p-0"> + <h2 class="m-0 p-2 text-white bg-danger"> + {% include 'bi/alarm-fill.html' %} Reports are needed on these Submissions + </h2> + </div> + <div class="card-body"> + <h3>Please consider contributing a Report so we can minimize delays in editorial processing.</h3> + <p>To do so, please navigate to the Submission's page and click on the <strong>Contribute a Report</strong> link {% if not user.is_authenticated %}(login required){% endif %} + </div> + </div> + + <hr> +{% endif %} + +<ul id="{{ name }}-search-results" class="list-unstyled pool-list mt-2"></ul> + + + +{% block footer_script %} + <script nonce="{{ requeest.csp_nonce }}"> + /* If Proceedings is chosen as Journal, display Proceedings selector */ + document.getElementById("id_submitted_to").addEventListener("change", () => { + var e = document.getElementById("id_submitted_to") + if (e.options[e.selectedIndex].text.includes('Proceedings')) { + document.getElementById("row_proceedings").style.display = 'block' + } else { + document.getElementById("row_proceedings").style.display = 'none' + document.getElementById("id_proceedings").value = null + } + }) +{% endblock footer_script %} diff --git a/scipost_django/scipost/templates/scipost/portal/_hx_submissions_page.html b/scipost_django/scipost/templates/scipost/portal/_hx_submissions_page.html index 0beb2f9b24d9391b5e1b57a51cf13ba3a8de54da..1c51e184b7f5b857a640286a6bf1d3f05741cffc 100644 --- a/scipost_django/scipost/templates/scipost/portal/_hx_submissions_page.html +++ b/scipost_django/scipost/templates/scipost/portal/_hx_submissions_page.html @@ -1,31 +1,5 @@ -{% for submission in page_obj %} - <li class="list-group-item py-2"> - {% include 'submissions/_submission_card_content_homepage.html' with submission=submission %} - </li> - <li class="list-group-item py-2"> - {% include 'submissions/_submission_li.html' with submission=submission %} - </li> -{% empty %} - <li class="list-group-item py-2"> - No submissions yet - </li> -{% endfor %} -{% if page_obj.has_next %} - <li id="next-submissions-{{ page_obj.number }}"> - <button class="btn btn-primary m-2" type="button" - hx-post="{% url 'scipost:portal_hx_submissions_page' %}?page={{ page_obj.next_page_number }}" - hx-include="#submissions-search-form" - hx-target="#next-submissions-{{ page_obj.number }}" - hx-swap="outerHTML" - hx-indicator="#indicator-submissions-page-{{ page_obj.number }}" - > - Load page {{ page_obj.next_page_number }} (out of {{ page_obj.paginator.num_pages }}) - </button> - <span id="indicator-submissions-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> - </span> - </li> +{% if reports_needed %} + {% include 'scipost/portal/_hx_submissions_page_base.html' with page_obj=page_obj name='reports_needed' reports_needed=reports_needed %} +{% else %} + {% include 'scipost/portal/_hx_submissions_page_base.html' with page_obj=page_obj name='submissions' reports_needed=reports_needed %} {% endif %} diff --git a/scipost_django/scipost/templates/scipost/portal/_hx_submissions_page_base.html b/scipost_django/scipost/templates/scipost/portal/_hx_submissions_page_base.html new file mode 100644 index 0000000000000000000000000000000000000000..ad067ee40231f4c6c81991a70706c2b09cb1e59b --- /dev/null +++ b/scipost_django/scipost/templates/scipost/portal/_hx_submissions_page_base.html @@ -0,0 +1,28 @@ +{% for submission in page_obj %} + <li class="list-group-item py-2"> + {% include 'submissions/_submission_card_content_homepage.html' with submission=submission %} + </li> +{% empty %} + <li class="list-group-item py-2"> + No submissions yet + </li> +{% endfor %} +{% if page_obj.has_next %} + <li id="next-{{ name }}-{{ page_obj.number }}"> + <button class="btn btn-primary m-2" type="button" + hx-post="{% url 'scipost:portal_hx_submissions_page' %}?page={{ page_obj.next_page_number }}{% if reports_needed %}&reports_needed=1{% endif %}" + hx-include="#{{ name }}-search-form" + hx-target="#next-{{ name }}-{{ page_obj.number }}" + hx-swap="outerHTML" + hx-indicator="#indicator-{{ name }}-page-{{ page_obj.number }}" + > + Load page {{ page_obj.next_page_number }} (out of {{ page_obj.paginator.num_pages }}) + </button> + <span id="indicator-{{ name }}-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> + </span> + </li> +{% endif %} diff --git a/scipost_django/scipost/templates/scipost/portal/portal.html b/scipost_django/scipost/templates/scipost/portal/portal.html index 1bb8942fe314bcbc8da87c8397007cd2a920fb88..b72b54ee241cb79829515d0f30ea97ad2783b8c4 100644 --- a/scipost_django/scipost/templates/scipost/portal/portal.html +++ b/scipost_django/scipost/templates/scipost/portal/portal.html @@ -47,7 +47,7 @@ </li> <li class="nav-item" role="presentation"> - <button class="nav-link" id="reports-needed-tab" + <button class="nav-link border border-warning" id="reports-needed-tab" data-bs-toggle="tab" data-bs-target="#reports-needed" type="button" role="tab" aria-controls="reports-needed" aria-selected="true"> @@ -105,7 +105,10 @@ <div class="tab-pane fade" id="reports-needed" role="tabpanel" aria-labelledby="reports-needed-tab"> - Reports needed! + <div hx-get="{% url 'scipost:portal_hx_submissions' %}?reports_needed=1" + hx-trigger="click from:#reports-needed-tab, session-acad-field-set[document.getElementById('reports-needed').classList.contains('active')] from:body, session-specialty-set[document.getElementById('reports-needed').classList.contains('active')] from:body" + > + </div> </div> <div class="tab-pane fade" id="reports" diff --git a/scipost_django/scipost/views.py b/scipost_django/scipost/views.py index accbc6c079251a39815e4510a96ba810bed89111..8798ceb1551ec36f331dba5f70254647fca7ffaa 100644 --- a/scipost_django/scipost/views.py +++ b/scipost_django/scipost/views.py @@ -234,12 +234,15 @@ def portal_hx_publications_page(request): def portal_hx_submissions(request): + reports_needed = request.GET.get('reports_needed', False) form = SubmissionSearchForm( acad_field_slug=request.session.get('session_acad_field_slug', None), - specialty_slug=request.session.get('session_specialty_slug', None) + specialty_slug=request.session.get('session_specialty_slug', None), + reports_needed=reports_needed ) context = { - 'submissions_search_form': form + 'submissions_search_form': form, + 'reports_needed': reports_needed } return render(request, 'scipost/portal/_hx_submissions.html', context) @@ -247,10 +250,12 @@ def portal_hx_submissions(request): def portal_hx_submissions_page(request): session_acad_field_slug = request.session.get('session_acad_field_slug', None) session_specialty_slug = request.session.get('session_specialty_slug', None) + reports_needed = request.GET.get('reports_needed', False) form = SubmissionSearchForm( request.POST or None, acad_field_slug=session_acad_field_slug, specialty_slug=session_specialty_slug, + reports_needed=reports_needed ) if form.is_valid(): submissions = form.search_results() @@ -263,7 +268,10 @@ def portal_hx_submissions_page(request): paginator = Paginator(submissions, 10) page_nr = request.GET.get('page') page_obj = paginator.get_page(page_nr) - context = { 'page_obj': page_obj } + context = { + 'page_obj': page_obj, + 'reports_needed': reports_needed + } return render(request, 'scipost/portal/_hx_submissions_page.html', context) diff --git a/scipost_django/submissions/forms.py b/scipost_django/submissions/forms.py index dd5c6e69a9d0a0138d26b6f561de17e83ff8099d..298b2fb8cce48d60d15c9a54eaaf1a47dd7ebe28 100644 --- a/scipost_django/submissions/forms.py +++ b/scipost_django/submissions/forms.py @@ -90,6 +90,7 @@ class SubmissionSearchForm(forms.Form): def __init__(self, *args, **kwargs): self.acad_field_slug = kwargs.pop('acad_field_slug') self.specialty_slug = kwargs.pop('specialty_slug') + self.reports_needed = kwargs.pop('reports_needed') super().__init__(*args, **kwargs) if self.acad_field_slug: self.fields['submitted_to'].queryset = Journal.objects.filter( @@ -136,6 +137,9 @@ class SubmissionSearchForm(forms.Form): submissions = submissions.filter( preprint__identifier_w_vn_nr__icontains=self.cleaned_data.get('identifier') ) + if self.reports_needed: + submissions = submissions.actively_refereeing( + ).open_for_reporting().order_by('submission_date') return submissions diff --git a/scipost_django/submissions/templates/submissions/pool/_referee_invitations.html b/scipost_django/submissions/templates/submissions/pool/_referee_invitations.html index a998d47dc575e865112e3a175261b46236268fa4..fbbf24fcb84245d8cc0248ac7914280e667ee32f 100644 --- a/scipost_django/submissions/templates/submissions/pool/_referee_invitations.html +++ b/scipost_django/submissions/templates/submissions/pool/_referee_invitations.html @@ -133,7 +133,6 @@ </tr> {% endfor %} - {# {% if submission.refereeing_cycle != 'direct_rec' and submission.is_open_for_reporting %} #} {% if submission.in_refereeing_phase %} <tr class="bg-white"> <td class="text-center py-3" colspan="9">