From a86f036f2b70a22a28e200bb6f3c5534d9ba4a69 Mon Sep 17 00:00:00 2001 From: Jorran de Wit <jorrandewit@outlook.com> Date: Sun, 25 Jun 2017 15:10:26 +0200 Subject: [PATCH] Set up empty compiling views --- .../submissions/reports_accepted_list.html | 38 ++++++++++--------- submissions/urls.py | 2 + submissions/views.py | 11 +++++- 3 files changed, 33 insertions(+), 18 deletions(-) diff --git a/submissions/templates/submissions/reports_accepted_list.html b/submissions/templates/submissions/reports_accepted_list.html index 822c2f811..704336443 100644 --- a/submissions/templates/submissions/reports_accepted_list.html +++ b/submissions/templates/submissions/reports_accepted_list.html @@ -26,15 +26,34 @@ <th>Submission</th> <th>Report author</th> <th>Has PDF</th> + <th>Action</th> </tr> </thead> <tbody> {% for report in reports %} <tr{% if not report.pdf_report %} class="table-danger"{% endif %}> <td>{{report.report_nr}}</td> - <td><a href="{{report.submission.get_absolute_url}}">{{report.submission.arxiv_identifier_w_vn_nr}}</a></td> + <td><a href="{{report.get_absolute_url}}">{{report.submission.arxiv_identifier_w_vn_nr}}</a></td> <td>{% if report.anonymous %}<em>Anonymous</em>{% else %}{{report.author}}{% endif %}</td> - <td>{{report.pdf_report|yesno:"Yes,No"}}</td> + <td> + {{report.pdf_report|yesno:"Yes,No"}} + {% if report.pdf_report %} + · <a href="{% url 'submissions:report_detail_pdf' report.submission.arxiv_identifier_w_vn_nr report.report_nr %}" target="_blank">Download</a> + {% endif %} + </td> + <td> + <form action="{% url 'submissions:report_pdf_compile' report.id %}" method="POST" class="d-inline-block"> + {% csrf_token %} + <input type="submit" class="btn btn-sm btn-secondary" value="{% if report.pdf_report %}Recompile{% else %}Compile{% endif %} report"> + </form> + {% if report.pdf_report %} + + <form method="POST" class="d-inline-block"> + {% csrf_token %} + <input type="submit" class="btn btn-sm btn-danger" value="Remove pdf"> + </form> + {% endif %} + </td> </tr> {% endfor %} </tbody> @@ -42,19 +61,4 @@ </div> </div> -{% comment %} -<div class="row"> - <div class="col-12"> - <form method="post"> - {% csrf_token %} - {{ form|bootstrap }} - <input class="btn btn-primary" type="submit" value="Submit"/> - <div class="my-4"> - <em>By clicking on Submit, you state that you abide by the <a href="{% url 'journals:journals_terms_and_conditions' %}#referee_code_of_conduct">referee code of conduct</a>.</em> - </div> - </form> - </div> -</div> -{% endcomment %} - {% endblock %} diff --git a/submissions/urls.py b/submissions/urls.py index d83b666b0..aacc096c6 100644 --- a/submissions/urls.py +++ b/submissions/urls.py @@ -79,6 +79,8 @@ urlpatterns = [ views.submit_report, name='submit_report'), url(r'^reports/vet_submitted$', views.vet_submitted_reports, name='vet_submitted_reports'), url(r'^reports/list$', views.reports_accepted_list, name='reports_accepted_list'), + url(r'^reports/(?P<report_id>[0-9]+)/compile$', + views.report_pdf_compile, name='report_pdf_compile'), # Voting url(r'^prepare_for_voting/(?P<rec_id>[0-9]+)$', views.prepare_for_voting, name='prepare_for_voting'), url(r'^vote_on_rec/(?P<rec_id>[0-9]+)$', views.vote_on_rec, name='vote_on_rec'), diff --git a/submissions/views.py b/submissions/views.py index 1be45d016..4dc7746fc 100644 --- a/submissions/views.py +++ b/submissions/views.py @@ -11,6 +11,7 @@ from django.shortcuts import get_object_or_404, render, redirect from django.template import Template, Context from django.utils import timezone from django.utils.decorators import method_decorator +from django.views.decorators.http import require_POST from guardian.decorators import permission_required_or_403 from guardian.shortcuts import assign_perm @@ -239,6 +240,14 @@ def reports_accepted_list(request): return render(request, 'submissions/reports_accepted_list.html', context) +@permission_required('scipost.can_manage_reports', raise_exception=True) +@require_POST +def report_pdf_compile(request, report_id): + report = get_object_or_404(Report.objects.accepted(), id=report_id) + # COMPILE PDF HERE + messages.success(request, '<h3>Compiling complete</h3>Please download and check the pdf.') + return redirect(reverse('submissions:reports_accepted_list')) + ###################### # Editorial workflow # ###################### @@ -429,7 +438,7 @@ def accept_or_decline_assignment_ack(request, assignment_id): @login_required -@permission_required('scipost.can_take_charge_of_submissions', raise_exception=True) +@permission_required('sci.can_take_charge_of_submissions', raise_exception=True) @transaction.atomic def volunteer_as_EIC(request, arxiv_identifier_w_vn_nr): """ -- GitLab