Commit 7316055a authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

multiselect for ajax-users-select2

parent bf17d976
...@@ -11,9 +11,12 @@ $ -> ...@@ -11,9 +11,12 @@ $ ->
markup += "</div>" markup += "</div>"
markup markup
userFormatSelection = (user) ->
user.name
$('.ajax-users-select').select2 $('.ajax-users-select').select2
placeholder: "Search for a user" placeholder: "Search for a user"
multiple: true
minimumInputLength: 0 minimumInputLength: 0
ajax: # instead of writing the function to execute the request we use Select2's convenient helper ajax: # instead of writing the function to execute the request we use Select2's convenient helper
url: "/api/v3/users.json" url: "/api/v3/users.json"
...@@ -40,7 +43,7 @@ $ -> ...@@ -40,7 +43,7 @@ $ ->
formatResult: userFormatResult # omitted for brevity, see the source of this page formatResult: userFormatResult # omitted for brevity, see the source of this page
#formatSelection: userFormatSelection # omitted for brevity, see the source of this page formatSelection: userFormatSelection # omitted for brevity, see the source of this page
dropdownCssClass: "ajax-users-dropdown" # apply css that makes the dropdown taller dropdownCssClass: "ajax-users-dropdown" # apply css that makes the dropdown taller
escapeMarkup: (m) -> # we do not want to escape markup since we are displaying html in results escapeMarkup: (m) -> # we do not want to escape markup since we are displaying html in results
m m
......
...@@ -16,7 +16,7 @@ class TeamMembersController < ProjectResourceController ...@@ -16,7 +16,7 @@ class TeamMembersController < ProjectResourceController
end end
def create def create
users = User.where(id: params[:user_ids]) users = User.where(id: params[:user_ids].split(','))
@project.team << [users, params[:project_access]] @project.team << [users, params[:project_access]]
......
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