diff --git a/scipost/management/commands/add_groups_and_permissions.py b/scipost/management/commands/add_groups_and_permissions.py index ef95e885debea981eff40c8f073b9cd336ad6148..a2459c66f6c19abe466410911a372e06d94e666e 100644 --- a/scipost/management/commands/add_groups_and_permissions.py +++ b/scipost/management/commands/add_groups_and_permissions.py @@ -156,6 +156,12 @@ class Command(BaseCommand): name='Can oversee refereeing', content_type=content_type) + # Reports + can_manage_reports, created = Permission.objects.get_or_create( + codename='can_manage_reports', + name='Can manage Reports', + content_type=content_type) + # Voting can_prepare_recommendations_for_voting, created = Permission.objects.get_or_create( codename='can_prepare_recommendations_for_voting', @@ -206,6 +212,7 @@ class Command(BaseCommand): can_view_production, can_attend_VGMs, can_manage_mailchimp, + can_manage_reports, ]) AdvisoryBoard.permissions.set([ can_manage_registration_invitations, diff --git a/scipost/templates/scipost/personal_page.html b/scipost/templates/scipost/personal_page.html index 32fcb4a45dd902f6925bd7211eb46b5be3e1cece..1447f92185da91b42f1cdeb9d11c544f88a7eb4e 100644 --- a/scipost/templates/scipost/personal_page.html +++ b/scipost/templates/scipost/personal_page.html @@ -260,6 +260,13 @@ {% endif %} </ul> + {% if perms.scipost.can_manage_reports %} + <h3>Reports</h3> + <ul> + <li><a href="{% url 'submissions:reports_accepted_list' %}">Accepted Reports</a>{% if nr_reports_without_pdf %} ({{nr_reports_without_pdf}} unfinished){% endif %}</li> + </ul> + {% endif %} + {% if perms.scipost.can_attend_VGMs %} <h3>Virtual General Meetings</h3> <ul> diff --git a/scipost/views.py b/scipost/views.py index 229123403a324cc62918110819e7349e0045dc0b..629438ab2846f013feff52ad3582f3e2ce315b6a 100644 --- a/scipost/views.py +++ b/scipost/views.py @@ -893,6 +893,11 @@ def personal_page(request): 'own_comments': own_comments, 'own_authorreplies': own_authorreplies, } + # Only add variables if user has right permission + if request.user.has_perm('scipost.can_manage_reports'): + context['nr_reports_without_pdf'] = (Report.objects.accepted() + .filter(pdf_report='').count()) + return render(request, 'scipost/personal_page.html', context) diff --git a/submissions/templates/submissions/reports_accepted_list.html b/submissions/templates/submissions/reports_accepted_list.html new file mode 100644 index 0000000000000000000000000000000000000000..822c2f811caa34bb74245e14c7563afaf2b82775 --- /dev/null +++ b/submissions/templates/submissions/reports_accepted_list.html @@ -0,0 +1,60 @@ +{% extends 'scipost/_personal_page_base.html' %} + +{% block breadcrumb_items %} + {{block.super}} + <span class="breadcrumb-item">Accepted Reports</span> +{% endblock %} + +{% load bootstrap %} + +{% block pagetitle %}: Accepted Reports{% endblock pagetitle %} + +{% block content %} + +<div class="row"> + <div class="col-12"> + <h1 class="highlight">Accepted Reports</h1> + </div> +</div> + +<div class="row"> + <div class="col-12"> + <table class="table"> + <thead> + <tr> + <th>Report nr. of Submission</th> + <th>Submission</th> + <th>Report author</th> + <th>Has PDF</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>{% if report.anonymous %}<em>Anonymous</em>{% else %}{{report.author}}{% endif %}</td> + <td>{{report.pdf_report|yesno:"Yes,No"}}</td> + </tr> + {% endfor %} + </tbody> + </table> + </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 2b9375939bdaff247403a7be65f3d69ad8fa7085..d83b666b0befd7b00d19702984aeaa7dd5516b7a 100644 --- a/submissions/urls.py +++ b/submissions/urls.py @@ -75,9 +75,10 @@ urlpatterns = [ url(r'^cycle/(?P<arxiv_identifier_w_vn_nr>[0-9]{4,}.[0-9]{5,}v[0-9]{1,2})/submit$', views.cycle_form_submit, name='cycle_confirmation'), # Reports - url(r'^submit_report/(?P<arxiv_identifier_w_vn_nr>[0-9]{4,}.[0-9]{5,}v[0-9]{1,2})$', + url(r'^(?P<arxiv_identifier_w_vn_nr>[0-9]{4,}.[0-9]{5,}v[0-9]{1,2})/reports/submit$', views.submit_report, name='submit_report'), - url(r'^vet_submitted_reports$', views.vet_submitted_reports, name='vet_submitted_reports'), + 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'), # 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 5a84f528ba13b0af22b029e7ffe1331deb834327..1be45d01675099f909954ff260a272e195d46184 100644 --- a/submissions/views.py +++ b/submissions/views.py @@ -229,6 +229,16 @@ def report_detail_pdf(request, arxiv_identifier_w_vn_nr, report_nr): return response +@permission_required('scipost.can_manage_reports', raise_exception=True) +def reports_accepted_list(request): + reports = (Report.objects.accepted() + .order_by('pdf_report', 'submission').prefetch_related('submission')) + context = { + 'reports': reports + } + return render(request, 'submissions/reports_accepted_list.html', context) + + ###################### # Editorial workflow # ######################