General updates to styleguide

More complete examples of:
- tables
- SMS messages
This commit is contained in:
Chris Hill-Scott
2016-02-15 11:37:08 +00:00
parent 5928c3bb2c
commit 3ee09d03bd
2 changed files with 16 additions and 9 deletions
+1
View File
@@ -10,6 +10,7 @@ def styleguide():
class FormExamples(Form): class FormExamples(Form):
username = StringField(u'Username') username = StringField(u'Username')
password = PasswordField(u'Password', [validators.required()]) password = PasswordField(u'Password', [validators.required()])
code = StringField('Enter code')
message = TextAreaField(u'Message') message = TextAreaField(u'Message')
file_upload = FileField('Upload a CSV file to add your recipients details') file_upload = FileField('Upload a CSV file to add your recipients details')
+15 -9
View File
@@ -5,7 +5,7 @@
{% from "components/browse-list.html" import browse_list %} {% from "components/browse-list.html" import browse_list %}
{% from "components/page-footer.html" import page_footer %} {% from "components/page-footer.html" import page_footer %}
{% from "components/sms-message.html" import sms_message %} {% 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/textbox.html" import textbox %}
{% from "components/file-upload.html" import file_upload %} {% from "components/file-upload.html" import file_upload %}
{% from "components/api-key.html" import api_key %} {% from "components/api-key.html" import api_key %}
@@ -149,11 +149,10 @@
</div> </div>
<h2 class="heading-large">Tables</h2> <h2 class="heading-large">Tables</h2>
{% call mapping_table( {% call mapping_table(
caption='Account settings', caption='Account settings',
field_headings=['Label', 'Value'], field_headings=['Label', 'Value', 'Action'],
field_headings_visible=True, field_headings_visible=False,
caption_visible=True caption_visible=True
) %} ) %}
{% call row() %} {% call row() %}
@@ -163,6 +162,9 @@
{% call field() %} {% call field() %}
admin admin
{% endcall %} {% endcall %}
{% call field(align='right') %}
<a href="#">Change</a>
{% endcall %}
{% endcall %} {% endcall %}
{% endcall %} {% endcall %}
@@ -175,18 +177,21 @@
'file': 'dispatch_20151117.csv', 'status': 'Delivered' 'file': 'dispatch_20151117.csv', 'status': 'Delivered'
}, },
{ {
'file': 'remdinder_monday.csv', 'status': 'Delivered' 'file': 'remdinder_monday.csv', 'status': 'Failed'
} }
], ],
caption='Messages', caption='Messages',
field_headings=['File', 'Status'], field_headings=['File', right_aligned_field_heading('Status')],
field_headings_visible=False, field_headings_visible=True,
caption_visible=True caption_visible=False
) %} ) %}
{% call field() %} {% call field() %}
{{ item.file }} {{ item.file }}
{% endcall %} {% endcall %}
{% call field() %} {% call field(
align='right',
status='error' if item.status == 'Failed' else 'default'
) %}
{{ item.status }} {{ item.status }}
{% endcall %} {% endcall %}
{% endcall %} {% endcall %}
@@ -210,6 +215,7 @@
{{ textbox(form.username) }} {{ textbox(form.username) }}
{{ textbox(form.password) }} {{ textbox(form.password) }}
{{ textbox(form.message, highlight_tags=True) }} {{ textbox(form.message, highlight_tags=True) }}
{{ textbox(form.code, width='1-8') }}
<h2 class="heading-large">File upload</h2> <h2 class="heading-large">File upload</h2>
{{ file_upload(form.file_upload) }} {{ file_upload(form.file_upload) }}