Skip to content

Commit

Permalink
Merge pull request #4616 from opensafely-core/checkbox-styles
Browse files Browse the repository at this point in the history
Update role and permissions checkbox styles
  • Loading branch information
tomodwyer authored Sep 24, 2024
2 parents 2acfb7a + f74209f commit 4f8e2f3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions templates/staff/project/membership_create.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@
{% for value, label in form.roles.field.choices %}
{% with id=forloop.counter0|stringformat:"s" %}
{% fragment as form_label %}
<span class="font-bold block text-base">{{ label }}</span>
<span class="text-sm">{{ value|role_description|linebreaksbr }}</span>
<span class="block font-bold text-base">{{ label }}</span>
<span class="block text-sm">{{ value|role_description|linebreaksbr }}</span>
{% endfragment %}
{% form_checkbox custom_field=True name="roles" id="id_roles_"|add:id|slugify label=form_label value=value checked=False %}
{% endwith %}
Expand Down
5 changes: 2 additions & 3 deletions templates/staff/project/membership_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,9 @@ <h1 class="display-4">{{ membership.user.name }}</h1>
{% endif %}

{% fragment as form_label %}
<span class="font-bold block text-base">{{ label }}</span>
<span class="text-sm">{{ value|role_description|linebreaksbr }}</span>
<span class="block font-bold text-base">{{ label }}</span>
<span class="block text-sm">{{ value|role_description|linebreaksbr }}</span>
{% endfragment %}

{% form_checkbox custom_field=True name="roles" id="id_roles_"|add:id|slugify label=form_label value=value checked=checked %}
{% endwith %}
{% endfor %}
Expand Down
15 changes: 8 additions & 7 deletions templates/staff/user/role_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<form method="POST">
{% csrf_token %}

{% #card title="Global Roles" container=True %}
{% #card title="Assign global roles" subtitle="These roles should only be used for applying permissions to Bennett Institute employees." container=True %}
{% if form.non_field_errors %}
{% for error in form.non_field_errors %}
{% #alert variant="danger" class="mb-6" %}
Expand All @@ -51,20 +51,21 @@
{% endfor %}
{% endif %}

{% form_legend text="Assign roles site-wide (Note: this should usually only be used for internal staff users)" %}
{% form_legend text="Assign roles site-wide" class="sr-only" %}

{% for value, label in form.roles.field.choices %}
{% with id=forloop.counter0|stringformat:"s" %}
{% fragment as rich_label %}
<span class="block">{{ label }}</span>
<span class="text-sm mt-0.5">{{ value|role_description|linebreaksbr }}</span>
{% endfragment %}
{% if value in form.roles.value %}
{% var checked=True %}
{% else %}
{% var checked=False %}
{% endif %}
{% form_checkbox custom_field=True name="roles" id="id_roles_"|add:label|add:"_"|add:id|slugify label=rich_label value=value checked=checked %}

{% fragment as form_label %}
<span class="block font-bold text-base">{{ label }}</span>
<span class="block text-sm">{{ value|role_description|linebreaksbr }}</span>
{% endfragment %}
{% form_checkbox custom_field=True name="roles" id="id_roles_"|add:label|add:"_"|add:id|slugify label=form_label value=value checked=checked %}
{% endwith %}
{% endfor %}
{% /form_fieldset %}
Expand Down

0 comments on commit 4f8e2f3

Please sign in to comment.