diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2009-03-28 12:07:05 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2009-03-28 12:07:05 +0000 |
commit | 04e181b8b05d00a95d49aea0435f8542914b0fbc (patch) | |
tree | ebd9c00a13a4655b33df9a0d94bbae0272116954 /app/views | |
parent | b4be8849c0de81841c458c0f059787a9cc9bc022 (diff) | |
download | redmine-04e181b8b05d00a95d49aea0435f8542914b0fbc.tar.gz redmine-04e181b8b05d00a95d49aea0435f8542914b0fbc.zip |
Adds a user search field with autocompleter on project members screen.
User selection with checkboxes is disabled if there are more than 300 users available (#2993).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2638 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/views')
-rw-r--r-- | app/views/members/autocomplete_for_member_login.rhtml | 5 | ||||
-rw-r--r-- | app/views/projects/settings/_members.rhtml | 25 |
2 files changed, 21 insertions, 9 deletions
diff --git a/app/views/members/autocomplete_for_member_login.rhtml b/app/views/members/autocomplete_for_member_login.rhtml new file mode 100644 index 000000000..09a08bf95 --- /dev/null +++ b/app/views/members/autocomplete_for_member_login.rhtml @@ -0,0 +1,5 @@ +<ul> +<% @users.each do |user| -%> + <li><%= h user.login %><span class="informal"> (<%= h(user.name(:lastname_coma_firstname)) %>)</span></li> +<% end -%> +</ul> diff --git a/app/views/projects/settings/_members.rhtml b/app/views/projects/settings/_members.rhtml index f70cef5a8..312403993 100644 --- a/app/views/projects/settings/_members.rhtml +++ b/app/views/projects/settings/_members.rhtml @@ -1,7 +1,5 @@ <%= error_messages_for 'member' %> -<% roles = Role.find_all_givable %> -<% users = User.active.find(:all).sort - @project.users %> -<% # members sorted by role position +<% roles = Role.find_all_givable members = @project.members.find(:all, :include => [:role, :user]).sort %> <div class="splitcontentleft"> @@ -42,15 +40,24 @@ <% end %> </div> + +<% users_count = User.active.count - @project.users.count + users = (users_count < 300) ? User.active.find(:all, :limit => 200).sort - @project.users : [] %> + <div class="splitcontentright"> -<% if !users.empty? %> +<% if roles.any? && users_count > 0 %> <% remote_form_for(:member, @member, :url => {:controller => 'members', :action => 'new', :id => @project}, :method => :post) do |f| %> <fieldset><legend><%=l(:label_member_new)%></legend> - <div> - <% users.each do |user| -%> - <label><%= check_box_tag 'member[user_ids][]', user.id, false %> <%= user %></label> - <% end -%> - </div> + <p><%= text_field_tag 'member[user_login]', nil, :size => "40" %></p> + <div id="member_user_login_choices" class="autocomplete">sqd</div> + <%= javascript_tag "new Ajax.Autocompleter('member_user_login', 'member_user_login_choices', '#{ url_for(:controller => 'members', :action => 'autocomplete_for_member_login', :id => @project) }', { minChars: 1, frequency: 0.5, paramName: 'user' });" %> + <% unless users.empty? %> + <div> + <% users.each do |user| -%> + <label><%= check_box_tag 'member[user_ids][]', user.id, false %> <%= user %></label> + <% end -%> + </div> + <% end %> <p><%= l(:label_role) %>: <%= f.select :role_id, roles.collect{|role| [role.name, role.id]}, :selected => nil %> <%= submit_tag l(:button_add) %></p> </fieldset> |