@@ -23,6 +23,20 module UsersHelper | |||||
23 | [l(:status_locked), 3]], selected) |
|
23 | [l(:status_locked), 3]], selected) | |
24 | end |
|
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 | def change_status_link(user) |
|
40 | def change_status_link(user) | |
27 | url = {:action => 'edit', :id => user, :page => params[:page], :status => params[:status]} |
|
41 | url = {:action => 'edit', :id => user, :page => params[:page], :status => params[:status]} | |
28 |
|
42 |
@@ -13,17 +13,17 | |||||
13 | </p> |
|
13 | </p> | |
14 | <% end %> |
|
14 | <% end %> | |
15 | <% end %> |
|
15 | <% end %> | |
|
16 | ||||
|
17 | <% if @projects.any? %> | |||
16 | <hr /> |
|
18 | <hr /> | |
17 | <p> |
|
19 | <p> | |
18 | <label><%=l(:label_project_new)%></label><br/> |
|
20 | <label><%=l(:label_project_new)%></label><br/> | |
19 | <% form_tag({ :action => 'edit_membership', :id => @user }) do %> |
|
21 | <% form_tag({ :action => 'edit_membership', :id => @user }) do %> | |
20 | <select name="membership[project_id]"> |
|
22 | <%= select_tag 'membership[project_id]', projects_options_for_select(@projects) %> | |
21 | <%= options_from_collection_for_select @projects, "id", "name", @membership.project_id %> |
|
23 | <%= l(:label_role) %>: | |
22 | </select> |
|
24 | <%= select_tag 'membership[role_id]', options_from_collection_for_select(@roles, "id", "name") %> | |
23 | <select name="membership[role_id]"> |
|
|||
24 | <%= options_from_collection_for_select @roles, "id", "name", @membership.role_id %> |
|
|||
25 | </select> |
|
|||
26 | <%= submit_tag l(:button_add) %> |
|
25 | <%= submit_tag l(:button_add) %> | |
27 | <% end %> |
|
26 | <% end %> | |
28 | </p> |
|
27 | </p> | |
|
28 | <% end %> | |||
29 | </div> No newline at end of file |
|
29 | </div> |
General Comments 0
You need to be logged in to leave comments.
Login now