From a978a2fbe55756983398f6f9801275736124e44f Mon Sep 17 00:00:00 2001 From: Katie Smith Date: Mon, 13 Aug 2018 12:24:52 +0100 Subject: [PATCH] Refactor contact link template --- .../views/service-settings/contact_link.html | 22 +++++-------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/app/templates/views/service-settings/contact_link.html b/app/templates/views/service-settings/contact_link.html index 1e70939e1..7b1463899 100644 --- a/app/templates/views/service-settings/contact_link.html +++ b/app/templates/views/service-settings/contact_link.html @@ -22,22 +22,12 @@ {% call radios_wrapper(form.contact_details_type, hide_legend=true) %} {% for option in form.contact_details_type %} - {% if option.data == 'url' %} - {{ radio(option, data_target="url-type") }} -
- {{ textbox(form.url, label=' ', width='1-1') }} -
- {% elif option.data == 'email_address' %} - {{ radio(option, data_target="email-address-type") }} -
- {{ textbox(form.email_address, label=' ', width='1-1') }} -
- {% elif option.data == 'phone_number' %} - {{ radio(option, data_target="phone-number-type") }} -
- {{ textbox(form.phone_number, label=' ', width='1-1') }} -
- {% endif %} + {% set data_target = option.data.replace('_', '-') ~ "-type" %} + + {{ radio(option, data_target=data_target) }} +
+ {{ textbox(form|attr(option.data), label=' ', width='1-1') }} +
{% endfor %} {% endcall %}