From 65dc7578e510cf4d8c9ad094ef11dc42d3e5fe3c Mon Sep 17 00:00:00 2001
From: Chris Hill-Scott
Date: Sun, 21 Feb 2016 11:15:15 +0000
Subject: [PATCH] Updates to styleguide
Brings in changes to the email message and table patterns.
---
app/main/views/styleguide.py | 12 +-
app/templates/views/styleguide.html | 187 +++++++++++++++++-----------
2 files changed, 122 insertions(+), 77 deletions(-)
diff --git a/app/main/views/styleguide.py b/app/main/views/styleguide.py
index e2b540708..eed30b20e 100644
--- a/app/main/views/styleguide.py
+++ b/app/main/views/styleguide.py
@@ -1,6 +1,7 @@
from flask import render_template, current_app, abort
from flask_wtf import Form
from wtforms import StringField, PasswordField, TextAreaField, FileField, validators
+from utils.template import Template
from app.main import main
@@ -17,13 +18,16 @@ def styleguide():
message = TextAreaField(u'Message')
file_upload = FileField('Upload a CSV file to add your recipients’ details')
+ sms = "Your vehicle tax for ((registration number)) is due on ((date)). Renew online at www.gov.uk/vehicle-tax"
+
form = FormExamples()
-
- form.message.data = "Your vehicle tax for ((registration number)) is due on ((date)). Renew online at www.gov.uk/vehicle-tax" # noqa
-
+ form.message.data = sms
form.validate()
+ template = Template({'content': sms})
+
return render_template(
'views/styleguide.html',
- form=form
+ form=form,
+ template=template
)
diff --git a/app/templates/views/styleguide.html b/app/templates/views/styleguide.html
index a52144df3..a45f1a30e 100644
--- a/app/templates/views/styleguide.html
+++ b/app/templates/views/styleguide.html
@@ -5,9 +5,11 @@
{% from "components/browse-list.html" import browse_list %}
{% from "components/page-footer.html" import page_footer %}
{% from "components/sms-message.html" import sms_message %}
-{% from "components/table.html" import mapping_table, list_table, row, field, right_aligned_field_heading %}
+{% from "components/email-message.html" import email_message %}
+{% from "components/table.html" import mapping_table, list_table, row, field, text_field, boolean_field, right_aligned_field_heading %}
{% from "components/textbox.html" import textbox %}
{% from "components/file-upload.html" import file_upload %}
+{% from "components/yes-no.html" import yes_no %}
{% from "components/api-key.html" import api_key %}
{% block page_title %}
@@ -25,21 +27,26 @@
Banner
-
Used to show the status of a thing or action.
+
+
+
Used to show the status of a thing or action.
- {{ banner("You sent 1,234 text messages", with_tick=True) }}
+ {{ banner("You sent 1,234 text messages", with_tick=True) }}
- {{ banner('You’re not allowed to do this', 'dangerous')}}
+ {{ banner('You’re not allowed to do this', 'dangerous')}}
- {{ banner('Are you sure you want to delete?', 'dangerous', delete_button="Yes, delete this thing")}}
+ {{ banner('Are you sure you want to delete?', 'dangerous', delete_button="Yes, delete this thing")}}
- {{ banner(
- 'Send your first message'|safe,
- subhead='Get started',
- type='tip'
- )}}
+ {{ banner(
+ 'Send your first message'|safe,
+ subhead='Get started',
+ type='tip'
+ )}}
+
+ {{ banner('You could go to jail', 'important')}}
+
+
- {{ banner('You could go to jail', 'important')}}
Big number
@@ -118,7 +125,7 @@
SMS message
-
Used to show, preview or choose an SMS message.
+
Used to show, preview or choose an SMS template.
@@ -127,82 +134,105 @@
name='Two week reminder',
) }}
{{ sms_message(
- 'Your vehicle tax for ((registration number)) is due on ((date)). Renew online at www.gov.uk/vehicle-tax'
+ template.formatted_as_markup
) }}
{{ sms_message(
- 'Your vehicle tax for registration number is due on date. Renew online at www.gov.uk/vehicle-tax',
+ 'Your vehicle tax for LC12 BFL is due on 1 March 2016. Renew online at www.gov.uk/vehicle-tax',
'+44 7700 900 306'
) }}
{{ sms_message(
- 'Your vehicle tax for ((registration number)) is due on ((date)). Renew online at www.gov.uk/vehicle-tax',
+ template.formatted_as_markup,
name='Two week reminder',
edit_link='#'
) }}
+
Email message
+
+
Used to show, preview or choose an email template.
+
+
+
+ {{ email_message(
+ subject="Vehicle tax reminder",
+ body="Dear Alice Smith,\n\nYour vehicle tax for LC12 BFL is due on 1 March 2016.\n\nRenew online at www.gov.uk/vehicle-tax",
+ from_name="Vehicle tax",
+ from_address="vehicle.tax@notifications.service.gov.uk",
+ name="Two week reminder",
+ ) }}
+