diff app/controllers/groups_controller.rb @ 909:cbb26bc654de redmine-1.3

Update to Redmine 1.3-stable branch (Redmine SVN rev 8964)
author Chris Cannam
date Fri, 24 Feb 2012 19:09:32 +0000
parents cbce1fd3b1b7
children 433d4f72a19b
line wrap: on
line diff
--- a/app/controllers/groups_controller.rb	Fri Feb 24 18:36:29 2012 +0000
+++ b/app/controllers/groups_controller.rb	Fri Feb 24 19:09:32 2012 +0000
@@ -1,27 +1,27 @@
 # Redmine - project management software
-# Copyright (C) 2006-2009  Jean-Philippe Lang
+# Copyright (C) 2006-2011  Jean-Philippe Lang
 #
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
 # as published by the Free Software Foundation; either version 2
 # of the License, or (at your option) any later version.
-# 
+#
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
-# 
+#
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
 class GroupsController < ApplicationController
   layout 'admin'
-  
+
   before_filter :require_admin
-  
+
   helper :custom_fields
-  
+
   # GET /groups
   # GET /groups.xml
   def index
@@ -48,7 +48,7 @@
   # GET /groups/new.xml
   def new
     @group = Group.new
-    
+
     respond_to do |format|
       format.html # new.html.erb
       format.xml  { render :xml => @group }
@@ -67,8 +67,10 @@
 
     respond_to do |format|
       if @group.save
-        flash[:notice] = l(:notice_successful_create)
-        format.html { redirect_to(groups_path) }
+        format.html {
+          flash[:notice] = l(:notice_successful_create)
+          redirect_to(params[:continue] ? new_group_path : groups_path)
+        }
         format.xml  { render :xml => @group, :status => :created, :location => @group }
       else
         format.html { render :action => "new" }
@@ -105,37 +107,37 @@
       format.xml  { head :ok }
     end
   end
-  
+
   def add_users
     @group = Group.find(params[:id])
     users = User.find_all_by_id(params[:user_ids])
     @group.users << users if request.post?
     respond_to do |format|
       format.html { redirect_to :controller => 'groups', :action => 'edit', :id => @group, :tab => 'users' }
-      format.js { 
-        render(:update) {|page| 
+      format.js {
+        render(:update) {|page|
           page.replace_html "tab-content-users", :partial => 'groups/users'
           users.each {|user| page.visual_effect(:highlight, "user-#{user.id}") }
         }
       }
     end
   end
-  
+
   def remove_user
     @group = Group.find(params[:id])
-    @group.users.delete(User.find(params[:user_id])) if request.post?
+    @group.users.delete(User.find(params[:user_id])) if request.delete?
     respond_to do |format|
       format.html { redirect_to :controller => 'groups', :action => 'edit', :id => @group, :tab => 'users' }
       format.js { render(:update) {|page| page.replace_html "tab-content-users", :partial => 'groups/users'} }
     end
   end
-  
+
   def autocomplete_for_user
     @group = Group.find(params[:id])
     @users = User.active.not_in_group(@group).like(params[:q]).all(:limit => 100)
     render :layout => false
   end
-  
+
   def edit_membership
     @group = Group.find(params[:id])
     @membership = Member.edit_membership(params[:membership_id], params[:membership], @group)
@@ -158,7 +160,7 @@
       end
     end
   end
-  
+
   def destroy_membership
     @group = Group.find(params[:id])
     Member.find(params[:membership_id]).destroy if request.post?