@@ -23,6 +23,20 module UsersHelper | |||
|
23 | 23 | [l(:status_locked), 3]], selected) |
|
24 | 24 | end |
|
25 | 25 | |
|
26 | # Options for the new membership projects combo-box | |
|
27 | def projects_options_for_select(projects) | |
|
28 | options = content_tag('option', "--- #{l(:actionview_instancetag_blank_option)} ---") | |
|
29 | projects_by_root = projects.group_by(&:root) | |
|
30 | projects_by_root.keys.sort.each do |root| | |
|
31 | options << content_tag('option', h(root.name), :value => root.id, :disabled => (!projects.include?(root))) | |
|
32 | projects_by_root[root].sort.each do |project| | |
|
33 | next if project == root | |
|
34 | options << content_tag('option', '» ' + h(project.name), :value => project.id) | |
|
35 | end | |
|
36 | end | |
|
37 | options | |
|
38 | end | |
|
39 | ||
|
26 | 40 | def change_status_link(user) |
|
27 | 41 | url = {:action => 'edit', :id => user, :page => params[:page], :status => params[:status]} |
|
28 | 42 |
@@ -13,17 +13,17 | |||
|
13 | 13 | </p> |
|
14 | 14 | <% end %> |
|
15 | 15 | <% end %> |
|
16 | ||
|
17 | <% if @projects.any? %> | |
|
16 | 18 | <hr /> |
|
17 | 19 | <p> |
|
18 | 20 | <label><%=l(:label_project_new)%></label><br/> |
|
19 | 21 | <% form_tag({ :action => 'edit_membership', :id => @user }) do %> |
|
20 | <select name="membership[project_id]"> | |
|
21 | <%= options_from_collection_for_select @projects, "id", "name", @membership.project_id %> | |
|
22 | </select> | |
|
23 | <select name="membership[role_id]"> | |
|
24 | <%= options_from_collection_for_select @roles, "id", "name", @membership.role_id %> | |
|
25 | </select> | |
|
22 | <%= select_tag 'membership[project_id]', projects_options_for_select(@projects) %> | |
|
23 | <%= l(:label_role) %>: | |
|
24 | <%= select_tag 'membership[role_id]', options_from_collection_for_select(@roles, "id", "name") %> | |
|
26 | 25 | <%= submit_tag l(:button_add) %> |
|
27 | 26 | <% end %> |
|
28 | 27 | </p> |
|
28 | <% end %> | |
|
29 | 29 | </div> No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now