@@ -1,27 +1,27 | |||||
1 | # Redmine - project management software |
|
1 | # Redmine - project management software | |
2 |
# Copyright (C) 2006-20 |
|
2 | # Copyright (C) 2006-2011 Jean-Philippe Lang | |
3 | # |
|
3 | # | |
4 | # This program is free software; you can redistribute it and/or |
|
4 | # This program is free software; you can redistribute it and/or | |
5 | # modify it under the terms of the GNU General Public License |
|
5 | # modify it under the terms of the GNU General Public License | |
6 | # as published by the Free Software Foundation; either version 2 |
|
6 | # as published by the Free Software Foundation; either version 2 | |
7 | # of the License, or (at your option) any later version. |
|
7 | # of the License, or (at your option) any later version. | |
8 |
# |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 |
# |
|
13 | # | |
14 | # You should have received a copy of the GNU General Public License |
|
14 | # You should have received a copy of the GNU General Public License | |
15 | # along with this program; if not, write to the Free Software |
|
15 | # along with this program; if not, write to the Free Software | |
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 |
|
17 | |||
18 | class GroupsController < ApplicationController |
|
18 | class GroupsController < ApplicationController | |
19 | layout 'admin' |
|
19 | layout 'admin' | |
20 |
|
20 | |||
21 | before_filter :require_admin |
|
21 | before_filter :require_admin | |
22 |
|
22 | |||
23 | helper :custom_fields |
|
23 | helper :custom_fields | |
24 |
|
24 | |||
25 | # GET /groups |
|
25 | # GET /groups | |
26 | # GET /groups.xml |
|
26 | # GET /groups.xml | |
27 | def index |
|
27 | def index | |
@@ -48,7 +48,7 class GroupsController < ApplicationController | |||||
48 | # GET /groups/new.xml |
|
48 | # GET /groups/new.xml | |
49 | def new |
|
49 | def new | |
50 | @group = Group.new |
|
50 | @group = Group.new | |
51 |
|
51 | |||
52 | respond_to do |format| |
|
52 | respond_to do |format| | |
53 | format.html # new.html.erb |
|
53 | format.html # new.html.erb | |
54 | format.xml { render :xml => @group } |
|
54 | format.xml { render :xml => @group } | |
@@ -107,22 +107,22 class GroupsController < ApplicationController | |||||
107 | format.xml { head :ok } |
|
107 | format.xml { head :ok } | |
108 | end |
|
108 | end | |
109 | end |
|
109 | end | |
110 |
|
110 | |||
111 | def add_users |
|
111 | def add_users | |
112 | @group = Group.find(params[:id]) |
|
112 | @group = Group.find(params[:id]) | |
113 | users = User.find_all_by_id(params[:user_ids]) |
|
113 | users = User.find_all_by_id(params[:user_ids]) | |
114 | @group.users << users if request.post? |
|
114 | @group.users << users if request.post? | |
115 | respond_to do |format| |
|
115 | respond_to do |format| | |
116 | format.html { redirect_to :controller => 'groups', :action => 'edit', :id => @group, :tab => 'users' } |
|
116 | format.html { redirect_to :controller => 'groups', :action => 'edit', :id => @group, :tab => 'users' } | |
117 |
format.js { |
|
117 | format.js { | |
118 |
render(:update) {|page| |
|
118 | render(:update) {|page| | |
119 | page.replace_html "tab-content-users", :partial => 'groups/users' |
|
119 | page.replace_html "tab-content-users", :partial => 'groups/users' | |
120 | users.each {|user| page.visual_effect(:highlight, "user-#{user.id}") } |
|
120 | users.each {|user| page.visual_effect(:highlight, "user-#{user.id}") } | |
121 | } |
|
121 | } | |
122 | } |
|
122 | } | |
123 | end |
|
123 | end | |
124 | end |
|
124 | end | |
125 |
|
125 | |||
126 | def remove_user |
|
126 | def remove_user | |
127 | @group = Group.find(params[:id]) |
|
127 | @group = Group.find(params[:id]) | |
128 | @group.users.delete(User.find(params[:user_id])) if request.post? |
|
128 | @group.users.delete(User.find(params[:user_id])) if request.post? | |
@@ -131,13 +131,13 class GroupsController < ApplicationController | |||||
131 | format.js { render(:update) {|page| page.replace_html "tab-content-users", :partial => 'groups/users'} } |
|
131 | format.js { render(:update) {|page| page.replace_html "tab-content-users", :partial => 'groups/users'} } | |
132 | end |
|
132 | end | |
133 | end |
|
133 | end | |
134 |
|
134 | |||
135 | def autocomplete_for_user |
|
135 | def autocomplete_for_user | |
136 | @group = Group.find(params[:id]) |
|
136 | @group = Group.find(params[:id]) | |
137 | @users = User.active.not_in_group(@group).like(params[:q]).all(:limit => 100) |
|
137 | @users = User.active.not_in_group(@group).like(params[:q]).all(:limit => 100) | |
138 | render :layout => false |
|
138 | render :layout => false | |
139 | end |
|
139 | end | |
140 |
|
140 | |||
141 | def edit_membership |
|
141 | def edit_membership | |
142 | @group = Group.find(params[:id]) |
|
142 | @group = Group.find(params[:id]) | |
143 | @membership = Member.edit_membership(params[:membership_id], params[:membership], @group) |
|
143 | @membership = Member.edit_membership(params[:membership_id], params[:membership], @group) | |
@@ -160,7 +160,7 class GroupsController < ApplicationController | |||||
160 | end |
|
160 | end | |
161 | end |
|
161 | end | |
162 | end |
|
162 | end | |
163 |
|
163 | |||
164 | def destroy_membership |
|
164 | def destroy_membership | |
165 | @group = Group.find(params[:id]) |
|
165 | @group = Group.find(params[:id]) | |
166 | Member.find(params[:membership_id]).destroy if request.post? |
|
166 | Member.find(params[:membership_id]).destroy if request.post? |
General Comments 0
You need to be logged in to leave comments.
Login now