From bc1899e8c08fa09dbafca0f91f03754786e600a0 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Tue, 23 Feb 2016 14:58:49 +0000 Subject: [PATCH] Make email pattern work in new context MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The email pattern looked a bit shonky when displayed in a narrower column. This commit fixes it by making the email’s metadata (eg subject, from) into a table, which it sort of is. This means that it is more flexible about the size of container in which it sits. --- .../stylesheets/components/email-message.scss | 23 ++++++++-- .../stylesheets/components/sms-message.scss | 2 +- app/main/views/templates.py | 2 +- app/templates/components/email-message.html | 44 +++++++++---------- .../views/choose-email-template.html | 2 +- 5 files changed, 44 insertions(+), 29 deletions(-) diff --git a/app/assets/stylesheets/components/email-message.scss b/app/assets/stylesheets/components/email-message.scss index b4771841a..860b3d99e 100644 --- a/app/assets/stylesheets/components/email-message.scss +++ b/app/assets/stylesheets/components/email-message.scss @@ -7,9 +7,26 @@ margin: 20px 0 10px 0; } - &-subject, - &-from { - margin: 10px 0; + &-meta { + + @include core-19; + margin: 0; + + td, + th { + @include core-19; + border-bottom: 0; + border-top: 1px solid $border-colour; + } + + th { + color: $secondary-text-colour; + } + + td { + width: 99%; + } + } &-from { diff --git a/app/assets/stylesheets/components/sms-message.scss b/app/assets/stylesheets/components/sms-message.scss index 898d04c24..cb26b296f 100644 --- a/app/assets/stylesheets/components/sms-message.scss +++ b/app/assets/stylesheets/components/sms-message.scss @@ -40,7 +40,7 @@ .sms-message-use-links { @include copy-19; - margin-top: 55px; + margin-top: 52px; a { diff --git a/app/main/views/templates.py b/app/main/views/templates.py index 01f3711dd..09eea1906 100644 --- a/app/main/views/templates.py +++ b/app/main/views/templates.py @@ -31,7 +31,7 @@ def add_service_template(service_id, template_type): if form.validate_on_submit(): tdao.insert_service_template( - form.name.data, template['template_type'], form.template_content.data, service_id, form.subject.data or None + form.name.data, template_type, form.template_content.data, service_id, form.subject.data or None ) return redirect( url_for('.choose_template', service_id=service_id, template_type=template_type) diff --git a/app/templates/components/email-message.html b/app/templates/components/email-message.html index b619b16fa..4b0047651 100644 --- a/app/templates/components/email-message.html +++ b/app/templates/components/email-message.html @@ -9,29 +9,27 @@ {% endif %}
- {% if from_name and from_address %} - - {% endif %} - {% if subject %} - + {% if from_name or subject %} + + + {% if from_name and from_address %} + + + + + {% endif %} + {% if subject %} + + + + + {% endif %} + + {% endif %}