Make email pattern work in new context

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.
This commit is contained in:
Chris Hill-Scott
2016-02-23 14:58:49 +00:00
parent 1e46922876
commit bc1899e8c0
5 changed files with 44 additions and 29 deletions

View File

@@ -7,9 +7,26 @@
margin: 20px 0 10px 0; margin: 20px 0 10px 0;
} }
&-subject, &-meta {
&-from {
margin: 10px 0; @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 { &-from {

View File

@@ -40,7 +40,7 @@
.sms-message-use-links { .sms-message-use-links {
@include copy-19; @include copy-19;
margin-top: 55px; margin-top: 52px;
a { a {

View File

@@ -31,7 +31,7 @@ def add_service_template(service_id, template_type):
if form.validate_on_submit(): if form.validate_on_submit():
tdao.insert_service_template( 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( return redirect(
url_for('.choose_template', service_id=service_id, template_type=template_type) url_for('.choose_template', service_id=service_id, template_type=template_type)

View File

@@ -9,29 +9,27 @@
</h3> </h3>
{% endif %} {% endif %}
<div class="email-message"> <div class="email-message">
{% if from_name and from_address %} {% if from_name or subject %}
<div class="email-message-from"> <table class="email-message-meta">
<div class="grid-row"> <tbody>
<div class="column-one-eighth"> {% if from_name and from_address %}
<span class="form-hint">From</span> <tr>
</div> <th>From</th>
<div class="column-seven-eighths"> <td>
{{ from_name }} &lt;{{ from_address }}&gt; {{ from_name }} &lt;{{ from_address }}&gt;
</div> </td>
</div> </tr>
</div> {% endif %}
{% endif %} {% if subject %}
{% if subject %} <tr class="email-message-meta">
<div class="email-message-subject"> <th>Subject</th>
<div class="grid-row"> <td>
<div class="column-one-eighth"> {{ subject }}
<span class="form-hint">Subject</span> </td>
</div> </div>
<div class="column-seven-eighths"> {% endif %}
{{ subject }} </tbody>
</div> </table>
</div>
</div>
{% endif %} {% endif %}
<div class="email-message-body"> <div class="email-message-body">
{{ body|nl2br }} {{ body|nl2br }}

View File

@@ -29,7 +29,7 @@
{% endif %} {% endif %}
<p> <p>
<a href="{{ url_for('.add_service_template', service_id=service_id, template_type='sms') }}" class="button">Add a new template</a> <a href="{{ url_for('.add_service_template', service_id=service_id, template_type='email') }}" class="button">Add a new template</a>
</p> </p>
</form> </form>