SciPost Code Repository

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

add complete production stream action

add create draft publication production stream action
parent e9f543b9
No related branches found
No related tags found
1 merge request!43Polish up new production page
......@@ -24,8 +24,30 @@
{% endif %}
<ul>
<li>Worklog</li>
<li>Completed</li>
<li>Upload proofs</li>
{% 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' %}
<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">
<a class="btn btn-sm btn-primary text-white" href="{% url 'journals:create_publication' productionstream.submission.preprint.identifier_w_vn_nr %}">
Draft publication
</a>
</div>
</div>
</div>
{% endif %}
<li>Accessibility</li>
<li>Send Proofs</li>
</ul>
......
......@@ -825,20 +825,26 @@ class DeleteEventView(DeleteView):
@permission_required("scipost.can_publish_accepted_submission", raise_exception=True)
@transaction.atomic
def mark_as_completed(request, stream_id):
stream = get_object_or_404(ProductionStream.objects.ongoing(), pk=stream_id)
stream.status = constants.PRODUCTION_STREAM_COMPLETED
stream.closed = timezone.now()
stream.save()
productionstream = get_object_or_404(
ProductionStream.objects.ongoing(), pk=stream_id
)
productionstream.status = constants.PRODUCTION_STREAM_COMPLETED
productionstream.closed = timezone.now()
productionstream.save()
prodevent = ProductionEvent(
stream=stream,
production_event = ProductionEvent(
stream=productionstream,
event="status",
comments=" marked the Production Stream as completed.",
noted_by=request.user.production_user,
)
prodevent.save()
messages.success(request, "Stream marked as completed.")
return redirect(reverse("production:production"))
production_event.save()
return HttpResponse(
r"""<summary class="text-white bg-success summary-unstyled p-3">
Production Stream has been marked as completed.
</summary>"""
)
@is_production_user()
......
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