From a9c2e26c72ab04a776853808a5e1ae2d81e89547 Mon Sep 17 00:00:00 2001
From: Todd Dembrey <todd.dembrey@torchbox.com>
Date: Thu, 24 Jan 2019 10:15:21 +0000
Subject: [PATCH] Make sure we display the no submissions message nicely

---
 opentech/apply/funds/tables.py                        |  2 ++
 .../apply/funds/templates/funds/tables/table.html     |  4 ++++
 .../sass/apply/components/_all-submissions-table.scss | 11 +++++++++++
 3 files changed, 17 insertions(+)

diff --git a/opentech/apply/funds/tables.py b/opentech/apply/funds/tables.py
index 14bdc46d4..445651053 100644
--- a/opentech/apply/funds/tables.py
+++ b/opentech/apply/funds/tables.py
@@ -5,6 +5,7 @@ from django.contrib.auth import get_user_model
 from django.db.models import F, Q
 from django.utils.html import format_html
 from django.utils.text import mark_safe, slugify
+from django.utils.translation import ugettext_lazy as _
 
 import django_filters as filters
 import django_tables2 as tables
@@ -49,6 +50,7 @@ class SubmissionsTable(tables.Table):
             'data-record-id': lambda record: record.id,
         }
         attrs = {'class': 'all-submissions-table'}
+        empty_text = _('No submissions available')
 
     def render_user(self, value):
         return value.get_full_name()
diff --git a/opentech/apply/funds/templates/funds/tables/table.html b/opentech/apply/funds/templates/funds/tables/table.html
index a6f7eea2d..cb3095fc7 100644
--- a/opentech/apply/funds/templates/funds/tables/table.html
+++ b/opentech/apply/funds/templates/funds/tables/table.html
@@ -71,3 +71,7 @@
     {% endif %}
 
 {% endblock %}
+
+{% block table.tbody.empty_text %}
+<tr class="all-submissions-table__empty"><td colspan="{{ table.columns|length }}">{{ table.empty_text }}</td></tr>
+{% endblock table.tbody.empty_text %}
diff --git a/opentech/static_src/src/sass/apply/components/_all-submissions-table.scss b/opentech/static_src/src/sass/apply/components/_all-submissions-table.scss
index b06e88f91..fae5401c5 100644
--- a/opentech/static_src/src/sass/apply/components/_all-submissions-table.scss
+++ b/opentech/static_src/src/sass/apply/components/_all-submissions-table.scss
@@ -224,6 +224,17 @@
         }
     }
 
+    &__empty {
+        text-align: center;
+        vertical-align: middle;
+        font-weight: $weight--bold;
+        color: $color--default;
+
+        td {
+            padding: 20px;
+        }
+    }
+
     &__toggle {
         padding: 5px 0 5px 5px;
     }
-- 
GitLab