Add an ‘edit’ field type

Like the link field, but right aligns so that it sits nicely in the
last column of a table.
This commit is contained in:
Chris Hill-Scott
2016-08-22 13:49:41 +01:00
parent f84e8e2519
commit fc93d9ff52
2 changed files with 14 additions and 8 deletions

View File

@@ -85,6 +85,12 @@
{% endcall %}
{%- endmacro %}
{% macro edit_field(text, link) -%}
{% call field(align='right') %}
<a href="{{ link }}">{{ text }}</a>
{% endcall %}
{%- endmacro %}
{% macro boolean_field(yes) -%}
{% call field(status='yes' if yes else 'no') %}
{{ "Yes" if yes else "No" }}

View File

@@ -1,6 +1,6 @@
{% extends "withnav_template.html" %}
{% from "components/browse-list.html" import browse_list %}
{% from "components/table.html" import mapping_table, row, text_field, link_field %}
{% from "components/table.html" import mapping_table, row, text_field, edit_field %}
{% block page_title %}
Settings GOV.UK Notify
@@ -19,32 +19,32 @@
{% call row() %}
{{ text_field('Service name' )}}
{{ text_field(current_service.name) }}
{{ link_field('Change', url_for('.service_name_change', service_id=current_service.id)) }}
{{ edit_field('Change', url_for('.service_name_change', service_id=current_service.id)) }}
{% endcall %}
{% call row() %}
{{ text_field('Email reply to address')}}
{{ text_field(current_service.reply_to_email_address or '{}@notifications.service.gov.uk'.format(current_service.email_from)) }}
{{ link_field('Change', url_for('.service_set_reply_to_email', service_id=current_service.id)) }}
{{ text_field(current_service.reply_to_email_address) }}
{{ edit_field('Change', url_for('.service_set_reply_to_email', service_id=current_service.id)) }}
{% endcall %}
{% call row() %}
{{ text_field('Text message sender')}}
{{ text_field(current_service.sms_sender or '40604') }}
{{ link_field('Change', url_for('.service_set_sms_sender', service_id=current_service.id)) }}
{{ edit_field('Change', url_for('.service_set_sms_sender', service_id=current_service.id)) }}
{% endcall %}
{% call row() %}
{{ text_field('Mode')}}
{% if current_service.restricted %}
{{ text_field('Trial') }}
{{ link_field('Go live', url_for('.service_request_to_go_live', service_id=current_service.id)) }}
{{ edit_field('Go live', url_for('.service_request_to_go_live', service_id=current_service.id)) }}
{% else %}
{{ text_field('Live') }}
{{ link_field() }}
{{ edit_field() }}
{% endif %}
{% endcall %}
{% call row() %}
{{ text_field('Active')}}
{{ text_field(current_service.active) }}
{{ link_field('Suspend', url_for('.service_status_change', service_id=current_service.id)) }}
{{ edit_field('Suspend', url_for('.service_status_change', service_id=current_service.id)) }}
{% endcall %}
{% endcall %}