##// END OF EJS Templates
Replaces find(:first/:all) calls....
Replaces find(:first/:all) calls. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10931 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r10704:ea296a109a86
r10704:ea296a109a86
Show More
trackers_controller.rb
101 lines | 3.0 KiB | text/x-ruby | RubyLexer
/ app / controllers / trackers_controller.rb
Jean-Philippe Lang
Trackers controller refactoring....
r2462 # Redmine - project management software
Jean-Philippe Lang
Copyright update....
r9453 # Copyright (C) 2006-2012 Jean-Philippe Lang
Jean-Philippe Lang
added svn:eol-style native property on /app files...
r330 #
# 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.
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/trackers_controller.rb....
r6685 #
Jean-Philippe Lang
added svn:eol-style native property on /app files...
r330 # 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.
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/trackers_controller.rb....
r6685 #
Jean-Philippe Lang
added svn:eol-style native property on /app files...
r330 # 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 TrackersController < ApplicationController
Jean-Philippe Lang
Adds an admin layout that displays the admin menu in the sidebar....
r3062 layout 'admin'
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/trackers_controller.rb....
r6685
Jean-Philippe Lang
Adds API response to /trackers to get the list of all available trackers (#7181)....
r7757 before_filter :require_admin, :except => :index
before_filter :require_admin_or_api_request, :only => :index
accept_api_auth :index
Jean-Philippe Lang
Initial commit...
r2
Eric Davis
Refactor: Merged TrackersController#list and #index...
r3323 def index
Jean-Philippe Lang
Adds API response to /trackers to get the list of all available trackers (#7181)....
r7757 respond_to do |format|
format.html {
@tracker_pages, @trackers = paginate :trackers, :per_page => 10, :order => 'position'
render :action => "index", :layout => false if request.xhr?
}
format.api {
Jean-Philippe Lang
Code cleanup....
r9531 @trackers = Tracker.sorted.all
Jean-Philippe Lang
Adds API response to /trackers to get the list of all available trackers (#7181)....
r7757 }
end
Jean-Philippe Lang
Initial commit...
r2 end
def new
Jean-Philippe Lang
Resourcified trackers....
r7768 @tracker ||= Tracker.new(params[:tracker])
Jean-Philippe Lang
Replaces find(:first/:all) calls....
r10704 @trackers = Tracker.sorted.all
Jean-Philippe Lang
Replaces find(:all) calls....
r10687 @projects = Project.all
Jean-Philippe Lang
Resourcified trackers....
r7768 end
def create
Jean-Philippe Lang
Initial commit...
r2 @tracker = Tracker.new(params[:tracker])
if request.post? and @tracker.save
Jean-Philippe Lang
Added the ability to copy an existing workflow when creating a new tracker....
r396 # workflow copy
Jean-Philippe Lang
Fixed: error when creating a tracker without copying an existing wokflow...
r595 if !params[:copy_workflow_from].blank? && (copy_from = Tracker.find_by_id(params[:copy_workflow_from]))
Jean-Philippe Lang
Workflow enhancement: editable and required fields configurable by role, tracker and status (#703, #3521)....
r9794 @tracker.workflow_rules.copy(copy_from)
Jean-Philippe Lang
Added the ability to copy an existing workflow when creating a new tracker....
r396 end
Jean-Philippe Lang
notice messages translation...
r15 flash[:notice] = l(:notice_successful_create)
Eric Davis
Refactor: Merged TrackersController#list and #index...
r3323 redirect_to :action => 'index'
Jean-Philippe Lang
Adds projects association on tracker form (#2578)....
r2333 return
Jean-Philippe Lang
Initial commit...
r2 end
Jean-Philippe Lang
Resourcified trackers....
r7768 new
render :action => 'new'
Jean-Philippe Lang
Initial commit...
r2 end
def edit
Jean-Philippe Lang
Resourcified trackers....
r7768 @tracker ||= Tracker.find(params[:id])
Jean-Philippe Lang
Replaces find(:all) calls....
r10687 @projects = Project.all
Jean-Philippe Lang
Resourcified trackers....
r7768 end
Toshi MARUYAMA
remove trailing white-space from app/controllers/trackers_controller.rb...
r10624
Jean-Philippe Lang
Resourcified trackers....
r7768 def update
Jean-Philippe Lang
Initial commit...
r2 @tracker = Tracker.find(params[:id])
Jean-Philippe Lang
Resourcified trackers....
r7768 if request.put? and @tracker.update_attributes(params[:tracker])
Jean-Philippe Lang
notice messages translation...
r15 flash[:notice] = l(:notice_successful_update)
Eric Davis
Refactor: Merged TrackersController#list and #index...
r3323 redirect_to :action => 'index'
Jean-Philippe Lang
Adds projects association on tracker form (#2578)....
r2333 return
Jean-Philippe Lang
Initial commit...
r2 end
Jean-Philippe Lang
Resourcified trackers....
r7768 edit
render :action => 'edit'
Jean-Philippe Lang
Initial commit...
r2 end
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/trackers_controller.rb....
r6685
Jean-Philippe Lang
Initial commit...
r2 def destroy
Jean-Philippe Lang
added svn:eol-style native property on /app files...
r330 @tracker = Tracker.find(params[:id])
unless @tracker.issues.empty?
Azamat Hackimov
New strings to localization (#5225)...
r3513 flash[:error] = l(:error_can_not_delete_tracker)
Jean-Philippe Lang
added svn:eol-style native property on /app files...
r330 else
@tracker.destroy
Jean-Philippe Lang
Initial commit...
r2 end
Eric Davis
Refactor: Merged TrackersController#list and #index...
r3323 redirect_to :action => 'index'
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/trackers_controller.rb....
r6685 end
Jean-Philippe Lang
Adds a view for editing all trackers fields....
r10100
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
Jean-Philippe Lang
Initial commit...
r2 end