SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit 66f1e5fc authored by George Katsikas's avatar George Katsikas :goat:
Browse files

add upload proofs action to production stream

change actions view to bootstrap accordion
parent 50fb6886
No related branches found
No related tags found
1 merge request!43Polish up new production page
{% load guardian_tags %} {% load guardian_tags %}
{% load bootstrap %}
{% get_obj_perms request.user for productionstream as "sub_perms" %} {% get_obj_perms request.user for productionstream as "sub_perms" %}
...@@ -8,49 +9,156 @@ ...@@ -8,49 +9,156 @@
<div class="row"> <div class="row">
<div class="col-12 col-md-6"> <div class="col-12 col-md-6">
<h3>Actions</h3>
{% if "can_perform_supervisory_actions" in sub_perms %} <div class="accordion px-2"
<div class="container"> id="productionstream-{{ productionstream.id }}-actions-accordion">
<details class="mb-3"> <h3>Actions</h3>
<summary class="fs-6">Change stream property</summary>
<div class="border-primary border-start ps-2 pt-4">
{% include "production/_hx_productionstream_change_status.html" with form=status_form stream=productionstream %}
{% include "production/_hx_productionstream_change_supervisor.html" with form=supervisor_form stream=productionstream %}
{% include "production/_hx_productionstream_change_prodofficer.html" with form=prod_officer_form stream=productionstream %}
{% include "production/_hx_productionstream_change_invofficer.html" with form=inv_officer_form stream=productionstream %}
</div>
</details>
</div>
{% endif %}
<ul>
<li>Worklog</li>
{% if perms.scipost.can_publish_accepted_submission %} {% if perms.scipost.can_take_decisions_related_to_proofs %}
<div class="row"> <div class="accordion-item">
<div class="col-12 col-sm-auto col-md-12 col-lg-auto h-100 d-none-empty"> <h2 class="accordion-header"
<div class="row m-0 d-none-empty"> id="productionstream-{{ productionstream.id }}-change-stream-property-header">
<button class="btn btn-sm btn-warning text-white" hx-get="{% url 'production:mark_as_completed' stream_id=productionstream.id %}" hx-confim="Are you sure you want to mark this stream as completed?" hx-target="#productionstream-{{ productionstream.id }}-details"> <button class="accordion-button fs-6 collapsed"
Mark this stream as completed type="button"
</button> data-bs-toggle="collapse"
data-bs-target="#productionstream-{{ productionstream.id }}-change-stream-property"
aria-expanded="true"
aria-controls="productionstream-{{ productionstream.id }}-change-stream-property">
Change stream property
</button>
</h2>
<div id="productionstream-{{ productionstream.id }}-change-stream-property"
class="accordion-collapse collapse"
aria-labelledby="productionstream-{{ productionstream.id }}-change-stream-property-header"
data-bs-parent="#productionstream-{{ productionstream.id }}-actions-accordion">
<div id="productionstream-{{ productionstream.id }}-change-stream-property-body"
class="accordion-body">
{% include "production/_hx_productionstream_change_status.html" with form=status_form stream=productionstream %}
{% include "production/_hx_productionstream_change_supervisor.html" with form=supervisor_form stream=productionstream %}
{% include "production/_hx_productionstream_change_prodofficer.html" with form=prod_officer_form stream=productionstream %}
{% include "production/_hx_productionstream_change_invofficer.html" with form=inv_officer_form stream=productionstream %}
</div> </div>
</div> </div>
</div> </div>
{% endif %} {% endif %}
{% if "can_work_for_stream" in sub_perms %}
<div class="accordion-item">
<h2 class="accordion-header"
id="productionstream-{{ productionstream.id }}-upload-proofs-header">
<button class="accordion-button fs-6 collapsed"
type="button"
data-bs-toggle="collapse"
data-bs-target="#productionstream-{{ productionstream.id }}-upload-proofs"
aria-expanded="false"
aria-controls="productionstream-{{ productionstream.id }}-upload-proofs"
hx-get="{% url 'production:upload_proofs' stream_id=productionstream.id %}"
hx-trigger="click once"
hx-target="#productionstream-{{ productionstream.id }}-upload-proofs-body">Upload Proofs</button>
</h2>
<div id="productionstream-{{ productionstream.id }}-upload-proofs"
class="accordion-collapse collapse"
aria-labelledby="productionstream-{{ productionstream.id }}-upload-proofs-header"
data-bs-parent="#productionstream-{{ productionstream.id }}-actions-accordion">
<div id="productionstream-{{ productionstream.id }}-upload-proofs-body"
class="accordion-body"></div>
</div>
</div>
{% endif %}
<div class="accordion-item">
<h2 class="accordion-header"
id="productionstream-{{ productionstream.id }}-work-log-header">
<button class="accordion-button fs-6 collapsed"
type="button"
data-bs-toggle="collapse"
data-bs-target="#productionstream-{{ productionstream.id }}-work-log"
aria-expanded="false"
aria-controls="productionstream-{{ productionstream.id }}-work-log">Work Log</button>
</h2>
<div id="productionstream-{{ productionstream.id }}-work-log"
class="accordion-collapse collapse"
aria-labelledby="productionstream-{{ productionstream.id }}-work-log-header"
data-bs-parent="#productionstream-{{ productionstream.id }}-actions-accordion">
<div id="productionstream-{{ productionstream.id }}-work-log-body"
class="accordion-body">Work log here</div>
</div>
</div>
{% if perms.scipost.can_draft_publication or perms.scipost.can_publish_accepted_submission %}
<div class="accordion-item">
<h2 class="accordion-header"
id="productionstream-{{ productionstream.id }}-advance-stream-header">
<button class="accordion-button fs-6 collapsed"
type="button"
data-bs-toggle="collapse"
data-bs-target="#productionstream-{{ productionstream.id }}-advance-stream"
aria-expanded="false"
aria-controls="productionstream-{{ productionstream.id }}-advance-stream">
Advance production stream
</button>
</h2>
<div id="productionstream-{{ productionstream.id }}-advance-stream"
class="accordion-collapse collapse"
aria-labelledby="productionstream-{{ productionstream.id }}-advance-stream-header"
data-bs-parent="#productionstream-{{ productionstream.id }}-actions-accordion">
<div id="productionstream-{{ productionstream.id }}-advance-stream-body"
class="accordion-body">
{% if perms.scipost.can_publish_accepted_submission %}
<div class="row">
<div class="col-12 col-sm-auto col-md-12 col-lg-auto h-100 d-none-empty">
<div class="row m-0 d-none-empty">
<button class="btn btn-sm btn-warning text-white"
hx-get="{% url 'production:mark_as_completed' stream_id=productionstream.id %}"
hx-confim="Are you sure you want to mark this stream as completed?"
hx-target="#productionstream-{{ productionstream.id }}-details">
Mark this stream as completed
</button>
</div>
</div>
</div>
{% endif %}
{% if perms.scipost.can_draft_publication and stream.status == 'accepted' %} {% if perms.scipost.can_draft_publication and stream.status == 'accepted' %}
<div class="row"> <div class="row">
<div class="col-12 col-sm-auto col-md-12 col-lg-auto h-100 d-none-empty"> <div class="col-12 col-sm-auto col-md-12 col-lg-auto h-100 d-none-empty">
<div class="row m-0 d-none-empty"> <div class="row m-0 d-none-empty">
<a class="btn btn-sm btn-primary text-white" href="{% url 'journals:create_publication' productionstream.submission.preprint.identifier_w_vn_nr %}"> <a class="btn btn-sm btn-primary text-white"
Draft publication href="{% url 'journals:create_publication' productionstream.submission.preprint.identifier_w_vn_nr %}">
</a> Draft publication
</a>
</div>
</div>
</div>
{% endif %}
</div> </div>
</div> </div>
</div> </div>
{% endif %} {% endif %}
</div>
{% comment %} <h3>Actions</h3>
<ul>
<li>Worklog</li>
{% if "can_work_for_stream" in sub_perms %}
{% if perms.scipost.can_upload_proofs and upload_proofs_form %}
<div class="row">
<div class="col-12 col-sm-auto col-md-12 col-lg-auto h-100 d-none-empty">
<div class="row m-0 d-none-empty">
<button class="btn btn-sm btn-primary text-white" hx-post="{% url 'production:upload_proofs' stream_id=productionstream.id %}" hx-target="#productionstream-{{ productionstream.id }}-details">Upload Proofs</button>
</div>
</div>
</div>
{% endif %}
{% endif %}
<li>Accessibility</li> <li>Accessibility</li>
<li>Send Proofs</li> <li>Send Proofs</li>
</ul> </ul> {% endcomment %}
</div> </div>
<div id="productionstream-{{ productionstream.id }}-event-container" <div id="productionstream-{{ productionstream.id }}-event-container"
......
{% extends 'production/base.html' %} {% load bootstrap %}
{% block breadcrumb_items %}
{{block.super}}
<span class="breadcrumb-item">Upload Proofs</span>
{% endblock %}
{% load bootstrap %} <h3>Proofs</h3>
<ul>
{% for proofs in stream.proofs.all %}
<li class="py-1">
<a href="{% url 'production:proofs' stream_id=stream.id version=proofs.version %}">Version {{ proofs.version }}</a> &middot; <span class="label label-secondary label-sm">{{ proofs.get_status_display }}</span>
<br>
Uploaded by: {{ proofs.uploaded_by.user.first_name }} {{ proofs.uploaded_by.user.last_name }}
<br>
Accessible for authors: {{ proofs.accessible_for_authors|yesno:'<strong>Yes</strong>,No'|safe }}
<br>
{% block content %} {% if perms.scipost.can_run_proofs_by_authors %}
{% if proofs.status == 'uploaded' %}
<strong><span class="text-danger">See details for open actions:</span></strong>
<ul>
<li>
<a href="{% url 'production:proofs' stream_id=stream.id version=proofs.version %}">Accept or decline proofs</a>
</li>
</ul>
{% elif proofs.status == 'accepted_sup' %}
<strong><span class="text-danger">See details for open actions:</span></strong>
<ul>
<li>
<a href="{% url 'production:proofs' stream_id=stream.id version=proofs.version %}">Send proofs to authors</a>
</li>
</ul>
{% endif %}
{% endif %}
</li>
{% empty %}
<li>No Proofs found.</li>
{% endfor %}
</ul>
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<h1 class="highlight">Upload Proofs</h1> <form method="post" enctype="multipart/form-data">
{% include 'submissions/_submission_card_content.html' with submission=stream.submission %} {% csrf_token %}
</div> {{ form|bootstrap_purely_inline }}
<input type="submit" class="btn btn-primary" name="submit" value="Upload">
</form>
</div> </div>
<div class="row"> </div>
<div class="col-12">
<form method="post" enctype="multipart/form-data">
{% csrf_token %}
{{ form|bootstrap }}
<input type="submit" class="btn btn-outline-secondary" name="submit" value="Upload">
</form>
</ul>
</div>
</div>
{% endblock content %}
...@@ -104,12 +104,15 @@ def _hx_productionstream_details_contents(request, productionstream_id): ...@@ -104,12 +104,15 @@ def _hx_productionstream_details_contents(request, productionstream_id):
auto_id=f"productionstream_{productionstream.id}_id_%s", auto_id=f"productionstream_{productionstream.id}_id_%s",
) )
upload_proofs_form = ProofsUploadForm()
context = { context = {
"" "productionstream": productionstream, "" "productionstream": productionstream,
"status_form": status_form, "status_form": status_form,
"supervisor_form": supervisor_form, "supervisor_form": supervisor_form,
"inv_officer_form": inv_officer_form, "inv_officer_form": inv_officer_form,
"prod_officer_form": prod_officer_form, "prod_officer_form": prod_officer_form,
"upload_proofs_form": upload_proofs_form,
} }
return render( return render(
request, request,
......
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