diff app/controllers/trackers_controller.rb @ 1115:433d4f72a19b redmine-2.2

Update to Redmine SVN revision 11137 on 2.2-stable branch
author Chris Cannam
date Mon, 07 Jan 2013 12:01:42 +0000
parents cbb26bc654de
children 622f24f53b42
line wrap: on
line diff
--- a/app/controllers/trackers_controller.rb	Wed Jun 27 14:54:18 2012 +0100
+++ b/app/controllers/trackers_controller.rb	Mon Jan 07 12:01:42 2013 +0000
@@ -1,5 +1,5 @@
 # Redmine - project management software
-# Copyright (C) 2006-2011  Jean-Philippe Lang
+# Copyright (C) 2006-2012  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
@@ -29,7 +29,7 @@
         render :action => "index", :layout => false if request.xhr?
       }
       format.api {
-        @trackers = Tracker.all
+        @trackers = Tracker.sorted.all
       }
     end
   end
@@ -45,7 +45,7 @@
     if request.post? and @tracker.save
       # workflow copy
       if !params[:copy_workflow_from].blank? && (copy_from = Tracker.find_by_id(params[:copy_workflow_from]))
-        @tracker.workflows.copy(copy_from)
+        @tracker.workflow_rules.copy(copy_from)
       end
       flash[:notice] = l(:notice_successful_create)
       redirect_to :action => 'index'
@@ -59,7 +59,7 @@
     @tracker ||= Tracker.find(params[:id])
     @projects = Project.find(:all)
   end
-  
+
   def update
     @tracker = Tracker.find(params[:id])
     if request.put? and @tracker.update_attributes(params[:tracker])
@@ -71,7 +71,6 @@
     render :action => 'edit'
   end
 
-  verify :method => :delete, :only => :destroy, :redirect_to => { :action => :index }
   def destroy
     @tracker = Tracker.find(params[:id])
     unless @tracker.issues.empty?
@@ -81,4 +80,22 @@
     end
     redirect_to :action => 'index'
   end
+
+  def fields
+    if request.post? && params[:trackers]
+      params[:trackers].each do |tracker_id, tracker_params|
+        tracker = Tracker.find_by_id(tracker_id)
+        if tracker
+          tracker.core_fields = tracker_params[:core_fields]
+          tracker.custom_field_ids = tracker_params[:custom_field_ids]
+          tracker.save
+        end
+      end
+      flash[:notice] = l(:notice_successful_update)
+      redirect_to :action => 'fields'
+      return
+    end
+    @trackers = Tracker.sorted.all
+    @custom_fields = IssueCustomField.all.sort
+  end
 end