From 3ee09d03bdc29e21bd97bf787e14d8f41f050f08 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Mon, 15 Feb 2016 11:32:27 +0000 Subject: [PATCH 1/4] General updates to styleguide More complete examples of: - tables - SMS messages --- app/main/views/styleguide.py | 1 + app/templates/views/styleguide.html | 24 +++++++++++++++--------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/app/main/views/styleguide.py b/app/main/views/styleguide.py index 68947ffbd..793fe40d5 100644 --- a/app/main/views/styleguide.py +++ b/app/main/views/styleguide.py @@ -10,6 +10,7 @@ def styleguide(): class FormExamples(Form): username = StringField(u'Username') password = PasswordField(u'Password', [validators.required()]) + code = StringField('Enter code') message = TextAreaField(u'Message') file_upload = FileField('Upload a CSV file to add your recipients’ details') diff --git a/app/templates/views/styleguide.html b/app/templates/views/styleguide.html index bd830ba12..941dccf69 100644 --- a/app/templates/views/styleguide.html +++ b/app/templates/views/styleguide.html @@ -5,7 +5,7 @@ {% 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 %} +{% from "components/table.html" import mapping_table, list_table, row, field, right_aligned_field_heading %} {% from "components/textbox.html" import textbox %} {% from "components/file-upload.html" import file_upload %} {% from "components/api-key.html" import api_key %} @@ -149,11 +149,10 @@

Tables

- {% call mapping_table( caption='Account settings', - field_headings=['Label', 'Value'], - field_headings_visible=True, + field_headings=['Label', 'Value', 'Action'], + field_headings_visible=False, caption_visible=True ) %} {% call row() %} @@ -163,6 +162,9 @@ {% call field() %} admin {% endcall %} + {% call field(align='right') %} + Change + {% endcall %} {% endcall %} {% endcall %} @@ -175,18 +177,21 @@ 'file': 'dispatch_20151117.csv', 'status': 'Delivered' }, { - 'file': 'remdinder_monday.csv', 'status': 'Delivered' + 'file': 'remdinder_monday.csv', 'status': 'Failed' } ], caption='Messages', - field_headings=['File', 'Status'], - field_headings_visible=False, - caption_visible=True + field_headings=['File', right_aligned_field_heading('Status')], + field_headings_visible=True, + caption_visible=False ) %} {% call field() %} {{ item.file }} {% endcall %} - {% call field() %} + {% call field( + align='right', + status='error' if item.status == 'Failed' else 'default' + ) %} {{ item.status }} {% endcall %} {% endcall %} @@ -210,6 +215,7 @@ {{ textbox(form.username) }} {{ textbox(form.password) }} {{ textbox(form.message, highlight_tags=True) }} + {{ textbox(form.code, width='1-8') }}

File upload

