diff app/controllers/projects_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 0c939c159af4
children 5e80956cc792 5f33065ddc4b
line wrap: on
line diff
--- a/app/controllers/projects_controller.rb	Fri Feb 24 18:36:29 2012 +0000
+++ b/app/controllers/projects_controller.rb	Fri Feb 24 19:09:32 2012 +0000
@@ -5,12 +5,12 @@
 # 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.
@@ -19,7 +19,7 @@
   menu_item :overview
   menu_item :roadmap, :only => :roadmap
   menu_item :settings, :only => :settings
-  
+
   before_filter :find_project, :except => [ :index, :list, :new, :create, :copy ]
   before_filter :authorize, :except => [ :index, :list, :new, :create, :copy, :archive, :unarchive, :destroy]
   before_filter :authorize_global, :only => [:new, :create]
@@ -36,19 +36,19 @@
   helper :sort
   include SortHelper
   helper :custom_fields
-  include CustomFieldsHelper   
+  include CustomFieldsHelper
   helper :issues
   helper :queries
   include QueriesHelper
   helper :repositories
   include RepositoriesHelper
   include ProjectsHelper
-  
+
   # Lists visible projects
   def index
     respond_to do |format|
-      format.html { 
-        @projects = Project.visible.find(:all, :order => 'lft') 
+      format.html {
+        @projects = Project.visible.find(:all, :order => 'lft')
       }
       format.api  {
         @offset, @limit = api_offset_and_limit
@@ -62,7 +62,7 @@
       }
     end
   end
-  
+
   def new
     @issue_custom_fields = IssueCustomField.find(:all, :order => "#{CustomField.table_name}.position")
     @trackers = Tracker.all
@@ -85,9 +85,12 @@
         @project.members << m
       end
       respond_to do |format|
-        format.html { 
+        format.html {
           flash[:notice] = l(:notice_successful_create)
-          redirect_to :controller => 'projects', :action => 'settings', :id => @project
+          redirect_to(params[:continue] ?
+            {:controller => 'projects', :action => 'new', :project => {:parent_id => @project.parent_id}.reject {|k,v| v.nil?}} :
+            {:controller => 'projects', :action => 'settings', :id => @project}
+          )
         }
         format.api  { render :action => 'show', :status => :created, :location => url_for(:controller => 'projects', :action => 'show', :id => @project.id) }
       end
@@ -97,9 +100,9 @@
         format.api  { render_validation_errors(@project) }
       end
     end
-    
+
   end
-  
+
   def copy
     @issue_custom_fields = IssueCustomField.find(:all, :order => "#{CustomField.table_name}.position")
     @trackers = Tracker.all
@@ -113,7 +116,7 @@
         @project.identifier = Project.next_identifier if Setting.sequential_project_identifiers?
       else
         redirect_to :controller => 'admin', :action => 'projects'
-      end  
+      end
     else
       Mailer.with_deliveries(params[:notifications] == '1') do
         @project = Project.new
@@ -141,27 +144,27 @@
       # try to redirect to the requested menu item
       redirect_to_project_menu_item(@project, params[:jump]) && return
     end
-    
+
     @users_by_role = @project.users_by_role
     @subprojects = @project.children.visible.all
     @news = @project.news.find(:all, :limit => 5, :include => [ :author, :project ], :order => "#{News.table_name}.created_on DESC")
     @trackers = @project.rolled_up_trackers
-    
+
     cond = @project.project_condition(Setting.display_subprojects_issues?)
-    
+
     @open_issues_by_tracker = Issue.visible.count(:group => :tracker,
                                             :include => [:project, :status, :tracker],
                                             :conditions => ["(#{cond}) AND #{IssueStatus.table_name}.is_closed=?", false])
     @total_issues_by_tracker = Issue.visible.count(:group => :tracker,
                                             :include => [:project, :status, :tracker],
                                             :conditions => cond)
-    
+
     if User.current.allowed_to?(:view_time_entries, @project)
       @total_hours = TimeEntry.visible.sum(:hours, :include => :project, :conditions => cond).to_f
     end
-    
+
     @key = User.current.rss_key
-    
+
     respond_to do |format|
       format.html
       format.api
@@ -176,7 +179,7 @@
     @repository ||= @project.repository
     @wiki ||= @project.wiki
   end
-  
+
   def edit
   end
 
@@ -187,7 +190,7 @@
     if validate_parent_id && @project.save
       @project.set_allowed_parent!(params[:project]['parent_id']) if params[:project].has_key?('parent_id')
       respond_to do |format|
-        format.html { 
+        format.html {
           flash[:notice] = l(:notice_successful_update)
           redirect_to :action => 'settings', :id => @project
         }
@@ -195,7 +198,7 @@
       end
     else
       respond_to do |format|
-        format.html { 
+        format.html {
           settings
           render :action => 'settings'
         }
@@ -219,12 +222,12 @@
     end
     redirect_to(url_for(:controller => 'admin', :action => 'projects', :status => params[:status]))
   end
-  
+
   def unarchive
     @project.unarchive if request.post? && !@project.active?
     redirect_to(url_for(:controller => 'admin', :action => 'projects', :status => params[:status]))
   end
-  
+
   # Delete @project
   def destroy
     @project_to_destroy = @project