Use user-autocompleter component to select group members

pull/7521/head
Henriette Dinger 5 years ago
parent d1e7257a67
commit 04b291f127
  1. 43
      app/views/groups/_users.html.erb

@ -45,32 +45,25 @@ See docs/COPYRIGHT.rdoc for more details.
.not_builtin .not_builtin
.active .active
.not_in_group(@group) .not_in_group(@group)
.limit(100) %> .limit(1) %>
<% if users.any? %> <% if users.any? %>
<%= styled_form_tag(members_of_group_path(@group), method: :post) do |f| %> <%= styled_form_tag(members_of_group_path(@group), method: :post) do %>
<remote-field-updater url="<%= url_for(controller: '/groups', action: 'autocomplete_for_user', id: @group)%>"> <fieldset class="form--fieldset">
<fieldset class="form--fieldset"> <legend class="form--fieldset-legend"><%=l(:label_user_new)%></legend>
<legend class="form--fieldset-legend"><%=l(:label_user_new)%></legend> <div class="form--field -vertical">
<div class="form--field -vertical"> <% user_ids = [] %>
<%= styled_label_tag "user_search", l(:label_user_search) %> <% @group.users.each do |user| %>
<div class="form--field-container"> <% user_ids.push(user.id) %>
<%= styled_text_field_tag 'user_search', <% end %>
nil,
class: 'remote-field--input', <%= hidden_field_tag :user_ids, user_ids %>
data: { :'remote-field-key' =>'q' } %> <user-autocompleter data-update-input="user_ids"></user-autocompleter>
</div> </div>
</div> <div>
<div class="form--field -vertical"> <%= styled_button_tag l(:button_add),
<div id="users" class="remote-field--target form--field-container -vertical"> class: '-highlight -with-icon icon-checkmark' %>
<%= principals_check_box_tags 'user_ids[]', users %> </div>
</div> </fieldset>
</div>
</fieldset>
</remote-field-updater>
<div>
<%= styled_button_tag l(:button_add),
class: '-highlight -with-icon icon-checkmark' %>
</div>
<% end %> <% end %>
<% end %> <% end %>
</div> </div>

Loading…
Cancel
Save