{{ file_upload(form.file_upload) }} From 97304a668186b44f57f3e04bb680ee39bc5c6882 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Mon, 15 Feb 2016 11:35:53 +0000 Subject: [PATCH 2/4] =?UTF-8?q?Remove=20=E2=80=98info=E2=80=99=20banner=20?= =?UTF-8?q?type?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We’re not using this banner type anywhere any more --- app/assets/stylesheets/components/banner.scss | 22 --------------- app/templates/views/styleguide.html | 27 +++++++------------ 2 files changed, 10 insertions(+), 39 deletions(-) diff --git a/app/assets/stylesheets/components/banner.scss b/app/assets/stylesheets/components/banner.scss index 737a13a92..3a8898c83 100644 --- a/app/assets/stylesheets/components/banner.scss +++ b/app/assets/stylesheets/components/banner.scss @@ -31,28 +31,6 @@ } -.banner-info { - - @extend %banner; - background: $govuk-blue; - color: $white; - - a { - - &:link, - &:visited { - color: $white; - text-decoration: underline; - } - - &:hover { - color: $light-blue-25; - } - - } - -} - .banner-dangerous { @extend %banner; diff --git a/app/templates/views/styleguide.html b/app/templates/views/styleguide.html index 941dccf69..9af07faed 100644 --- a/app/templates/views/styleguide.html +++ b/app/templates/views/styleguide.html @@ -29,18 +29,6 @@ {{ banner("You sent 1,234 text messages", with_tick=True) }} -
-
- {{ banner("Delivered 10:20") }} -
-
- - {{ banner( - 'You can only send notifications to yourself', - type='info', - subhead='Restricted mode' - ) }} - {{ banner('You’re not allowed to do this', 'dangerous')}} {{ banner('Are you sure you want to delete?', 'dangerous', delete_button="Yes, delete this thing")}} @@ -134,14 +122,19 @@
- {{ sms_message("Your vehicle tax for LC12 BFL is due on 1 March 2016. Renew online at www.gov.uk/vehicle-tax") }} - {{ sms_message("Your vehicle tax for ((registration number)) is due on ((date)). Renew online at www.gov.uk/vehicle-tax") }} {{ sms_message( - "Your vehicle tax for registration number is due on date. Renew online at www.gov.uk/vehicle-tax", - "+44 7700 900 306" + 'Your vehicle tax for LC12 BFL is due on 1 March 2016. Renew online at www.gov.uk/vehicle-tax', + name='Two week reminder', ) }} {{ sms_message( - "Your vehicle tax for ((registration number)) is due on ((date)). Renew online at www.gov.uk/vehicle-tax", + 'Your vehicle tax for ((registration number)) is due on ((date)). Renew online at www.gov.uk/vehicle-tax' + ) }} + {{ sms_message( + 'Your vehicle tax for registration number is due on date. 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', name='Two week reminder', edit_link='#' ) }} From 10a92258a4faa0e47cee2bcea8e7991baddef5b0 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Mon, 15 Feb 2016 11:41:46 +0000 Subject: [PATCH 3/4] Make page heading a link to preview Mainly because it looks good when this page is printed and stuck on the wall. --- app/templates/views/styleguide.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/templates/views/styleguide.html b/app/templates/views/styleguide.html index 9af07faed..a52144df3 100644 --- a/app/templates/views/styleguide.html +++ b/app/templates/views/styleguide.html @@ -17,7 +17,7 @@ {% block maincolumn_content %}

- Styleguide + www.notify.works/_styleguide

From 0d86be0feb50720b7dfe24b21079c74e4d5998a4 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Mon, 15 Feb 2016 11:47:54 +0000 Subject: [PATCH 4/4] =?UTF-8?q?Don=E2=80=99t=20show=20styleguide=20on=20li?= =?UTF-8?q?ve=20environment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Its audience is people working on the product, not the end users. --- app/main/views/styleguide.py | 5 ++++- config.py | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/main/views/styleguide.py b/app/main/views/styleguide.py index 793fe40d5..e2b540708 100644 --- a/app/main/views/styleguide.py +++ b/app/main/views/styleguide.py @@ -1,4 +1,4 @@ -from flask import render_template +from flask import render_template, current_app, abort from flask_wtf import Form from wtforms import StringField, PasswordField, TextAreaField, FileField, validators from app.main import main @@ -7,6 +7,9 @@ from app.main import main @main.route('/_styleguide') def styleguide(): + if not current_app.config['SHOW_STYLEGUIDE']: + abort(404) + class FormExamples(Form): username = StringField(u'Username') password = PasswordField(u'Password', [validators.required()]) diff --git a/config.py b/config.py index bc1ae87db..bdd7be9af 100644 --- a/config.py +++ b/config.py @@ -44,6 +44,8 @@ class Config(object): AWS_REGION = 'eu-west-1' + SHOW_STYLEGUIDE = True + class Development(Config): DEBUG = True @@ -66,7 +68,7 @@ class Preview(Config): class Staging(Preview): - pass + SHOW_STYLEGUIDE = False class Live(Staging):