diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2011-11-20 14:25:58 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2011-11-20 14:25:58 +0000 |
commit | 248b7258751cd7e41bc84f5ed9d18f05dc8413c3 (patch) | |
tree | 1114c99868803ac2d35535d98f4287f7fac6abcc /app | |
parent | 053adaef52d795e5a3ef134381dd378e40856775 (diff) | |
download | redmine-248b7258751cd7e41bc84f5ed9d18f05dc8413c3.tar.gz redmine-248b7258751cd7e41bc84f5ed9d18f05dc8413c3.zip |
Adds API response to /issue_statuses to get the list of all available statuses (#7180).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7878 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/issue_statuses_controller.rb | 15 | ||||
-rw-r--r-- | app/views/issue_statuses/index.api.rsb | 10 |
2 files changed, 22 insertions, 3 deletions
diff --git a/app/controllers/issue_statuses_controller.rb b/app/controllers/issue_statuses_controller.rb index 0be67f401..1f747a4f3 100644 --- a/app/controllers/issue_statuses_controller.rb +++ b/app/controllers/issue_statuses_controller.rb @@ -18,14 +18,23 @@ class IssueStatusesController < ApplicationController layout 'admin' - before_filter :require_admin + before_filter :require_admin, :except => :index + before_filter :require_admin_or_api_request, :only => :index + accept_api_auth :index verify :method => :post, :only => [ :destroy, :create, :update, :move, :update_issue_done_ratio ], :redirect_to => { :action => :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 diff --git a/app/views/issue_statuses/index.api.rsb b/app/views/issue_statuses/index.api.rsb new file mode 100644 index 000000000..8a51674d9 --- /dev/null +++ b/app/views/issue_statuses/index.api.rsb @@ -0,0 +1,10 @@ +api.array :issue_statuses do + @issue_statuses.each do |status| + api.issue_status do + api.id status.id + api.name status.name + api.is_default status.is_default + api.is_closed status.is_closed + end + end +end |