Commit e39cc88f authored by Phil Hughes's avatar Phil Hughes

Use GL dropdowns to update group members

parent ea76b6bc
......@@ -32,17 +32,25 @@
$btn.glDropdown({
selectable: true,
fieldName: 'test',
id () {
return 1;
fieldName: $btn.data('field-name'),
id (selected, $el) {
return $el.data('id');
},
toggleLabel (selected, $el) {
console.log($el.text().trim());
return $el.text();
},
clicked: (selected, $el) => {
const $link = $($el);
if ($link.data('revert')) {
const memberListitem = this.getMemberListItem($link.get(0));
const memberListItem = this.getMemberListItem($link.get(0));
const toggle = memberListItem.querySelectorAll('.dropdown-menu-toggle')[0];
this.overrideLdap(memberListitem, $link.data('endpoint'), false);
toggle.disabled = true;
this.overrideLdap(memberListItem, $link.data('endpoint'), false);
} else {
$btn.closest('form').trigger("submit.rails");
}
}
});
......
......@@ -117,6 +117,7 @@
.alert-member-ldap {
background-color: #fff1e0;
line-height: 40px;
> p {
float: left;
......
......@@ -34,6 +34,10 @@
%span{ class: ('text-warning' if member.expires_soon?) }
Expires in #{distance_of_time_in_words_to_now(member.expires_at)}
- if member.ldap
%span.label.label-info.pull-right.visible-xs-block
LDAP
- else
= image_tag avatar_icon(member.invite_email, 40), class: "avatar s40", alt: ''
%strong= member.invite_email
......@@ -46,17 +50,19 @@
- if show_roles
.controls.member-controls
- if member.ldap
%span.label.label-info.members-ldap
%span.label.label-info.members-ldap.hidden-xs
LDAP
- if show_controls && (member.respond_to?(:group) && @group) || (member.respond_to?(:project) && @project)
- if user != current_user
= form_for member, remote: true, html: { class: 'form-horizontal js-edit-member-form' } do |f|
= f.hidden_field :access_level
-# = f.select :access_level, options_for_select(member.class.access_level_roles, member.access_level), {}, class: 'form-control member-form-control append-right-5 js-member-update-control', id: "member_access_level_#{member.id}", disabled: !can_admin_member
.member-form-control.dropdown.append-right-5
%button.dropdown-menu-toggle.js-member-permissions-dropdown{ type: "button",
disabled: member.ldap && !member.override,
data: { toggle: "dropdown" } }
= member.human_access
data: { toggle: "dropdown", field_name: "#{f.object_name}[access_level]" } }
%span.dropdown-toggle-text
= member.human_access
= icon("caret-down")
.dropdown-menu.dropdown-select.dropdown-menu-align-right.dropdown-menu-selectable
= dropdown_title("Change permissions")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment