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 {} .button {}

View File

@@ -51,5 +51,5 @@ def revoke_api_key(service_id, key_id):
) )
elif request.method == 'POST': elif request.method == 'POST':
api_key_api_client.revoke_api_key(service_id=service_id, key_id=key_id) 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)) return redirect(url_for('.api_keys', service_id=service_id))

View File

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

View File

@@ -4,7 +4,7 @@
{% for category, message in messages %} {% for category, message in messages %}
{{ banner( {{ banner(
message, 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, delete_button="Yes, delete this template" if 'delete' == category else None,
with_tick=True if category == 'default_with_tick' else False with_tick=True if category == 'default_with_tick' else False
)}} )}}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -24,7 +24,8 @@ GOV.UK Notify | Service settings
{{ textbox(form.name) }} {{ textbox(form.name) }}
{{ page_footer( {{ page_footer(
'Save', '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> </form>
</div> </div>

View File

@@ -39,7 +39,8 @@
<form method="post"> <form method="post">
{{ page_footer( {{ page_footer(
'Send request', '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> </form>

View File

@@ -23,9 +23,10 @@ GOV.UK Notify | Service settings
<form method="post"> <form method="post">
{{ page_footer( {{ page_footer(
'Turn off all outgoing notifications', 'Suspend API keys',
destructive=True, 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> </form>

View File

@@ -17,7 +17,7 @@ Sign in
<form autocomplete="off" method="post"> <form autocomplete="off" method="post">
{{ textbox(form.email_address) }} {{ textbox(form.email_address) }}
{{ textbox(form.password) }} {{ 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> </form>
</div> </div>
</div> </div>

View File

@@ -51,6 +51,8 @@
type='tip' type='tip'
)}} )}}
{{ banner('You could go to jail', 'important')}}
<h2 class="heading-large">Big number</h2> <h2 class="heading-large">Big number</h2>
<p>Used to show some important statistics.</p> <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" 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> <h2 class="heading-large">SMS message</h2>
<p>Used to show, preview or choose an SMS message.</p> <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) }} {{ textbox(form.new_password) }}
{{ page_footer( {{ page_footer(
'Save', 'Save',
back_link=url_for('.user_profile'), secondary_link=url_for('.user_profile'),
back_link_text="Back to your profile" secondary_link_text="Back to your profile"
) }} ) }}
</form> </form>
</div> </div>

View File

@@ -161,7 +161,7 @@ def test_should_show_status_page(app_,
assert response.status_code == 200 assert response.status_code == 200
resp_data = response.get_data(as_text=True) 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 assert mock_get_service.called