mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-15 07:18:58 -04:00
Revert "Re-introduce govuk checkboxes"
This commit is contained in:
46
app/templates/components/checkbox.html
Normal file
46
app/templates/components/checkbox.html
Normal file
@@ -0,0 +1,46 @@
|
||||
{% from "components/select-input.html" import select_nested, select %}
|
||||
|
||||
{% macro checkbox(
|
||||
field,
|
||||
hint=False,
|
||||
width='2-3'
|
||||
) %}
|
||||
<div class="multiple-choice">
|
||||
{{ checkbox_input(field.id, field.name, field.data) }}
|
||||
<label for="{{ field.id }}">
|
||||
{{ field.label.text }}
|
||||
{% if hint %}
|
||||
<div class="hint">
|
||||
{{ hint }}
|
||||
</div>
|
||||
{% endif %}
|
||||
</label>
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
|
||||
{% macro checkboxes_nested(field, child_map, hint=None, disable=[], option_hints={}, hide_legend=False, collapsible_opts={}, legend_style="text") %}
|
||||
{{ select_nested(field, child_map, hint, disable, option_hints, hide_legend, collapsible_opts, legend_style, input="checkbox") }}
|
||||
{% endmacro %}
|
||||
|
||||
|
||||
{% macro checkboxes(field, hint=None, disable=[], option_hints={}, hide_legend=False, collapsible_opts={}) %}
|
||||
{{ select(field, hint, disable, option_hints, hide_legend, collapsible_opts, input="checkbox") }}
|
||||
{% endmacro %}
|
||||
|
||||
|
||||
{% macro checkbox_input(id, name, data=None, value="y") %}
|
||||
<input
|
||||
id="{{ id }}" name="{{ name }}" type="checkbox" value="{{ value }}"
|
||||
{% if data %}
|
||||
checked
|
||||
{% endif %}
|
||||
>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro unlabelled_checkbox(id, name, data=None, value="y") %}
|
||||
<div class="multiple-choice">
|
||||
{{ checkbox_input(id, name, data, value) }}
|
||||
<label></label>
|
||||
</div>
|
||||
{% endmacro %}
|
||||
@@ -1,4 +0,0 @@
|
||||
{%- macro govukCheckboxes(params) %}
|
||||
{%- include "./template.njk" -%}
|
||||
{%- endmacro %}
|
||||
{{ govukCheckboxes(params) }}
|
||||
@@ -1,136 +0,0 @@
|
||||
{% from "components/error-message/macro.njk" import govukErrorMessage -%}
|
||||
{% from "components/fieldset/macro.njk" import govukFieldset %}
|
||||
{% from "components/hint/macro.njk" import govukHint %}
|
||||
{% from "components/label/macro.njk" import govukLabel %}
|
||||
|
||||
|
||||
{#- Copied from https://github.com/alphagov/govuk-frontend/blob/v2.13.0/src/components/checkboxes/template.njk
|
||||
Changes:
|
||||
- `classes` option added to `item` allow custom classes on the `.govuk-checkboxes__item` element
|
||||
- `classes` option added to `item.hint` allow custom classes on the `.govuk-hint` element (added to GOVUK Frontend in v3.5.0 - remove when we update)
|
||||
- `asList` option added the root `params` object to allow setting of the `.govuk-checkboxes` and `.govuk-checkboxes__item` element types
|
||||
- `children` option added to `item` allowing the sending in of prerendered child checkboxes (allowing the creation of tree structures through recursion) -#}
|
||||
{#- If an id 'prefix' is not passed, fall back to using the name attribute
|
||||
instead. We need this for error messages and hints as well -#}
|
||||
{% set idPrefix = params.idPrefix if params.idPrefix else params.name %}
|
||||
|
||||
{#- a record of other elements that we need to associate with the input using
|
||||
aria-describedby – for example hints or error messages -#}
|
||||
{% set describedBy = params.describedBy if params.describedBy else "" %}
|
||||
{% if params.fieldset.describedBy %}
|
||||
{% set describedBy = params.fieldset.describedBy %}
|
||||
{% endif %}
|
||||
|
||||
{#- set the types of element used for the checkboxes and their group based on
|
||||
whether asList is set -#}
|
||||
{% if params.asList %}
|
||||
{% set groupElement = 'ul' %}
|
||||
{% set groupItemElement = 'li' %}
|
||||
{% else %}
|
||||
{% set groupElement = 'div' %}
|
||||
{% set groupItemElement = 'div' %}
|
||||
{% endif %}
|
||||
|
||||
{% set isConditional = false %}
|
||||
{% for item in params.items %}
|
||||
{% if item.conditional %}
|
||||
{% set isConditional = true %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{#- fieldset is false by default -#}
|
||||
{% set hasFieldset = true if params.fieldset else false %}
|
||||
|
||||
{#- Capture the HTML so we can optionally nest it in a fieldset -#}
|
||||
{% set innerHtml %}
|
||||
{% if params.hint %}
|
||||
{% set hintId = idPrefix + '-hint' %}
|
||||
{% set describedBy = describedBy + ' ' + hintId if describedBy else hintId %}
|
||||
{{ govukHint({
|
||||
id: hintId,
|
||||
classes: params.hint.classes,
|
||||
attributes: params.hint.attributes,
|
||||
html: params.hint.html,
|
||||
text: params.hint.text
|
||||
}) | indent(2) | trim }}
|
||||
{% endif %}
|
||||
{% if params.errorMessage %}
|
||||
{% set errorId = idPrefix + '-error' %}
|
||||
{% set describedBy = describedBy + ' ' + errorId if describedBy else errorId %}
|
||||
{{ govukErrorMessage({
|
||||
id: errorId,
|
||||
classes: params.errorMessage.classes,
|
||||
attributes: params.errorMessage.attributes,
|
||||
html: params.errorMessage.html,
|
||||
text: params.errorMessage.text,
|
||||
visuallyHiddenText: params.errorMessage.visuallyHiddenText
|
||||
}) | indent(2) | trim }}
|
||||
{% endif %}
|
||||
<{{ groupElement }} class="govuk-checkboxes {%- if params.classes %} {{ params.classes }}{% endif %}"
|
||||
{%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor %}
|
||||
{%- if isConditional %} data-module="checkboxes"{% endif -%}>
|
||||
{% for item in params.items %}
|
||||
{% set id = item.id if item.id else idPrefix + "-" + loop.index %}
|
||||
{% set name = item.name if item.name else params.name %}
|
||||
{% set conditionalId = "conditional-" + id %}
|
||||
{% set hasHint = true if item.hint.text or item.hint.html %}
|
||||
{% set itemHintId = id + "-item-hint" if hasHint else "" %}
|
||||
{% set itemDescribedBy = describedBy if not hasFieldset else "" %}
|
||||
{% set itemDescribedBy = (itemDescribedBy + " " + itemHintId) | trim %}
|
||||
<{{ groupItemElement }} class="govuk-checkboxes__item {%- if item.classes %} {{ item.classes }}{% endif %}">
|
||||
{%- if item.before %}{{ item.before }}{% endif -%}
|
||||
<input class="govuk-checkboxes__input" id="{{ id }}" name="{{ name }}" type="checkbox" value="{{ item.value }}"
|
||||
{{-" checked" if item.checked }}
|
||||
{{-" disabled" if item.disabled }}
|
||||
{%- if item.conditional %} data-aria-controls="{{ conditionalId }}"{% endif -%}
|
||||
{%- if itemDescribedBy %} aria-describedby="{{ itemDescribedBy }}"{% endif -%}
|
||||
{%- for attribute, value in item.attributes %} {{ attribute }}="{{ value }}"{% endfor -%}>
|
||||
{{ govukLabel({
|
||||
html: item.html,
|
||||
text: item.text,
|
||||
classes: 'govuk-checkboxes__label' + (' ' + item.label.classes if item.label.classes),
|
||||
attributes: item.label.attributes,
|
||||
for: id
|
||||
}) | indent(6) | trim }}
|
||||
{%- if hasHint %}
|
||||
{{ govukHint({
|
||||
id: itemHintId,
|
||||
classes: 'govuk-checkboxes__hint' + (' ' + item.hint.classes if item.hint.classes),
|
||||
attributes: item.hint.attributes,
|
||||
html: item.hint.html,
|
||||
text: item.hint.text
|
||||
}) | indent(6) | trim }}
|
||||
{%- endif %}
|
||||
{%- if item.children %}
|
||||
{{ item.children | safe }}
|
||||
{%- endif %}
|
||||
{% if params.asList and item.conditional %}
|
||||
<div class="govuk-checkboxes__conditional{% if not item.checked %} govuk-checkboxes__conditional--hidden{% endif %}" id="{{ conditionalId }}">
|
||||
{{ item.conditional.html | safe }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{%- if item.after %}{{ item.after }}{% endif -%}
|
||||
</{{ groupItemElement }}>
|
||||
{% if not params.asList and item.conditional %}
|
||||
<div class="govuk-checkboxes__conditional{% if not item.checked %} govuk-checkboxes__conditional--hidden{% endif %}" id="{{ conditionalId }}">
|
||||
{{ item.conditional.html | safe }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</{{ groupElement }}>
|
||||
{% endset -%}
|
||||
|
||||
<div class="govuk-form-group {%- if params.errorMessage %} govuk-form-group--error{% endif %} {%- if params.formGroup.classes %} {{ params.formGroup.classes }}{% endif %}">
|
||||
{% if params.fieldset %}
|
||||
{% call govukFieldset({
|
||||
describedBy: describedBy,
|
||||
classes: params.fieldset.classes,
|
||||
attributes: params.fieldset.attributes,
|
||||
legend: params.fieldset.legend
|
||||
}) %}
|
||||
{{ innerHtml | trim | safe }}
|
||||
{% endcall %}
|
||||
{% else %}
|
||||
{{ innerHtml | trim | safe }}
|
||||
{% endif %}
|
||||
</div>
|
||||
@@ -1,5 +1,6 @@
|
||||
{% from "components/page-header.html" import page_header %}
|
||||
{% from "components/page-footer.html" import sticky_page_footer %}
|
||||
{% from "components/checkbox.html" import checkboxes %}
|
||||
{% from "components/form.html" import form_wrapper %}
|
||||
{% from "components/live-search.html" import live_search %}
|
||||
|
||||
@@ -16,10 +17,10 @@
|
||||
back_link=url_for('.choose_broadcast_library', service_id=current_service.id, broadcast_message_id=broadcast_message.id),
|
||||
)}}
|
||||
|
||||
{{ live_search(target_selector='.govuk-checkboxes__item', show=show_search_form, form=search_form, label='Search by name') }}
|
||||
{{ live_search(target_selector='.multiple-choice', show=show_search_form, form=search_form, label='Search by name') }}
|
||||
|
||||
{% call form_wrapper() %}
|
||||
{{ form.areas }}
|
||||
{{ checkboxes(form.areas, hide_legend=True) }}
|
||||
{{ sticky_page_footer('Add to broadcast') }}
|
||||
{% endcall %}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{% extends "withnav_template.html" %}
|
||||
{% from "components/checkbox.html" import checkbox %}
|
||||
{% from "components/textbox.html" import textbox %}
|
||||
{% from "components/page-header.html" import page_header %}
|
||||
{% from "components/page-footer.html" import page_footer %}
|
||||
|
||||
@@ -1,9 +1,20 @@
|
||||
{% from "components/checkbox.html" import checkbox, checkboxes_nested %}
|
||||
{% from "components/radios.html" import radio, radios, conditional_radio_panel %}
|
||||
|
||||
{{ form.permissions_field }}
|
||||
<fieldset class="form-group">
|
||||
<legend class="form-label heading-small">
|
||||
Permissions
|
||||
</legend>
|
||||
<span class="hint">
|
||||
All team members can see sent messages.
|
||||
</span>
|
||||
{% for field in form.permissions_fields %}
|
||||
{{ checkbox(field) }}
|
||||
{% endfor %}
|
||||
</fieldset>
|
||||
|
||||
{% if form.folder_permissions.all_template_folders %}
|
||||
{{ form.folder_permissions }}
|
||||
{{ checkboxes_nested(form.folder_permissions, form.folder_permissions.children(), hide_legend=True, collapsible_opts={ 'field': 'folder' }) }}
|
||||
{% elif user and user.platform_admin %}
|
||||
<p class="bottom-gutter">
|
||||
Platform admin users can access all template folders.
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{% extends "withoutnav_template.html" %}
|
||||
{% from "components/textbox.html" import textbox %}
|
||||
{% from "components/checkbox.html" import checkbox %}
|
||||
{% from "components/page-footer.html" import page_footer %}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{% extends "views/platform-admin/_base_template.html" %}
|
||||
{% from "components/textbox.html" import textbox %}
|
||||
{% from "components/checkbox.html" import checkbox %}
|
||||
{% from "components/page-footer.html" import page_footer %}
|
||||
{% from "components/big-number.html" import big_number, big_number_with_status %}
|
||||
{% from "components/message-count-label.html" import message_count_label %}
|
||||
@@ -69,7 +70,8 @@
|
||||
{% call form_wrapper(method="get") %}
|
||||
{{ textbox(form.start_date, hint="Enter start date in format YYYY-MM-DD") }}
|
||||
{{ textbox(form.end_date, hint="Enter end date in format YYYY-MM-DD") }}
|
||||
{{ form.include_from_test_key }}
|
||||
{{ checkbox(form.include_from_test_key) }}
|
||||
</br>
|
||||
{{ govukButton({ "text": "Filter" }) }}
|
||||
{% endcall %}
|
||||
{% endset %}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{% from "components/banner.html" import banner, banner_wrapper %}
|
||||
{% from "components/textbox.html" import textbox %}
|
||||
{% from "components/checkbox.html" import checkbox %}
|
||||
{% from "components/page-footer.html" import page_footer %}
|
||||
{% from "components/form.html" import form_wrapper %}
|
||||
{% from "components/button/macro.njk" import govukButton %}
|
||||
@@ -54,7 +55,9 @@
|
||||
hint='This should be a shared inbox managed by your team, not your own email address'
|
||||
) }}
|
||||
{% if not first_email_address and not existing_is_default %}
|
||||
{{ form.is_default }}
|
||||
<div class="form-group">
|
||||
{{ checkbox(form.is_default) }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{{ page_footer('Try again') }}
|
||||
{% endcall %}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{% extends "withnav_template.html" %}
|
||||
{% from "components/textbox.html" import textbox %}
|
||||
{% from "components/checkbox.html" import checkbox %}
|
||||
{% from "components/page-header.html" import page_header %}
|
||||
{% from "components/page-footer.html" import page_footer %}
|
||||
{% from "components/form.html" import form_wrapper %}
|
||||
@@ -23,7 +24,9 @@
|
||||
safe_error_message=True
|
||||
) }}
|
||||
{% if not first_email_address %}
|
||||
{{ form.is_default }}
|
||||
<div class="form-group">
|
||||
{{ checkbox(form.is_default) }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{{ page_footer('Add') }}
|
||||
{% endcall %}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{% extends "withnav_template.html" %}
|
||||
{% from "components/banner.html" import banner_wrapper %}
|
||||
{% from "components/textbox.html" import textbox %}
|
||||
{% from "components/checkbox.html" import checkbox %}
|
||||
{% from "components/page-header.html" import page_header %}
|
||||
{% from "components/page-footer.html" import page_footer %}
|
||||
{% from "components/form.html" import form_wrapper %}
|
||||
@@ -28,7 +29,9 @@
|
||||
</p>
|
||||
{{ page_footer('Save') }}
|
||||
{% else %}
|
||||
{{ form.is_default }}
|
||||
<div class="form-group">
|
||||
{{ checkbox(form.is_default) }}
|
||||
</div>
|
||||
{{ page_footer(
|
||||
'Save',
|
||||
delete_link=url_for('.service_confirm_delete_email_reply_to', service_id=current_service.id, reply_to_email_id=reply_to_email_address_id),
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{% extends "withnav_template.html" %}
|
||||
{% from "components/textbox.html" import textbox %}
|
||||
{% from "components/checkbox.html" import checkbox %}
|
||||
{% from "components/page-header.html" import page_header %}
|
||||
{% from "components/page-footer.html" import page_footer %}
|
||||
{% from "components/form.html" import form_wrapper %}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{% extends "withnav_template.html" %}
|
||||
{% from "components/textbox.html" import textbox %}
|
||||
{% from "components/checkbox.html" import checkbox %}
|
||||
{% from "components/page-header.html" import page_header %}
|
||||
{% from "components/page-footer.html" import page_footer %}
|
||||
{% from "components/form.html" import form_wrapper %}
|
||||
@@ -26,7 +27,9 @@
|
||||
highlight_placeholders=True
|
||||
) }}
|
||||
{% if not first_contact_block %}
|
||||
{{ form.is_default }}
|
||||
<div class="form-group">
|
||||
{{ checkbox(form.is_default) }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{{ page_footer('Add') }}
|
||||
{% endcall %}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{% extends "withnav_template.html" %}
|
||||
{% from "components/textbox.html" import textbox %}
|
||||
{% from "components/checkbox.html" import checkbox %}
|
||||
{% from "components/page-header.html" import page_header %}
|
||||
{% from "components/page-footer.html" import page_footer %}
|
||||
{% from "components/form.html" import form_wrapper %}
|
||||
@@ -30,7 +31,9 @@
|
||||
This is currently your default address for {{ current_service.name }}.
|
||||
</p>
|
||||
{% else %}
|
||||
{{ form.is_default }}
|
||||
<div class="form-group">
|
||||
{{ checkbox(form.is_default) }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{{ page_footer(
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{% extends "withnav_template.html" %}
|
||||
{% from "components/textbox.html" import textbox %}
|
||||
{% from "components/checkbox.html" import checkbox %}
|
||||
{% from "components/page-header.html" import page_header %}
|
||||
{% from "components/page-footer.html" import page_footer %}
|
||||
{% from "components/form.html" import form_wrapper %}
|
||||
@@ -22,7 +23,9 @@
|
||||
hint='Up to 11 characters, letters, numbers and spaces only'
|
||||
) }}
|
||||
{% if not first_sms_sender %}
|
||||
{{ form.is_default }}
|
||||
<div class="form-group">
|
||||
{{ checkbox(form.is_default) }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{{ page_footer('Save') }}
|
||||
{% endcall %}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{% extends "withnav_template.html" %}
|
||||
{% from "components/banner.html" import banner_wrapper %}
|
||||
{% from "components/textbox.html" import textbox %}
|
||||
{% from "components/checkbox.html" import checkbox %}
|
||||
{% from "components/page-header.html" import page_header %}
|
||||
{% from "components/page-footer.html" import page_footer %}
|
||||
{% from "components/form.html" import form_wrapper %}
|
||||
@@ -34,7 +35,9 @@
|
||||
</p>
|
||||
{{ page_footer('Save') }}
|
||||
{% else %}
|
||||
{{ form.is_default }}
|
||||
<div class="form-group">
|
||||
{{ checkbox(form.is_default) }}
|
||||
</div>
|
||||
{% if inbound_number %}
|
||||
{{ page_footer('Save') }}
|
||||
{% else %}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{% extends "withoutnav_template.html" %}
|
||||
{% from "components/checkbox.html" import checkbox %}
|
||||
{% from "components/textbox.html" import textbox %}
|
||||
{% from "components/page-footer.html" import sticky_page_footer %}
|
||||
{% from "components/page-header.html" import page_header %}
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
{% from "components/checkbox.html" import unlabelled_checkbox %}
|
||||
{% from "components/message-count-label.html" import folder_contents_count, message_count_label %}
|
||||
|
||||
{% macro format_item_name(name, separators=True) -%}
|
||||
{% macro format_item_name(name) -%}
|
||||
{%- if name is string -%}
|
||||
{{- name -}}
|
||||
{%- else -%}
|
||||
{%- for part in name -%}
|
||||
{{- format_item_name(part, separators) -}}
|
||||
{%- if not loop.last -%}
|
||||
{%- if separators %}
|
||||
<span class="message-name-separator"></span>{%- else %} {% endif -%}
|
||||
{% endif -%}
|
||||
{{- format_item_name(part) -}}
|
||||
{%- if not loop.last %} <span class="message-name-separator"></span> {% endif -%}
|
||||
{%- endfor -%}
|
||||
{% endif %}
|
||||
{%- endmacro %}
|
||||
@@ -23,69 +21,37 @@
|
||||
{% endif %}
|
||||
</p>
|
||||
{% else %}
|
||||
<nav id="template-list" class="{{ 'govuk-!-margin-top-1' if (not show_template_nav and not show_search_box) else 'govuk-!margin-top-6' }}">
|
||||
{% set checkboxes_data = [] %}
|
||||
|
||||
<nav id="template-list" class="{{ 'top-gutter-5px' if (not show_template_nav and not show_search_box) else '' }}">
|
||||
{% for item in template_list %}
|
||||
|
||||
{% set item_link_content %}
|
||||
{% for ancestor in item.ancestors %}
|
||||
<a href="{{ url_for('.choose_template', service_id=current_service.id, template_type=template_type, template_folder_id=ancestor.id) }}" class="govuk-link govuk-link--no-visited-state template-list-folder">
|
||||
{{- format_item_name(ancestor.name) -}}
|
||||
</a> <span class="message-name-separator"></span>
|
||||
{% endfor %}
|
||||
{% if item.is_folder %}
|
||||
<a href="{{ url_for('.choose_template', service_id=current_service.id, template_type=template_type, template_folder_id=item.id) }}" class="govuk-link govuk-link--no-visited-state template-list-folder">
|
||||
<span class="live-search-relevant">{{- format_item_name(item.name) -}}</span>
|
||||
</a>
|
||||
{% else %}
|
||||
<a href="{{ url_for('.view_template', service_id=current_service.id, template_id=item.id) }}" class="govuk-link govuk-link--no-visited-state template-list-template">
|
||||
<span class="live-search-relevant">{{- format_item_name(item.name) -}}</span>
|
||||
</a>
|
||||
<div class="template-list-item {% if current_user.has_permissions('manage_templates') %}template-list-item-with-checkbox{% endif %} {% if item.ancestors %}template-list-item-hidden-by-default{% endif %} {% if not item.ancestors %}template-list-item-without-ancestors{% endif %}">
|
||||
{% if current_user.has_permissions('manage_templates') %}
|
||||
{{ unlabelled_checkbox(
|
||||
id='templates-or-folder-{}'.format(item.id),
|
||||
name='templates_and_folders',
|
||||
data=templates_and_folders_form.is_selected(item.id),
|
||||
value=item.id,
|
||||
) }}
|
||||
{% endif %}
|
||||
{% endset %}
|
||||
|
||||
{% set label_content %}
|
||||
<span class="govuk-visually-hidden">
|
||||
{%- for ancestor in item.ancestors %}{{ format_item_name(ancestor.name, separators=False) }} {% endfor -%}
|
||||
{{ format_item_name(item.name, separators=False) -}}
|
||||
</span>
|
||||
{% endset %}
|
||||
|
||||
{% set item_meta %}
|
||||
<span id="{{ item.id }}-item-hint" class="govuk-hint govuk-checkboxes__hint template-list-item-hint">
|
||||
<h2 class="message-name">
|
||||
{% for ancestor in item.ancestors %}
|
||||
<a href="{{ url_for('.choose_template', service_id=current_service.id, template_type=template_type, template_folder_id=ancestor.id) }}" class="govuk-link govuk-link--no-visited-state template-list-folder">
|
||||
{{- format_item_name(ancestor.name) -}}
|
||||
</a> <span class="message-name-separator"></span>
|
||||
{% endfor %}
|
||||
{% if item.is_folder %}
|
||||
<a href="{{ url_for('.choose_template', service_id=current_service.id, template_type=template_type, template_folder_id=item.id) }}" class="govuk-link govuk-link--no-visited-state template-list-folder">
|
||||
<span class="live-search-relevant">{{ format_item_name(item.name) }}</span>
|
||||
</a>
|
||||
{% else %}
|
||||
<a href="{{ url_for('.view_template', service_id=current_service.id, template_id=item.id) }}" class="govuk-link govuk-link--no-visited-state template-list-template">
|
||||
<span class="live-search-relevant">{{ format_item_name(item.name) }}</span>
|
||||
</a>
|
||||
{% endif %}
|
||||
</h2>
|
||||
<p class="message-type">
|
||||
{{ item.hint }}
|
||||
</span>
|
||||
{% endset %}
|
||||
|
||||
{# create the item config now to include the label content -#}
|
||||
{# TODO: "attributes": { "aria-describedby": item.id ~ "-hint" } needs to be added but govuk-frontend-jinja doesn't currently support this -#}
|
||||
{% set checkbox_config = {
|
||||
"html": label_content,
|
||||
"label": {
|
||||
"classes": "template-list-item-label",
|
||||
},
|
||||
"id": "templates-or-folder-" ~ item.id,
|
||||
"classes": "template-list-item template-list-item-with-checkbox {}".format(
|
||||
"template-list-item-hidden-by-default" if item.ancestors else "template-list-item-without-ancestors"),
|
||||
"after": item_link_content ~ item_meta
|
||||
} %}
|
||||
{% set _ = checkboxes_data.append(checkbox_config) %}
|
||||
|
||||
{% if not current_user.has_permissions('manage_templates') %}
|
||||
<div class="template-list-item {%- if item.ancestors %} template-list-item-hidden-by-default {%- else %} template-list-item-without-ancestors{%- endif %}">
|
||||
<h2 class="message-name">
|
||||
{{ item_link_content }}
|
||||
</h2>
|
||||
<p class="message-type govuk-!-margin-bottom-4">
|
||||
{{ item.hint }}
|
||||
</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
</p>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
{% if current_user.has_permissions('manage_templates') %}
|
||||
{{ templates_and_folders_form.templates_and_folders(param_extensions={ "items": checkboxes_data }) }}
|
||||
{% endif %}
|
||||
</nav>
|
||||
{% endif %}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{% extends "withnav_template.html" %}
|
||||
{% from "components/folder-path.html" import folder_path, page_title_folder_path %}
|
||||
{% from "components/textbox.html" import textbox %}
|
||||
{% from "components/checkbox.html" import checkbox, checkboxes %}
|
||||
{% from "components/page-footer.html" import page_footer %}
|
||||
{% from "components/form.html" import form_wrapper %}
|
||||
|
||||
@@ -25,7 +26,7 @@
|
||||
{% call form_wrapper(action=url_for('main.manage_template_folder', service_id=current_service.id, template_folder_id=template_folder_id)) %}
|
||||
{{ textbox(form.name, width='1-1') }}
|
||||
{% if current_user.has_permissions("manage_service") and form.users_with_permission.all_service_users %}
|
||||
{{ form.users_with_permission }}
|
||||
{{ checkboxes(form.users_with_permission, collapsible_opts={ 'field': 'team member' }) }}
|
||||
{% endif %}
|
||||
|
||||
{{ page_footer(
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{% extends "withoutnav_template.html" %}
|
||||
{% from "components/textbox.html" import textbox %}
|
||||
{% from "components/checkbox.html" import checkbox %}
|
||||
{% from "components/page-footer.html" import page_footer %}
|
||||
{% from "components/form.html" import form_wrapper %}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user