A few clean-up items in the Platform Admin section

This commit is contained in:
Jonathan Bobel
2023-08-18 11:30:30 -04:00
parent cc0e0a90f0
commit 51fde90f79
20 changed files with 40 additions and 128 deletions

View File

@@ -8,7 +8,7 @@
autocomplete=True
) %}
<div class="govuk-form-group">
<div class="usa-form-group">
{% if hint %}
{% set attributes = {"aria-describedby": field.name + '-hint'} %}
{% else %}

View File

@@ -93,7 +93,7 @@
</div>
{% endset -%}
<div class="govuk-form-group {%- if params.errorMessage %} govuk-form-group--error{% endif %} {%- if params.formGroup.classes %} {{ params.formGroup.classes }}{% endif %}">
<div class="usa-form-group {%- if params.errorMessage %} usa-form-group--error{% endif %} {%- if params.formGroup.classes %} {{ params.formGroup.classes }}{% endif %}">
{% if params.fieldset %}
{% call govukFieldset({
describedBy: describedBy,

View File

@@ -5,7 +5,7 @@
{#- 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 "" %}
<div class="{%- if params.errorMessage %} usa-form-group--error{% endif %} {%- if params.formGroup.classes %} {{ params.formGroup.classes }}{% endif %}">
<div class="usa-form-group {%- if params.errorMessage %} usa-form-group--error{% endif %} {%- if params.formGroup.classes %} {{ params.formGroup.classes }}{% endif %}">
{{ govukLabel({
html: params.label.html,
text: params.label.text,

View File

@@ -88,7 +88,7 @@
</div>
{% endset -%}
<div class="govuk-form-group {%- if params.errorMessage %} govuk-form-group--error{% endif %} {%- if params.formGroup.classes %} {{ params.formGroup.classes }}{% endif %}">
<div class="usa-form-group {%- if params.errorMessage %} usa-form-group--error{% endif %} {%- if params.formGroup.classes %} {{ params.formGroup.classes }}{% endif %}">
{% if params.fieldset %}
{% call govukFieldset({
describedBy: describedBy,

View File

@@ -5,7 +5,7 @@
{#- 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 "" %}
<div class="govuk-form-group {%- if params.errorMessage %} govuk-form-group--error{% endif %} {%- if params.formGroup.classes %} {{ params.formGroup.classes }}{% endif %}">
<div class="usa-form-group {%- if params.errorMessage %} usa-form-group--error{% endif %} {%- if params.formGroup.classes %} {{ params.formGroup.classes }}{% endif %}">
{{ govukLabel({
html: params.label.html,
text: params.label.text,

View File

@@ -6,7 +6,7 @@
{#- Copied from https://github.com/alphagov/govuk-frontend/blob/v2.13.0/src/components/checkboxes/template.njk
Changes:
- `formGroup` option to control whether or not the checkboxes are wrapped with a `govuk-form-group` class
- `formGroup` option to control whether or not the checkboxes are wrapped with a `usa-form-group` class
- `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
@@ -127,7 +127,7 @@
</{{ groupElement }}>
{% endset -%}
<div class="{% if formGroup %}govuk-form-group{% endif %} {%- if params.errorMessage %} govuk-form-group--error{% endif %} {%- if params.formGroup.classes %} {{ params.formGroup.classes }}{% endif %}">
<div class="{% if formGroup %}usa-form-group{% endif %} {%- if params.errorMessage %} usa-form-group--error{% endif %} {%- if params.formGroup.classes %} {{ params.formGroup.classes }}{% endif %}">
{% if params.fieldset %}
{% call govukFieldset({
describedBy: describedBy,

View File

@@ -121,7 +121,7 @@
</div>
<div class="cookie-settings__form-wrapper">
<form data-module="cookie-settings">
<div class="govuk-form-group govuk-!-margin-top-6">
<div class="usa-form-group govuk-!-margin-top-6">
<fieldset class="govuk-fieldset" aria-describedby="changed-name-hint">
<legend class="govuk-fieldset__legend govuk-fieldset__legend--s">
Do you want to accept analytics cookies?

View File

@@ -40,6 +40,7 @@
{% endif %}
</span>
</h2>
<h3 class="margin-bottom-05">Permissions</h3>
<ul class="tick-cross-list-permissions">
{% for permission, label in permissions %}
{{ tick_cross(

View File

@@ -1,108 +1,3 @@
<!-- {% macro format_item_name(name, separators=True) -%}
{%- 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 -%}
{%- endfor -%}
{% endif %}
{%- endmacro %}
{% if template_list.template_folder_id and not template_list.templates_to_show %}
<p class="template-list-empty">
{% if template_list.folder_is_empty %}
This folder is empty
{% else %}
There are no {{ 1|message_count_label(template_type, suffix='') }} templates in this folder
{% endif %}
</p>
{% else %}
<nav id="template-list">
{% set checkboxes_data = [] %}
{% if not current_user.has_permissions('manage_templates') %}
<ul>
{% endif %}
{% for item in template_list %}
{% set item_link_content %}{% endset %}
{% set label_content %}
<span class="usa-sr-only">
{%- for ancestor in item.ancestors %}{{ format_item_name(ancestor.name, separators=False) }} {% endfor -%}
{{ format_item_name(item.name, separators=False) -}}
</span>
{% 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="usa-link 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="usa-link 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="usa-link usa-template-list-template">
<span class="live-search-relevant">
{%- if current_service.api_keys -%}
<span class="govuk-!-display-none">{{ item.id }} </span>
{%- endif -%}
{{- format_item_name(item.name) -}}
</span>
</a>
{% endif %}
<span id="{{ item.id }}-item-hint" class="usa-checkbox__label-description template-list-item-hint">
{{ 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') %}
<li class="template-list-item {%- if item.ancestors %} template-list-item-hidden-by-default {%- else %} template-list-item-without-ancestors{%- endif %}">
{{ item_link_content }}
<p class="template-list-item-hint govuk-!-margin-bottom-4">
{{ item.hint }}
</p>
</li>
{% endif %}
{% endfor %}
{% if not current_user.has_permissions('manage_templates') %}
</ul>
{% endif %}
{% if current_user.has_permissions('manage_templates') %}
{{ templates_and_folders_form.templates_and_folders(param_extensions={
"items": checkboxes_data,
"formGroup": False
}) }}
{% endif %}
</nav>
{% endif %} -->
{% macro format_item_name(name, separators=True) -%}
{%- if name is string -%}
{{- name -}}