Skip to content
This repository has been archived by the owner on Jul 25, 2024. It is now read-only.

[#PAB-508]: add scrollable checkboxes #51

Merged
merged 1 commit into from
Jul 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions app/static/src/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,8 @@
padding-bottom: 40px;
}
}

.scrollable-checkboxes {
max-height: 250px;
overflow-y: auto;
}
24 changes: 13 additions & 11 deletions app/templates/main/checkboxes.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
{% macro checkboxItems(name, items) %}
<div class="govuk-form-group">
<fieldset class="govuk-fieldset" aria-describedby="">
<div class="govuk-checkboxes" data-module="govuk-checkboxes">
{% for item in items %}
{% if item %}
<div class="govuk-checkboxes__item">
<input class="govuk-checkboxes__input" id="{{ name }}-{{ item['id'] }}" name="{{ name }}" type="checkbox"
value="{{ item['id'] }}">
<label class="govuk-label govuk-checkboxes__label" for="{{ name }}-{{ item['id'] }}">
{{ item['name'] }}
</label>
<div class="scrollable-checkboxes">
<div class="govuk-checkboxes" data-module="govuk-checkboxes">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have we tried adding this class as an additional class on the div below?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I'll try that, and refactor it if successful.

{% for item in items %}
{% if item %}
<div class="govuk-checkboxes__item">
<input class="govuk-checkboxes__input" id="{{ name }}-{{ item['id'] }}" name="{{ name }}" type="checkbox"
value="{{ item['id'] }}">
<label class="govuk-label govuk-checkboxes__label" for="{{ name }}-{{ item['id'] }}">
{{ item['name'] }}
</label>
</div>
{%- endif -%}
{%- endfor -%}
</div>
{%- endif -%}
{%- endfor -%}
</div>
</fieldset>
</div>
Expand Down
Loading