From d213e2cc67b03c96adf3668399bf25546becdd64 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Wed, 8 Jun 2016 13:41:02 +0100 Subject: [PATCH] Give each row in a table a heading MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The first columns of our tables are always headings for the subsequent columns, even though they go horizontally. HTML has the `` tag, which doesn’t just have to be used for headings along the top of a table. So this commit changes the first column to be a ``. This then allows us to style these elements differently, specifically making them 50% wide. This makes pages like the dashboard align more nicely. --- app/assets/stylesheets/components/table.scss | 15 +++++++++++++++ app/assets/stylesheets/views/dashboard.scss | 3 +-- app/templates/components/table.html | 12 ++++++++++++ app/templates/views/dashboard/_jobs.html | 16 ++++++++-------- app/templates/views/notifications.html | 10 +++++----- 5 files changed, 41 insertions(+), 15 deletions(-) diff --git a/app/assets/stylesheets/components/table.scss b/app/assets/stylesheets/components/table.scss index efe70d644..7e6f0c8f8 100644 --- a/app/assets/stylesheets/components/table.scss +++ b/app/assets/stylesheets/components/table.scss @@ -1,5 +1,6 @@ .table { margin-bottom: $gutter; + width: 100%; } .table-heading { @@ -13,6 +14,16 @@ } } +.table-row { + th { + width: 52.5%; + + a { + max-height: 1.25em; + } + } +} + %table-field, .table-field { @@ -77,6 +88,10 @@ width: 15px; } + &-date { + white-space: nowrap; + } + p { margin: 0 0 5px 0; } diff --git a/app/assets/stylesheets/views/dashboard.scss b/app/assets/stylesheets/views/dashboard.scss index 1f4d2022e..04c2cc622 100644 --- a/app/assets/stylesheets/views/dashboard.scss +++ b/app/assets/stylesheets/views/dashboard.scss @@ -3,8 +3,7 @@ table { th { @include core-16; - padding-top: 0; - border: 0; + border-bottom: 0; } td { diff --git a/app/templates/components/table.html b/app/templates/components/table.html index 5f96508ce..95ba0264f 100644 --- a/app/templates/components/table.html +++ b/app/templates/components/table.html @@ -55,12 +55,24 @@ {%- endmacro %} +{% macro row_heading() -%} + + {{ caller() }} + +{%- endmacro %} + {% macro index_field(text) -%} {{ text }} {%- endmacro %} +{% macro date_field(text) -%} + + {{ text }} + +{% endmacro %} + {% macro text_field(text) -%} {% call field() %} {{ text }} diff --git a/app/templates/views/dashboard/_jobs.html b/app/templates/views/dashboard/_jobs.html index 26dc0acca..4b21598f8 100644 --- a/app/templates/views/dashboard/_jobs.html +++ b/app/templates/views/dashboard/_jobs.html @@ -1,4 +1,4 @@ -{% from "components/table.html" import list_table, field, right_aligned_field_heading %} +{% from "components/table.html" import list_table, field, right_aligned_field_heading, row_heading %} {% from "components/big-number.html" import big_number %} {% call(item, row_number) list_table( @@ -8,28 +8,28 @@ empty_message='You haven’t sent any batch messages yet', field_headings=[ 'File', - right_aligned_field_heading('Sending'), - right_aligned_field_heading('Delivered'), - right_aligned_field_heading('Failed') + 'Sending', + 'Delivered', + 'Failed' ], field_headings_visible=True ) %} - {% call field() %} + {% call row_heading() %}
{{ item.original_file_name }} Uploaded {{ item.created_at|format_datetime_short }}
{{ item.to }}

{% if item.job %} - From {{ item.job.original_file_name }} + From {{ item.job.original_file_name }} {% else %} - {{ item.template.name }} + {{ item.template.name }} from an API call {% endif %}