From ba0c9ac6c11727d9121b0a3b7fc145bbf66a86ac Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Tue, 19 Jan 2016 11:15:00 +0000 Subject: [PATCH] Remove placeholder logs of notifications sent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From the: - dashboard - activity page This info will be confusing for users at the hack day, because it will say they’ve already sent messages when they first sign up. This involved changing the table macro to have a nice ‘no rows’ message. --- app/assets/stylesheets/components/table.scss | 7 ++++++ app/main/views/dashboard.py | 2 +- app/main/views/jobs.py | 2 +- app/templates/components/table.html | 23 ++++++++++---------- app/templates/views/jobs.html | 1 + app/templates/views/service_dashboard.html | 8 ++----- app/templates/views/styleguide.html | 15 +++++++++++++ tests/app/main/views/test_dashboard.py | 3 +-- tests/app/main/views/test_jobs.py | 3 +-- 9 files changed, 41 insertions(+), 23 deletions(-) diff --git a/app/assets/stylesheets/components/table.scss b/app/assets/stylesheets/components/table.scss index 37478ad6d..ed749b6e3 100644 --- a/app/assets/stylesheets/components/table.scss +++ b/app/assets/stylesheets/components/table.scss @@ -41,3 +41,10 @@ @extend .table-field; text-align: right; } + +.table-empty-message { + @include core-16; + color: $secondary-text-colour; + border-bottom: 1px solid $border-colour; + padding: 5px 0 8px 0; +} diff --git a/app/main/views/dashboard.py b/app/main/views/dashboard.py index 1c8842d4a..419e2cca5 100644 --- a/app/main/views/dashboard.py +++ b/app/main/views/dashboard.py @@ -19,6 +19,6 @@ def service_dashboard(service_id): return render_template( 'views/service_dashboard.html', jobs=jobs, - free_text_messages_remaining=560, + free_text_messages_remaining='25,000', spent_this_month='0.00', service_id=service_id) diff --git a/app/main/views/jobs.py b/app/main/views/jobs.py index c548cb44c..ae653d405 100644 --- a/app/main/views/jobs.py +++ b/app/main/views/jobs.py @@ -50,7 +50,7 @@ messages = [ def view_jobs(service_id): return render_template( 'views/jobs.html', - jobs=jobs, + jobs=[], # use `jobs` for placeholder data service_id=service_id ) diff --git a/app/templates/components/table.html b/app/templates/components/table.html index bfa53232d..fb41a6aa7 100644 --- a/app/templates/components/table.html +++ b/app/templates/components/table.html @@ -23,20 +23,21 @@ {%- endmacro %} {% macro list_table(items, caption='', empty_message='', field_headings=[], field_headings_visible=True, caption_visible=True) -%} - {% if items %} - {% set parent_caller = caller %} - {% call mapping_table(caption, field_headings, field_headings_visible, caption_visible) %} - {% for item in items %} - {% call row() %} - {{ parent_caller(item) }} - {% endcall %} - {% endfor %} - {%- endcall %} - {% else %} -

+ + {% set parent_caller = caller %} + {% call mapping_table(caption, field_headings, field_headings_visible, caption_visible) %} + {% for item in items %} + {% call row() %} + {{ parent_caller(item) }} + {% endcall %} + {% endfor %} + {%- endcall %} + {% if not items %} +

{{ empty_message }}

{% endif %} + {%- endmacro %} {% macro row() -%} diff --git a/app/templates/views/jobs.html b/app/templates/views/jobs.html index 0879fee7a..6d321c433 100644 --- a/app/templates/views/jobs.html +++ b/app/templates/views/jobs.html @@ -13,6 +13,7 @@ GOV.UK Notify | Notifications activity jobs, caption="Recent activity", caption_visible=False, + empty_message='You haven’t sent any notifications yet', field_headings=['Job', 'File', 'Time', 'Status'] ) %} {% call field() %} diff --git a/app/templates/views/service_dashboard.html b/app/templates/views/service_dashboard.html index 9e5510795..9ed330140 100644 --- a/app/templates/views/service_dashboard.html +++ b/app/templates/views/service_dashboard.html @@ -24,9 +24,9 @@ {% call(item) list_table( - jobs[:3], + [], caption="Recent text messages", - empty_message="No recent text messages", + empty_message='You haven’t sent any text messages yet', field_headings=['Job', 'File', 'Time', 'Status'] ) %} {% call field() %} @@ -42,9 +42,5 @@ {{ item.status }} {% endcall %} {% endcall %} -

- See all notifications activity -

- {% endblock %} diff --git a/app/templates/views/styleguide.html b/app/templates/views/styleguide.html index 2231b1173..40669cbbf 100644 --- a/app/templates/views/styleguide.html +++ b/app/templates/views/styleguide.html @@ -148,6 +148,21 @@ {% endcall %} {% endcall %} + {% call(item) list_table( + [], + caption='Jobs', + field_headings=['Job', 'Time'], + caption_visible=True, + empty_message='You haven’t scheduled any jobs yet' + ) %} + {% call field() %} + {{ item.job }} + {% endcall %} + {% call field() %} + {{ item.time }} + {% endcall %} + {% endcall %} +

Textbox

{{ textbox(form.username) }} {{ textbox(form.password) }} diff --git a/tests/app/main/views/test_dashboard.py b/tests/app/main/views/test_dashboard.py index e0d163f99..4af4b63ac 100644 --- a/tests/app/main/views/test_dashboard.py +++ b/tests/app/main/views/test_dashboard.py @@ -13,5 +13,4 @@ def test_should_show_recent_jobs_on_dashboard(app_, response = client.get(url_for('main.service_dashboard', service_id=123)) assert response.status_code == 200 - assert 'Test message 1' in response.get_data(as_text=True) - assert 'Asdfgg' in response.get_data(as_text=True) + assert 'You haven’t sent any text messages yet' in response.get_data(as_text=True) diff --git a/tests/app/main/views/test_jobs.py b/tests/app/main/views/test_jobs.py index 039d47dbf..aa900dd8b 100644 --- a/tests/app/main/views/test_jobs.py +++ b/tests/app/main/views/test_jobs.py @@ -11,8 +11,7 @@ def test_should_return_list_of_all_jobs(app_, db_, db_session, service_one): response = client.get(url_for('main.view_jobs', service_id=101)) assert response.status_code == 200 - assert 'Test message 1' in response.get_data(as_text=True) - assert 'Final reminder' in response.get_data(as_text=True) + assert 'You haven’t sent any notifications yet' in response.get_data(as_text=True) def test_should_show_page_for_one_job(app_, db_, db_session, service_one):