Mercurial > hg > soundsoftware-site
diff app/controllers/issue_statuses_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 | 513646585e45 |
children | 433d4f72a19b |
line wrap: on
line diff
--- a/app/controllers/issue_statuses_controller.rb Fri Feb 24 18:36:29 2012 +0000 +++ b/app/controllers/issue_statuses_controller.rb Fri Feb 24 19:09:32 2012 +0000 @@ -1,31 +1,37 @@ -# redMine - project management software -# Copyright (C) 2006 Jean-Philippe Lang +# Redmine - project management software +# 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 IssueStatusesController < ApplicationController layout 'admin' - - before_filter :require_admin - verify :method => :post, :only => [ :destroy, :create, :update, :move, :update_issue_done_ratio ], - :redirect_to => { :action => :index } - + before_filter :require_admin, :except => :index + before_filter :require_admin_or_api_request, :only => :index + accept_api_auth :index + def index - @issue_status_pages, @issue_statuses = paginate :issue_statuses, :per_page => 25, :order => "position" - render :action => "index", :layout => false if request.xhr? + respond_to do |format| + format.html { + @issue_status_pages, @issue_statuses = paginate :issue_statuses, :per_page => 25, :order => "position" + render :action => "index", :layout => false if request.xhr? + } + format.api { + @issue_statuses = IssueStatus.all(:order => 'position') + } + end end def new @@ -34,7 +40,7 @@ def create @issue_status = IssueStatus.new(params[:issue_status]) - if @issue_status.save + if request.post? && @issue_status.save flash[:notice] = l(:notice_successful_create) redirect_to :action => 'index' else @@ -48,7 +54,7 @@ def update @issue_status = IssueStatus.find(params[:id]) - if @issue_status.update_attributes(params[:issue_status]) + if request.put? && @issue_status.update_attributes(params[:issue_status]) flash[:notice] = l(:notice_successful_update) redirect_to :action => 'index' else @@ -56,6 +62,7 @@ end end + verify :method => :delete, :only => :destroy, :redirect_to => { :action => :index } def destroy IssueStatus.find(params[:id]).destroy redirect_to :action => 'index' @@ -63,9 +70,9 @@ flash[:error] = l(:error_unable_delete_issue_status) redirect_to :action => 'index' end - + def update_issue_done_ratio - if IssueStatus.update_issue_done_ratios + if request.post? && IssueStatus.update_issue_done_ratios flash[:notice] = l(:notice_issue_done_ratios_updated) else flash[:error] = l(:error_issue_done_ratios_not_updated)