Show the project hierarchy in the drop down list for new membership on user administration screen.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1401 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
f705b889d9
commit
7f8d959171
|
@ -23,6 +23,20 @@ module UsersHelper
|
||||||
[l(:status_locked), 3]], selected)
|
[l(:status_locked), 3]], selected)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Options for the new membership projects combo-box
|
||||||
|
def projects_options_for_select(projects)
|
||||||
|
options = content_tag('option', "--- #{l(:actionview_instancetag_blank_option)} ---")
|
||||||
|
projects_by_root = projects.group_by(&:root)
|
||||||
|
projects_by_root.keys.sort.each do |root|
|
||||||
|
options << content_tag('option', h(root.name), :value => root.id, :disabled => (!projects.include?(root)))
|
||||||
|
projects_by_root[root].sort.each do |project|
|
||||||
|
next if project == root
|
||||||
|
options << content_tag('option', '» ' + h(project.name), :value => project.id)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
options
|
||||||
|
end
|
||||||
|
|
||||||
def change_status_link(user)
|
def change_status_link(user)
|
||||||
url = {:action => 'edit', :id => user, :page => params[:page], :status => params[:status]}
|
url = {:action => 'edit', :id => user, :page => params[:page], :status => params[:status]}
|
||||||
|
|
||||||
|
|
|
@ -13,17 +13,17 @@
|
||||||
</p>
|
</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
<% if @projects.any? %>
|
||||||
<hr />
|
<hr />
|
||||||
<p>
|
<p>
|
||||||
<label><%=l(:label_project_new)%></label><br/>
|
<label><%=l(:label_project_new)%></label><br/>
|
||||||
<% form_tag({ :action => 'edit_membership', :id => @user }) do %>
|
<% form_tag({ :action => 'edit_membership', :id => @user }) do %>
|
||||||
<select name="membership[project_id]">
|
<%= select_tag 'membership[project_id]', projects_options_for_select(@projects) %>
|
||||||
<%= options_from_collection_for_select @projects, "id", "name", @membership.project_id %>
|
<%= l(:label_role) %>:
|
||||||
</select>
|
<%= select_tag 'membership[role_id]', options_from_collection_for_select(@roles, "id", "name") %>
|
||||||
<select name="membership[role_id]">
|
|
||||||
<%= options_from_collection_for_select @roles, "id", "name", @membership.role_id %>
|
|
||||||
</select>
|
|
||||||
<%= submit_tag l(:button_add) %>
|
<%= submit_tag l(:button_add) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</p>
|
</p>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
Loading…
Reference in New Issue