-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add component to manage checkbox lists
- Loading branch information
1 parent
0463c95
commit 7271f94
Showing
3 changed files
with
93 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
[% IF ! hide_group %] | ||
<div class="form-item"> | ||
[% END %] | ||
<fieldset class="fieldset" data-name="[% fieldset_name %]"> | ||
<div class="fieldset__legend "> | ||
<legend>[% INCLUDE fields/sub/filter.tt value=label; %]</legend> | ||
[% IF popover_body; INCLUDE fields/sub/popover.tt popover_id=id popover_body=popover_body; END; %] | ||
</div> | ||
[% IF help_text %] | ||
<p id="[% id %]-help" class="form-text"> | ||
[% help_text | html %] | ||
</p> | ||
[% END %] | ||
<div class="list [% list_class %]"> | ||
<ul class="list__items" id="[% id %]"> | ||
[% | ||
IF !message_empty OR items.size; | ||
FOREACH item IN items; | ||
%] | ||
<li class="list__item"> | ||
[% | ||
INCLUDE fields/sub/checkbox.tt | ||
id = item.field_id | ||
name = name | ||
label = item.name | ||
value = item.id | ||
custom_classes = custom_classes | ||
checked = item.is_checked | ||
is_disabled = item.is_disabled | ||
popover_body = ""; | ||
%] | ||
</li> | ||
[% | ||
END; | ||
ELSE; | ||
%] | ||
<li class="list__item"> | ||
[% message_empty %] | ||
</li> | ||
[%- END -%] | ||
</ul> | ||
</div> | ||
</fieldset> | ||
[% INCLUDE snippets/subfield.tt %] | ||
[% IF ! hide_group %] | ||
</div> | ||
[% END %] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,21 @@ | ||
[%- column_class = column_class ? column_class : 'col' -%] | ||
<div class="[% column_class %]"> | ||
<fieldset class="fieldset" data-name="groups"> | ||
<div class="fieldset__legend "> | ||
<legend>Add this user to the following groups</legend> | ||
</div> | ||
|
||
<div class="list [% list_class %]"> | ||
<ul class="list__items"> | ||
[% IF groups.size %] | ||
[% FOREACH group IN groups %] | ||
<li class="list__item"> | ||
[%- | ||
key = group.id; | ||
|
||
INCLUDE fields/sub/checkbox.tt | ||
id = "group_" _ group.id | ||
name = "groups" | ||
label = group.name | ||
value = group.id | ||
checked = edituser.has_group.$key ? 1 : 0 | ||
is_disabled = ! user.permission.superadmin AND ! user.has_group.$key | ||
filter = "html"; | ||
-%] | ||
</li> | ||
[%- END -%] | ||
[%- ELSE -%] | ||
<li class="list__item"> | ||
No groups have been created yet. Groups can be | ||
created in the <a href="[% url.page %]/group_overview/">Manage Groups</a> menu. | ||
</li> | ||
[%- END -%] | ||
</ul> | ||
</div> | ||
</fieldset> | ||
[% | ||
FOREACH group IN groups; | ||
key = group.id; | ||
group.field_id = "groups_" _ item.id | ||
group.is_checked = edituser.has_group.$key ? 1 : 0; | ||
group.is_disabled = ! user.permission.superadmin AND ! user.has_group.$key ? 1 : 0; | ||
END; | ||
|
||
INCLUDE fields/checkbox_list.tt | ||
fieldset_name = "groups" | ||
list_class = list_class | ||
name = "groups" | ||
label = "Add this user to the following groups" | ||
items = groups | ||
filter = "html" | ||
message_empty = "No groups have been created yet. Groups can be created in the <a href='" _ url.page _ "/group_overview/'>Groups</a> menu." | ||
hide_group = 1; | ||
%] | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters