Revert "Merge pull request #2969 from alphagov/revert-2956-progressively-enhance-folder-permissions"

This reverts commit 8266f3d65c, reversing
changes made to b2a38fe222.
This commit is contained in:
Tom Byers
2019-05-15 14:26:51 +01:00
parent 00e7ccadad
commit ccd09b9fd7
13 changed files with 850 additions and 22 deletions

View File

@@ -19,13 +19,13 @@
{% endmacro %}
{% macro checkboxes_nested(field, child_map, hint=None, disable=[], option_hints={}, hide_legend=False) %}
{{ select_nested(field, child_map, hint, disable, option_hints, hide_legend, input="checkbox") }}
{% 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) %}
{{ select(field, hint, disable, option_hints, hide_legend, input="checkbox") }}
{% 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 %}

View File

@@ -1,6 +1,6 @@
{% macro select(field, hint=None, disable=[], option_hints={}, hide_legend=False, input="radio") %}
{% macro select(field, hint=None, disable=[], option_hints={}, hide_legend=False, collapsible_opts={}, legend_style="text", input="radio") %}
{% call select_wrapper(
field, hint, disable, option_hints, hide_legend
field, hint, disable, option_hints, hide_legend, collapsible_opts, legend_style
) %}
{% for option in field %}
{{ select_input(option, disable, option_hints, input=input) }}
@@ -24,9 +24,9 @@
{% endmacro %}
{% macro select_nested(field, child_map, hint=None, disable=[], option_hints={}, hide_legend=False, input="radio") %}
{% macro select_nested(field, child_map, hint=None, disable=[], option_hints={}, hide_legend=False, collapsible_opts={}, legend_style="text", input="radio") %}
{% call select_wrapper(
field, hint, disable, option_hints, hide_legend
field, hint, disable, option_hints, hide_legend, collapsible_opts, legend_style
) %}
<div class="{{ "radios" if input == "radio" else "checkboxes" }}-nested">
{{ select_list(child_map[None], child_map, disable, option_hints, input=input) }}
@@ -35,10 +35,14 @@
{% endmacro %}
{% macro select_wrapper(field, hint=None, disable=[], option_hints={}, hide_legend=False) %}
<div class="form-group {% if field.errors %} form-group-error{% endif %}">
<fieldset>
<legend class="{{ 'form-label' if not hide_legend else '' }}">
{% macro select_wrapper(field, hint=None, disable=[], option_hints={}, hide_legend=False, collapsible_opts={}, legend_style="text") %}
{% set is_collapsible = collapsible_opts|length %}
<div class="form-group {% if field.errors %} form-group-error{% endif %}"{% if is_collapsible %} data-module="collapsible-checkboxes"{% if collapsible_opts.field %} data-field-label="{{ collapsible_opts.field }}"{% endif %}{% endif %}>
{% if is_collapsible %}
<div class="selection-summary" role="region" aria-live="polite"></div>
{% endif %}
<fieldset id="{{ field.id }}">
<legend class="{{ 'form-label' if not hide_legend else '' }}{% if legend_style != 'text' %} {{ legend_style }}{% endif %}">
{% if hide_legend %}<span class="visually-hidden">{% endif %}
{{ field.label.text|safe }}
{% if hide_legend %}</span>{% endif %}

View File

@@ -2,20 +2,19 @@
{% from "components/radios.html" import radio, radios, conditional_radio_panel %}
<fieldset class="form-group">
<legend class="form-label">
<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>
<p class="bottom-gutter">
All team members can see sent messages.
</p>
{% if current_service.has_permission("edit_folder_permissions") and form.folder_permissions.all_template_folders %}
{{ checkboxes_nested(form.folder_permissions, form.folder_permissions.children()) }}
{{ checkboxes_nested(form.folder_permissions, form.folder_permissions.children(), hide_legend=True, collapsible_opts={ 'field': 'folder' }) }}
{% endif %}
{% if service_has_email_auth %}

View File

@@ -27,7 +27,7 @@
{{ textbox(form.name, width='1-1') }}
{% if current_service.has_permission("edit_folder_permissions") %}
{% if current_user.has_permissions("manage_service") and form.users_with_permission.all_service_users %}
{{ checkboxes(form.users_with_permission) }}
{{ checkboxes(form.users_with_permission, collapsible_opts={ 'field': 'team member' }) }}
{% endif %}
{% endif %}