From 2b802a5004e13c8e0b0a97de00b86817a43e0edf Mon Sep 17 00:00:00 2001 From: Jorran de Wit <jorrandewit@outlook.com> Date: Mon, 18 Jun 2018 08:59:49 +0200 Subject: [PATCH] Improvements --- production/models.py | 6 ++ .../templates/production/production.html | 79 ++++++++++++++++--- 2 files changed, 72 insertions(+), 13 deletions(-) diff --git a/production/models.py b/production/models.py index 30b7a3c5b..78b6e7eac 100644 --- a/production/models.py +++ b/production/models.py @@ -82,6 +82,12 @@ class ProductionStream(models.Model): def notification_name(self): return self.submission.arxiv_identifier_w_vn_nr + @property + def latest_activity(self): + if self.events.last(): + return self.events.last().noted_on + return self.closed or self.opened + class ProductionEvent(models.Model): stream = models.ForeignKey(ProductionStream, on_delete=models.CASCADE, related_name='events') diff --git a/production/templates/production/production.html b/production/templates/production/production.html index 95b8e0134..05e66f873 100644 --- a/production/templates/production/production.html +++ b/production/templates/production/production.html @@ -23,6 +23,11 @@ <div class="tab-nav-container"> <div class="tab-nav-inner"> <ul class="nav btn-group personal-page-nav" role="tablist"> + {% if perms.scipost.can_view_all_production_streams %} + <li class="nav-item btn btn-outline-secondary"> + <a href="#summary" class="nav-link" data-toggle="tab">Summary</a> + </li> + {% endif %} <li class="nav-item btn btn-outline-secondary"> <a href="#streams" class="nav-link active" data-toggle="tab">{{ perms.scipost.can_assign_production_officer|yesno:"Streams,My Streams" }}</a> </li> @@ -40,8 +45,68 @@ </div> </div> - <div class="tab-content"> + {% if perms.scipost.can_view_all_production_streams %} + <div class="tab-pane" id="summary" role="tabpanel"> + <div class="row"> + <div class="col-12"> + <h2 class="highlight">Streams summary</h2> + <table class="table"> + <thead> + <tr> + <th>Submission</th> + <th>Status</th> + <th class="py-1"> + Latest activity + <br> + Submission accepted + </th> + <th>Has supervisor</th> + <th>Has officer</th> + </tr> + </thead> + <tbody> + {% for stream in streams %} + <tr> + <td> + <a href="{{ stream.get_absolute_url }}">{{ stream.submission.title }}</a> + <br> + by {{ stream.submission.author_list }} + </td> + <td> + <div class="label label-{% if stream.status == 'initiated' %}outline-danger{% else %}secondary{% endif %} label-sm">{{ stream.get_status_display }}</div> + </td> + <td> + {{ stream.latest_activity|timesince }} ago + <br> + <span class="text-muted">{{ stream.opened|timesince }} ago</span> + </td> + <td> + {% if stream.supervisor %} + <i class="fa fa-check text-success"></i> + {{ stream.supervisor }} + {% else %} + <i class="fa fa-times text-danger"></i> + {% endif %} + </td> + <td> + {% if stream.officer %} + <i class="fa fa-check text-success"></i> + {{ stream.officer }} + {% else %} + <i class="fa fa-times text-danger"></i> + {% endif %} + </td> + </tr> + {% endfor %} + </tbody> + </table> + </div> + </div> + </div> + {% endif %} + + <div class="tab-pane active" id="streams" role="tabpanel"> <div class="row"> <div class="col-12"> @@ -52,18 +117,6 @@ <div class="row"> <div class="col-6"> - {% if perms.scipost.can_assign_production_officer %} - <h3>Stream statuses</h3> - <ul> - {% for stream in streams %} - <li class="pb-2"> - <div><strong>{{ stream.submission.title }}</strong></div> - <div class="label label-{% if stream.status == 'initiated' %}outline-danger{% else %}secondary{% endif %} label-sm">{{ stream.get_status_display }}</div> - </li> - {% endfor %} - </ul> - <hr> - {% endif %} <ul class="list-unstyled" data-target="active-list"> {% for stream in streams %} <li class="px-2 py-1"> -- GitLab