Reorganise templates for API keys page

This adds another layer of folder structure to the templates to match
the new URLs, which have another layer of hierarchy.
This commit is contained in:
Chris Hill-Scott
2016-09-20 11:23:59 +01:00
parent 234e0b3e6e
commit c22eb0f081
5 changed files with 4 additions and 4 deletions

View File

@@ -0,0 +1,76 @@
{% extends "withnav_template.html" %}
{% from "components/table.html" import list_table, field, hidden_field_heading %}
{% from "components/api-key.html" import api_key %}
{% block page_title %}
API integration GOV.UK Notify
{% endblock %}
{% block maincolumn_content %}
<div class="grid-row bottom-gutter-1-2">
<div class="column-two-thirds">
<h1 class="heading-large">
API integration
</h1>
</div>
<div class="column-one-third">
<a href="{{ url_for('.create_api_key', service_id=current_service.id) }}" class="button align-with-heading">Create an API key</a>
</div>
</div>
{% call(item, row_number) list_table(
keys,
empty_message="You havent created any API keys yet",
caption="API keys",
caption_visible=false,
field_headings=[
'API keys',
hidden_field_heading('Action')
],
) %}
{% call field() %}
<div class="file-list">
{{ item.name }}
<span class="file-list-hint">
{% if item.key_type == 'normal' %}
<span class="visually-hidden">Normal</span>
{% elif item.key_type == 'team' %}
Only sends to team members
{% elif item.key_type == 'test' %}
Simulates sending messages
{% endif %}
</span>
</div>
{% endcall %}
{% if item.expiry_date %}
{% call field(align='right') %}
Revoked {{ item.expiry_date|format_datetime_short }}
{% endcall %}
{% else %}
{% call field(align='right', status='error') %}
<a href='{{ url_for('.revoke_api_key', service_id=current_service.id, key_id=item.id) }}'>Revoke</a>
{% endcall %}
{% endif %}
{% endcall %}
<div class="bottom-gutter-2">
{{ api_key(current_service.id, "Service ID", thing="service ID") }}
</div>
<h2 class="heading-medium">API clients</h2>
<ul class="list list-bullet">
{% for name, url in [
('Java', 'https://github.com/alphagov/notifications-java-client'),
('Node JS', 'https://github.com/alphagov/notifications-node-client'),
('PHP', 'https://github.com/alphagov/notifications-php-client'),
('Python', 'https://github.com/alphagov/notifications-python-client'),
('Ruby', 'https://github.com/alphagov/notifications-ruby-client')
] %}
<li>
<a href="{{ url }}">{{ name }}</a>
</li>
{% endfor %}
</ul>
{% endblock %}

View File

@@ -0,0 +1,22 @@
{% extends "withnav_template.html" %}
{% from "components/page-footer.html" import page_footer %}
{% from "components/textbox.html" import textbox %}
{% from "components/radios.html" import radios %}
{% block page_title %}
Add a new API key GOV.UK Notify
{% endblock %}
{% block maincolumn_content %}
<h1 class="heading-large">
Create an API key
</h1>
<form method="post">
{{ radios(form.key_type) }}
{{ textbox(form.key_name, label='Name for this key') }}
{{ page_footer('Continue') }}
</form>
{% endblock %}

View File

@@ -0,0 +1,31 @@
{% extends "withnav_template.html" %}
{% from "components/page-footer.html" import page_footer %}
{% from "components/api-key.html" import api_key %}
{% block page_title %}
Revoke API key GOV.UK Notify
{% endblock %}
{% block maincolumn_content %}
<h1 class="heading-large">
Revoke API key
</h1>
<p>
{{ key_name }} will no longer let you connect to GOV.UK Notify.
</p>
<p>
You cant undo this.
</p>
<form method="post">
{{ page_footer(
'Revoke this API key',
back_link=url_for('.api_keys', service_id=current_service.id),
back_link_text='Back to API keys',
destructive=True
) }}
</form>
{% endblock %}

View File

@@ -0,0 +1,28 @@
{% extends "withnav_template.html" %}
{% from "components/page-footer.html" import page_footer %}
{% from "components/api-key.html" import api_key %}
{% block page_title %}
New API key GOV.UK Notify
{% endblock %}
{% block maincolumn_content %}
<h1 class="heading-large">
New API key
</h1>
<p>
Copy your key to somewhere safe. You wont be able to see it again
once you leave this page.
</p>
{{ api_key(secret, key_name) }}
{{ page_footer(
secondary_link=url_for('.api_keys', service_id=current_service.id),
secondary_link_text='Back to API keys'
) }}
{% endblock %}