@@ -1,81 +1,81 | |||||
1 | # Redmine - project management software |
|
1 | # Redmine - project management software | |
2 | # Copyright (C) 2006-2013 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. | |
8 | # |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 | # |
|
13 | # | |
14 | # You should have received a copy of the GNU General Public License |
|
14 | # You should have received a copy of the GNU General Public License | |
15 | # along with this program; if not, write to the Free Software |
|
15 | # along with this program; if not, write to the Free Software | |
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 |
|
17 | |||
18 | class IssueStatusesController < ApplicationController |
|
18 | class IssueStatusesController < ApplicationController | |
19 | layout 'admin' |
|
19 | layout 'admin' | |
20 |
|
20 | |||
21 | before_filter :require_admin, :except => :index |
|
21 | before_filter :require_admin, :except => :index | |
22 | before_filter :require_admin_or_api_request, :only => :index |
|
22 | before_filter :require_admin_or_api_request, :only => :index | |
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 IssueStatus.sorted, :per_page => 25 |
|
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. |
|
32 | @issue_statuses = IssueStatus.order('position').all | |
33 | } |
|
33 | } | |
34 | end |
|
34 | end | |
35 | end |
|
35 | end | |
36 |
|
36 | |||
37 | def new |
|
37 | def new | |
38 | @issue_status = IssueStatus.new |
|
38 | @issue_status = IssueStatus.new | |
39 | end |
|
39 | end | |
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 @issue_status.save |
|
43 | if @issue_status.save | |
44 | flash[:notice] = l(:notice_successful_create) |
|
44 | flash[:notice] = l(:notice_successful_create) | |
45 | redirect_to issue_statuses_path |
|
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 | |||
51 | def edit |
|
51 | def edit | |
52 | @issue_status = IssueStatus.find(params[:id]) |
|
52 | @issue_status = IssueStatus.find(params[:id]) | |
53 | end |
|
53 | end | |
54 |
|
54 | |||
55 | def update |
|
55 | def update | |
56 | @issue_status = IssueStatus.find(params[:id]) |
|
56 | @issue_status = IssueStatus.find(params[:id]) | |
57 | if @issue_status.update_attributes(params[:issue_status]) |
|
57 | if @issue_status.update_attributes(params[:issue_status]) | |
58 | flash[:notice] = l(:notice_successful_update) |
|
58 | flash[:notice] = l(:notice_successful_update) | |
59 | redirect_to issue_statuses_path |
|
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 issue_statuses_path |
|
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 issue_statuses_path |
|
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 issue_statuses_path |
|
79 | redirect_to issue_statuses_path | |
80 | end |
|
80 | end | |
81 | end |
|
81 | end |
General Comments 0
You need to be logged in to leave comments.
Login now