@@ -1,37 +1,51 | |||
|
1 | 1 | # redMine - project management software |
|
2 | 2 | # Copyright (C) 2006 Jean-Philippe Lang |
|
3 | 3 | # |
|
4 | 4 | # This program is free software; you can redistribute it and/or |
|
5 | 5 | # modify it under the terms of the GNU General Public License |
|
6 | 6 | # as published by the Free Software Foundation; either version 2 |
|
7 | 7 | # of the License, or (at your option) any later version. |
|
8 | 8 | # |
|
9 | 9 | # This program is distributed in the hope that it will be useful, |
|
10 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | 12 | # GNU General Public License for more details. |
|
13 | 13 | # |
|
14 | 14 | # You should have received a copy of the GNU General Public License |
|
15 | 15 | # along with this program; if not, write to the Free Software |
|
16 | 16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
17 | 17 | |
|
18 | 18 | module UsersHelper |
|
19 | 19 | def status_options_for_select(selected) |
|
20 | 20 | options_for_select([[l(:label_all), ''], |
|
21 | 21 | [l(:status_active), 1], |
|
22 | 22 | [l(:status_registered), 2], |
|
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 | |
|
29 | 43 | if user.locked? |
|
30 | 44 | link_to l(:button_unlock), url.merge(:user => {:status => User::STATUS_ACTIVE}), :method => :post, :class => 'icon icon-unlock' |
|
31 | 45 | elsif user.registered? |
|
32 | 46 | link_to l(:button_activate), url.merge(:user => {:status => User::STATUS_ACTIVE}), :method => :post, :class => 'icon icon-unlock' |
|
33 | 47 | else |
|
34 | 48 | link_to l(:button_lock), url.merge(:user => {:status => User::STATUS_LOCKED}), :method => :post, :class => 'icon icon-lock' |
|
35 | 49 | end |
|
36 | 50 | end |
|
37 | 51 | end |
@@ -1,29 +1,29 | |||
|
1 | 1 | <div class="box" style="margin-top: 16px;"> |
|
2 | 2 | <h3><%= l(:label_project_plural) %></h3> |
|
3 | 3 | |
|
4 | 4 | <% @user.memberships.each do |membership| %> |
|
5 | 5 | <% form_tag({ :action => 'edit_membership', :id => @user, :membership_id => membership }, :class => "tabular") do %> |
|
6 | 6 | <p style="margin:0;padding-top:0;"> |
|
7 | 7 | <label><%= membership.project.name %></label> |
|
8 | 8 | <select name="membership[role_id]"> |
|
9 | 9 | <%= options_from_collection_for_select @roles, "id", "name", membership.role_id %> |
|
10 | 10 | </select> |
|
11 | 11 | <%= submit_tag l(:button_change), :class => "button-small" %> |
|
12 | 12 | <%= link_to l(:button_delete), {:action => 'destroy_membership', :id => @user, :membership_id => membership }, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %> |
|
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