comparison app/controllers/issue_statuses_controller.rb @ 1295:622f24f53b42 redmine-2.3

Update to Redmine SVN revision 11972 on 2.3-stable branch
author Chris Cannam
date Fri, 14 Jun 2013 09:02:21 +0100
parents 433d4f72a19b
children
comparison
equal deleted inserted replaced
1294:3e4c3460b6ca 1295:622f24f53b42
1 # Redmine - project management software 1 # Redmine - project management software
2 # Copyright (C) 2006-2012 Jean-Philippe Lang 2 # Copyright (C) 2006-2013 Jean-Philippe Lang
3 # 3 #
4 # This program is free software; you can redistribute it and/or 4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License 5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2 6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version. 7 # of the License, or (at your option) any later version.
23 accept_api_auth :index 23 accept_api_auth :index
24 24
25 def index 25 def index
26 respond_to do |format| 26 respond_to do |format|
27 format.html { 27 format.html {
28 @issue_status_pages, @issue_statuses = paginate :issue_statuses, :per_page => 25, :order => "position" 28 @issue_status_pages, @issue_statuses = paginate IssueStatus.sorted, :per_page => 25
29 render :action => "index", :layout => false if request.xhr? 29 render :action => "index", :layout => false if request.xhr?
30 } 30 }
31 format.api { 31 format.api {
32 @issue_statuses = IssueStatus.all(:order => 'position') 32 @issue_statuses = IssueStatus.all(:order => 'position')
33 } 33 }
40 40
41 def create 41 def create
42 @issue_status = IssueStatus.new(params[:issue_status]) 42 @issue_status = IssueStatus.new(params[:issue_status])
43 if request.post? && @issue_status.save 43 if request.post? && @issue_status.save
44 flash[:notice] = l(:notice_successful_create) 44 flash[:notice] = l(:notice_successful_create)
45 redirect_to :action => 'index' 45 redirect_to issue_statuses_path
46 else 46 else
47 render :action => 'new' 47 render :action => 'new'
48 end 48 end
49 end 49 end
50 50
54 54
55 def update 55 def update
56 @issue_status = IssueStatus.find(params[:id]) 56 @issue_status = IssueStatus.find(params[:id])
57 if request.put? && @issue_status.update_attributes(params[:issue_status]) 57 if request.put? && @issue_status.update_attributes(params[:issue_status])
58 flash[:notice] = l(:notice_successful_update) 58 flash[:notice] = l(:notice_successful_update)
59 redirect_to :action => 'index' 59 redirect_to issue_statuses_path
60 else 60 else
61 render :action => 'edit' 61 render :action => 'edit'
62 end 62 end
63 end 63 end
64 64
65 def destroy 65 def destroy
66 IssueStatus.find(params[:id]).destroy 66 IssueStatus.find(params[:id]).destroy
67 redirect_to :action => 'index' 67 redirect_to issue_statuses_path
68 rescue 68 rescue
69 flash[:error] = l(:error_unable_delete_issue_status) 69 flash[:error] = l(:error_unable_delete_issue_status)
70 redirect_to :action => 'index' 70 redirect_to issue_statuses_path
71 end 71 end
72 72
73 def update_issue_done_ratio 73 def update_issue_done_ratio
74 if request.post? && IssueStatus.update_issue_done_ratios 74 if request.post? && IssueStatus.update_issue_done_ratios
75 flash[:notice] = l(:notice_issue_done_ratios_updated) 75 flash[:notice] = l(:notice_issue_done_ratios_updated)
76 else 76 else
77 flash[:error] = l(:error_issue_done_ratios_not_updated) 77 flash[:error] = l(:error_issue_done_ratios_not_updated)
78 end 78 end
79 redirect_to :action => 'index' 79 redirect_to issue_statuses_path
80 end 80 end
81 end 81 end