diff app/controllers/trackers_controller.rb @ 1298:4f746d8966dd redmine_2.3_integration

Merge from redmine-2.3 branch to create new branch redmine-2.3-integration
author Chris Cannam
date Fri, 14 Jun 2013 09:28:30 +0100
parents 622f24f53b42
children e248c7af89ec
line wrap: on
line diff
--- a/app/controllers/trackers_controller.rb	Fri Jun 14 09:07:32 2013 +0100
+++ b/app/controllers/trackers_controller.rb	Fri Jun 14 09:28:30 2013 +0100
@@ -1,5 +1,5 @@
 # Redmine - project management software
-# Copyright (C) 2006-2012  Jean-Philippe Lang
+# Copyright (C) 2006-2013  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
@@ -25,7 +25,7 @@
   def index
     respond_to do |format|
       format.html {
-        @tracker_pages, @trackers = paginate :trackers, :per_page => 10, :order => 'position'
+        @tracker_pages, @trackers = paginate Tracker.sorted, :per_page => 25
         render :action => "index", :layout => false if request.xhr?
       }
       format.api {
@@ -36,19 +36,19 @@
 
   def new
     @tracker ||= Tracker.new(params[:tracker])
-    @trackers = Tracker.find :all, :order => 'position'
-    @projects = Project.find(:all)
+    @trackers = Tracker.sorted.all
+    @projects = Project.all
   end
 
   def create
     @tracker = Tracker.new(params[:tracker])
-    if request.post? and @tracker.save
+    if @tracker.save
       # workflow copy
       if !params[:copy_workflow_from].blank? && (copy_from = Tracker.find_by_id(params[:copy_workflow_from]))
         @tracker.workflow_rules.copy(copy_from)
       end
       flash[:notice] = l(:notice_successful_create)
-      redirect_to :action => 'index'
+      redirect_to trackers_path
       return
     end
     new
@@ -57,14 +57,14 @@
 
   def edit
     @tracker ||= Tracker.find(params[:id])
-    @projects = Project.find(:all)
+    @projects = Project.all
   end
 
   def update
     @tracker = Tracker.find(params[:id])
-    if request.put? and @tracker.update_attributes(params[:tracker])
+    if @tracker.update_attributes(params[:tracker])
       flash[:notice] = l(:notice_successful_update)
-      redirect_to :action => 'index'
+      redirect_to trackers_path
       return
     end
     edit
@@ -78,7 +78,7 @@
     else
       @tracker.destroy
     end
-    redirect_to :action => 'index'
+    redirect_to trackers_path
   end
 
   def fields
@@ -92,7 +92,7 @@
         end
       end
       flash[:notice] = l(:notice_successful_update)
-      redirect_to :action => 'fields'
+      redirect_to fields_trackers_path
       return
     end
     @trackers = Tracker.sorted.all