From aa48c875acf6b18270de73e26d1f68db3c61f9ce Mon Sep 17 00:00:00 2001 From: Todd Dembrey <todd.dembrey@torchbox.com> Date: Wed, 13 Nov 2019 12:45:53 +0000 Subject: [PATCH] Update the report detail page to match the designs --- hypha/apply/projects/models.py | 18 +++++ .../application_projects/report_detail.html | 78 ++++++++++++++----- .../src/sass/apply/components/_sidebar.scss | 1 - 3 files changed, 75 insertions(+), 22 deletions(-) diff --git a/hypha/apply/projects/models.py b/hypha/apply/projects/models.py index 060a684a1..18925cd06 100644 --- a/hypha/apply/projects/models.py +++ b/hypha/apply/projects/models.py @@ -782,6 +782,24 @@ class Report(models.Model): def get_absolute_url(self): return reverse('apply:projects:reports:detail', kwargs={'pk': self.pk}) + @property + def previous(self): + return Report.objects.submitted().filter( + project=self.project_id, + end_date__lt=self.end_date, + ).exclude( + pk=self.pk, + ).first() + + @property + def next(self): + return Report.objects.submitted().filter( + project=self.project_id, + end_date__gt=self.end_date, + ).exclude( + pk=self.pk, + ).order_by('end_date').first() + @property def past_due(self): return timezone.now().date() > self.end_date diff --git a/hypha/apply/projects/templates/application_projects/report_detail.html b/hypha/apply/projects/templates/application_projects/report_detail.html index ccd9ae0c9..1a81d4dce 100644 --- a/hypha/apply/projects/templates/application_projects/report_detail.html +++ b/hypha/apply/projects/templates/application_projects/report_detail.html @@ -14,31 +14,67 @@ </div> </div> - <div class="wrapper wrapper--form"> - {% if report.skipped %} - <h2>Report Skipped</h2> - {% else %} - <h3>Public</h3> - <div class="rich-text"> - {{ object.current.public_content|bleach|safe }} + <div class="wrapper wrapper--sidebar wrapper--outer-space-medium"> + <div class="wrapper--sidebar--inner"> + <div class="alert"> + <svg class="alert__icon"><use xlink:href="#exclamation-point"></use></svg> + <p class="alert__text">This report is for the period {{ report.start_date }} to {{ report.end_date }}</p> </div> - <h3>Private</h3> - <div class="rich-text"> - {{ object.current.private_content|bleach|safe }} - </div> - {% for file in object.current.files.all %} - {% if forloop.first %} - <h4>Files</h4> - <ul> - {% endif %} + <div class="card card--solid"> + {% if report.skipped %} + <h2>Report Skipped</h2> + {% else %} + <h4>Public Report</h4> + <div class="rich-text"> + {{ object.current.public_content|bleach|safe }} + </div> + + <h4>Private Report</h4> + <div class="rich-text"> + {{ object.current.private_content|bleach|safe }} + </div> + {% for file in object.current.files.all %} + {% if forloop.first %} + <h4>Attachements</h4> + <ul> + {% endif %} - <li><a href="{{ file.get_absolute_url }}">{{ file.filename }}</a></li> + <li><a href="{{ file.get_absolute_url }}">{{ file.filename }}</a></li> - {% if forloop.last %} - </ul> + {% if forloop.last %} + </ul> + {% endif %} + {% endfor %} {% endif %} - {% endfor %} - {% endif %} + </div> + </div> + <aside class="sidebar"> + {% if request.user.is_apply_staff or report.previous or report.next %} + <div class="sidebar__inner sidebar__inner--light-blue sidebar__inner--actions"> + {% if request.user.is_apply_staff %} + <a + class="button button--bottom-space button--primary button--full-width" + href="{% url "apply:projects:reports:edit" pk=report.pk %}"> + Edit + </a> + {% endif %} + {% if report.previous %} + <a + class="button button--bottom-space button--primary button--full-width" + href="{% url "apply:projects:reports:detail" pk=report.previous.pk %}"> + View previous report + </a> + {% endif %} + {% if report.next %} + <a + class="button button--bottom-space button--primary button--full-width" + href="{% url "apply:projects:reports:detail" pk=report.next.pk %}"> + View next report + </a> + {% endif %} + </div> + {% endif %} + </aside> </div> {% endblock %} diff --git a/hypha/static_src/src/sass/apply/components/_sidebar.scss b/hypha/static_src/src/sass/apply/components/_sidebar.scss index 3b95801fd..fb6ba9ed6 100644 --- a/hypha/static_src/src/sass/apply/components/_sidebar.scss +++ b/hypha/static_src/src/sass/apply/components/_sidebar.scss @@ -1,7 +1,6 @@ .sidebar { @include media-query(tablet-portrait) { width: 345px; - margin: 20px 0 0; } &__inner { -- GitLab