SciPost Code Repository

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

allow senior fellows to view fellowship details

fixes #135
parent 2337fc48
No related branches found
No related tags found
No related merge requests found
{% extends 'colleges/base.html' %}
{% load user_groups %}
{% block breadcrumb_items %}
{{ block.super }}
<a href="{% url 'colleges:colleges' %}" class="breadcrumb-item">Colleges</a>
......@@ -12,6 +14,8 @@
{% endblock pagetitle %}
{% block content %}
{% is_ed_admin request.user as is_ed_admin %}
<h1 class="highlight">Fellowship details</h1>
<h2 class="text-primary">{{ fellowship }}</h2>
<br />
......@@ -89,14 +93,17 @@
</div>
<div class="col-md-6">
<div class="adminLinks">
<h3>Admin actions</h3>
<ul>
<li>
After initial setup: <a href="{% url 'colleges:fellowship_email_start' pk=fellowship.id %}">send Fellowship start email</a>
</li>
</ul>
</div>
{% if is_ed_admin %}
<div class="adminLinks">
<h3>Admin actions</h3>
<ul>
<li>
After initial setup: <a href="{% url 'colleges:fellowship_email_start' pk=fellowship.id %}">send Fellowship start email</a>
</li>
</ul>
</div>
{% endif %}
<h3>All fellowships of this fellow</h3>
......@@ -248,42 +255,44 @@
</div>
</div>
<h3 class="highlight">Pool for this Fellowship</h3>
<table class="table table-hover">
<thead>
<tr>
<th>Submission</th>
<th colspan="2">Status</th>
</tr>
</thead>
<tbody>
{% for submission in fellowship.pool.all %}
{% if is_ed_admin %}
<h3 class="highlight">Pool for this Fellowship</h3>
<table class="table table-hover">
<thead>
<tr>
<td>
<a href="{{ submission.get_absolute_url }}">{{ submission.preprint.identifier_w_vn_nr }}, {{ submission.title|truncatechars:50 }}</a>
</td>
<td>{{ submission.get_status_display }}</td>
<td>
<th>Submission</th>
<th colspan="2">Status</th>
</tr>
</thead>
<tbody>
{% if submission.editor_in_charge == fellowship.contributor %}
<strong>Fellow is Editor-in-charge</strong>
{% else %}
<a class="text-danger"
href="{% url 'colleges:fellowship_remove_submission' fellowship.id submission.preprint.identifier_w_vn_nr %}">Remove from this Fellowship's pool</a>
{% endif %}
{% for submission in fellowship.pool.all %}
<tr>
<td>
<a href="{{ submission.get_absolute_url }}">{{ submission.preprint.identifier_w_vn_nr }}, {{ submission.title|truncatechars:50 }}</a>
</td>
<td>{{ submission.get_status_display }}</td>
<td>
</td>
</tr>
{% endfor %}
{% if submission.editor_in_charge == fellowship.contributor %}
<strong>Fellow is Editor-in-charge</strong>
{% else %}
<a class="text-danger"
href="{% url 'colleges:fellowship_remove_submission' fellowship.id submission.preprint.identifier_w_vn_nr %}">Remove from this Fellowship's pool</a>
{% endif %}
</td>
</tr>
{% endfor %}
<tr>
<td colspan="3" class="py-3 text-center">
<a href="{% url 'colleges:fellowship_add_submission' fellowship.id %}">Add Submission to this Fellowship's pool</a>
</td>
</tr>
</tbody>
</table>
<tr>
<td colspan="3" class="py-3 text-center">
<a href="{% url 'colleges:fellowship_add_submission' fellowship.id %}">Add Submission to this Fellowship's pool</a>
</td>
</tr>
</tbody>
</table>
{% endif %}
{% endblock %}
......@@ -7,6 +7,7 @@ import datetime
from dal import autocomplete
from django.contrib import messages
from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib.auth.models import Group
from django.contrib.auth.decorators import (
login_required,
......@@ -201,8 +202,7 @@ class FellowshipUpdateView(PermissionsMixin, UpdateView):
template_name = "colleges/fellowship_form.html"
class FellowshipDetailView(PermissionsMixin, DetailView):
permission_required = "scipost.can_manage_college_composition"
class FellowshipDetailView(LoginRequiredMixin, DetailView):
model = Fellowship
def get_queryset(self):
......@@ -212,6 +212,21 @@ class FellowshipDetailView(PermissionsMixin, DetailView):
)
return queryset
def get(self, request, *args, **kwargs):
fellow = self.get_object()
request_fellow = request.user.contributor.session_fellowship(request)
# Return the admin fellowship page if edadmin or senior fellow in the fellow's college
# or follow through to the contributor object instead.
if not (
request.user.contributor.is_scipost_admin
or request.user.contributor.is_ed_admin
or (request_fellow.senior and (request_fellow.college == fellow.college))
):
return redirect(fellow.contributor.get_absolute_url())
else:
return super().get(request, *args, **kwargs)
class FellowshipListView(PermissionsMixin, PaginationMixin, ListView):
"""
......
......@@ -51,7 +51,7 @@
{% for fellowship in fellowships.all %}
<tr>
<td>{{ fellowship.contributor }}</td>
<td><a href="{{ fellowship.get_absolute_url }}">{{ fellowship.contributor }}</a></td>
<td>
{% for specialty in fellowship.contributor.profile.specialties.all %}
<div class="single d-inline" data-specialty="{{ specialty.slug }}" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{ specialty }}">{{ specialty.code }}
......
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