1
0
mirror of https://github.com/meineerde/redmine.git synced 2026-03-16 14:08:13 +00:00

Slight change to the project combo for adding membership on user administration screen.

All projects are listed, and the ones that the user belongs to are disabled.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/work@2301 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2009-01-23 18:33:19 +00:00
parent aaeba2dd20
commit f1a123add6
3 changed files with 6 additions and 4 deletions

View File

@ -83,7 +83,7 @@ class UsersController < ApplicationController
end
@auth_sources = AuthSource.find(:all)
@roles = Role.find_all_givable
@projects = Project.find(:all, :order => 'name', :conditions => "status=#{Project::STATUS_ACTIVE}") - @user.projects
@projects = Project.active.find(:all, :order => 'lft')
@membership ||= Member.new
@memberships = @user.memberships
end

View File

@ -25,9 +25,11 @@ module UsersHelper
end
# Options for the new membership projects combo-box
def projects_options_for_select(projects)
def options_for_membership_project_select(user, projects)
options = content_tag('option', "--- #{l(:actionview_instancetag_blank_option)} ---")
options << project_tree_options_for_select(projects)
options << project_tree_options_for_select(projects) do |p|
{:disabled => (user.projects.include?(p))}
end
options
end

View File

@ -31,7 +31,7 @@
<p>
<label><%=l(:label_project_new)%></label><br/>
<% form_tag({ :action => 'edit_membership', :id => @user }) do %>
<%= select_tag 'membership[project_id]', projects_options_for_select(@projects) %>
<%= select_tag 'membership[project_id]', options_for_membership_project_select(@user, @projects) %>
<%= l(:label_role) %>:
<%= select_tag 'membership[role_id]', options_from_collection_for_select(@roles, "id", "name") %>
<%= submit_tag l(:button_add) %>