Merge pull request #155 from alphagov/fixes-to-front-end-patterns

Fixes to front end patterns
This commit is contained in:
NIcholas Staples
2016-02-05 11:39:46 +00:00
16 changed files with 41 additions and 26 deletions

View File

@@ -28,6 +28,10 @@
}
&-secondary-link {
display: block;
margin-top: $gutter;
}
.button {}

View File

@@ -51,5 +51,5 @@ def revoke_api_key(service_id, key_id):
)
elif request.method == 'POST':
api_key_api_client.revoke_api_key(service_id=service_id, key_id=key_id)
flash('{} was revoked'.format(key_name), 'default')
flash('{} was revoked'.format(key_name), 'default_with_tick')
return redirect(url_for('.api_keys', service_id=service_id))

View File

@@ -3,6 +3,8 @@
destructive=False,
back_link=False,
back_link_text="Back",
secondary_link=False,
secondary_link_text=None,
delete_link=False,
delete_link_text="delete"
) %}
@@ -19,5 +21,8 @@
{% if back_link %}
<a class="page-footer-back-link" href="{{ back_link }}">{{ back_link_text }}</a>
{% endif %}
{% if secondary_link and secondary_link_text %}
<a class="page-footer-secondary-link" href="{{ secondary_link }}">{{ secondary_link_text }}</a>
{% endif %}
</div>
{% endmacro %}

View File

@@ -4,7 +4,7 @@
{% for category, message in messages %}
{{ banner(
message,
'default' if category == 'default' or 'default_with_tick' else 'dangerous',
'default' if ((category == 'default') or (category == 'default_with_tick')) else 'dangerous',
delete_button="Yes, delete this template" if 'delete' == category else None,
with_tick=True if category == 'default_with_tick' else False
)}}

View File

@@ -23,9 +23,10 @@
</p>
{{ banner(
'You can only send notifications to yourself',
subhead='Trial mode',
type='info'
'You can only send messages to yourself until you <a href="{}">request to go live</a>'.format(
url_for('.service_request_to_go_live', service_id=service_id)
)|safe,
type='important'
) }}
<h2 class="api-key-name">

View File

@@ -14,11 +14,7 @@
<form method="post">
{{ textbox(key_name, hint='eg CRM application') }}
{{ page_footer(
'Continue',
back_link=url_for('.api_keys', service_id=service_id),
back_link_text='Back to API keys'
) }}
{{ page_footer('Continue') }}
</form>
{% endblock %}

View File

@@ -20,14 +20,14 @@
once you leave this page.
</p>
{{ api_key(secret, key_name) }}
</div>
</div>
{{ api_key(secret, key_name) }}
{{ page_footer(
back_link=url_for('.api_keys', service_id=service_id),
back_link_text='Back to API keys'
secondary_link=url_for('.api_keys', service_id=service_id),
secondary_link_text='Back to API keys'
) }}
{% endblock %}

View File

@@ -26,8 +26,8 @@ GOV.UK Notify | Edit template
'Save',
delete_link=url_for('.delete_service_template', service_id=service_id, template_id=template_id) if template_id or None,
delete_link_text='delete this template',
back_link=url_for('.manage_service_templates', service_id=service_id),
back_link_text='Back to templates'
secondary_link=url_for('.manage_service_templates', service_id=service_id),
secondary_link_text='Back to templates'
) }}
</form>

View File

@@ -26,8 +26,8 @@ GOV.UK Notify | Notifications activity
</div>
{{ page_footer(
back_link = url_for('.view_job', service_id=service_id, job_id=job_id),
back_link_text = 'View other messages in this job'
secondary_link = url_for('.view_job', service_id=service_id, job_id=job_id),
secondary_link_text = 'View other messages in this job'
) }}
{% endblock %}

View File

@@ -24,7 +24,8 @@ GOV.UK Notify | Service settings
{{ textbox(form.name) }}
{{ page_footer(
'Save',
back_link=url_for('.service_settings', service_id=service_id)
back_link=url_for('.service_settings', service_id=service_id),
back_link_text='Back to settings'
) }}
</form>
</div>

View File

@@ -39,7 +39,8 @@
<form method="post">
{{ page_footer(
'Send request',
back_link=url_for('.service_settings', service_id=service_id)
back_link=url_for('.service_settings', service_id=service_id),
back_link_text='Back to settings'
) }}
</form>

View File

@@ -23,9 +23,10 @@ GOV.UK Notify | Service settings
<form method="post">
{{ page_footer(
'Turn off all outgoing notifications',
'Suspend API keys',
destructive=True,
back_link=url_for('.service_settings', service_id=service_id)
back_link=url_for('.service_settings', service_id=service_id),
back_link_text='Back to settings'
) }}
</form>

View File

@@ -17,7 +17,7 @@ Sign in
<form autocomplete="off" method="post">
{{ textbox(form.email_address) }}
{{ textbox(form.password) }}
{{ page_footer("Continue", back_link=url_for('.forgot_password'), back_link_text="Forgotten password?") }}
{{ page_footer("Continue", secondary_link=url_for('.forgot_password'), secondary_link_text="Forgotten password?") }}
</form>
</div>
</div>

View File

@@ -51,6 +51,8 @@
type='tip'
)}}
{{ banner('You could go to jail', 'important')}}
<h2 class="heading-large">Big number</h2>
<p>Used to show some important statistics.</p>
@@ -117,6 +119,10 @@
button_text='Send', back_link='http://example.com', back_link_text="Back to dashboard"
) }}
{{ page_footer(
button_text='Sign in', secondary_link='http://example.com', secondary_link_text="Ive forgotten my password"
) }}
<h2 class="heading-large">SMS message</h2>
<p>Used to show, preview or choose an SMS message.</p>

View File

@@ -17,8 +17,8 @@ GOV.UK Notify | Service settings
{{ textbox(form.new_password) }}
{{ page_footer(
'Save',
back_link=url_for('.user_profile'),
back_link_text="Back to your profile"
secondary_link=url_for('.user_profile'),
secondary_link_text="Back to your profile"
) }}
</form>
</div>

View File

@@ -161,7 +161,7 @@ def test_should_show_status_page(app_,
assert response.status_code == 200
resp_data = response.get_data(as_text=True)
assert 'Turn off all outgoing notifications' in resp_data
assert 'Suspend API keys' in resp_data
assert mock_get_service.called