Refactor to make it logic clearer

The logic around what gets shown on the uploads page was hard to follow.
This commit makes three changes to hopefully make it easier:
- remove the passing-around of a string containing the contents of a
  rendered partial
- encapsulate everything in one `show_scheduled_jobs` variable, rather
  than mixing between `scheduled_jobs` and
  `current_service.scheduled_jobs`
- adds a comment to explain why we still render `_jobs.html` even when
  we know we have no jobs
This commit is contained in:
Chris Hill-Scott
2020-02-24 10:59:57 +00:00
parent c20ec82cd2
commit 3dab9c2915
3 changed files with 21 additions and 18 deletions

View File

@@ -9,8 +9,19 @@
{% block maincolumn_content %}
<h1 class="heading-large">Uploads</h1>
<div class="dashboard">
{{ scheduled_jobs|safe }}
{% if jobs or not current_service.scheduled_jobs %}
{% if show_scheduled_jobs %}
{% with hide_heading = True %}
{% include 'views/dashboard/_upcoming.html' %}
{% endwith %}
{% endif %}
{% if jobs %}
{% include 'views/dashboard/_jobs.html' %}
{% endif %}
{% if not jobs and not show_scheduled_jobs %}
{#
`_jobs.html` will show the You have no jobs message when
passed an empty list of jobs
#}
{% include 'views/dashboard/_jobs.html' %}
{% endif %}
{{ previous_next_navigation(prev_page, next_page) }}