To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / app / controllers / issue_statuses_controller.rb @ 958:352539ac7b43
History | View | Annotate | Download (2.53 KB)
| 1 |
# Redmine - project management software
|
|---|---|
| 2 |
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
| 3 |
#
|
| 4 |
# This program is free software; you can redistribute it and/or
|
| 5 |
# modify it under the terms of the GNU General Public License
|
| 6 |
# as published by the Free Software Foundation; either version 2
|
| 7 |
# of the License, or (at your option) any later version.
|
| 8 |
#
|
| 9 |
# This program is distributed in the hope that it will be useful,
|
| 10 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 11 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 12 |
# GNU General Public License for more details.
|
| 13 |
#
|
| 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
|
| 16 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
| 17 |
|
| 18 |
class IssueStatusesController < ApplicationController |
| 19 |
layout 'admin'
|
| 20 |
|
| 21 |
before_filter :require_admin, :except => :index |
| 22 |
before_filter :require_admin_or_api_request, :only => :index |
| 23 |
accept_api_auth :index
|
| 24 |
|
| 25 |
def index |
| 26 |
respond_to do |format|
|
| 27 |
format.html {
|
| 28 |
@issue_status_pages, @issue_statuses = paginate :issue_statuses, :per_page => 25, :order => "position" |
| 29 |
render :action => "index", :layout => false if request.xhr? |
| 30 |
} |
| 31 |
format.api {
|
| 32 |
@issue_statuses = IssueStatus.all(:order => 'position') |
| 33 |
} |
| 34 |
end
|
| 35 |
end
|
| 36 |
|
| 37 |
def new |
| 38 |
@issue_status = IssueStatus.new |
| 39 |
end
|
| 40 |
|
| 41 |
def create |
| 42 |
@issue_status = IssueStatus.new(params[:issue_status]) |
| 43 |
if request.post? && @issue_status.save |
| 44 |
flash[:notice] = l(:notice_successful_create) |
| 45 |
redirect_to :action => 'index' |
| 46 |
else
|
| 47 |
render :action => 'new' |
| 48 |
end
|
| 49 |
end
|
| 50 |
|
| 51 |
def edit |
| 52 |
@issue_status = IssueStatus.find(params[:id]) |
| 53 |
end
|
| 54 |
|
| 55 |
def update |
| 56 |
@issue_status = IssueStatus.find(params[:id]) |
| 57 |
if request.put? && @issue_status.update_attributes(params[:issue_status]) |
| 58 |
flash[:notice] = l(:notice_successful_update) |
| 59 |
redirect_to :action => 'index' |
| 60 |
else
|
| 61 |
render :action => 'edit' |
| 62 |
end
|
| 63 |
end
|
| 64 |
|
| 65 |
verify :method => :delete, :only => :destroy, :redirect_to => { :action => :index } |
| 66 |
def destroy |
| 67 |
IssueStatus.find(params[:id]).destroy |
| 68 |
redirect_to :action => 'index' |
| 69 |
rescue
|
| 70 |
flash[:error] = l(:error_unable_delete_issue_status) |
| 71 |
redirect_to :action => 'index' |
| 72 |
end
|
| 73 |
|
| 74 |
def update_issue_done_ratio |
| 75 |
if request.post? && IssueStatus.update_issue_done_ratios |
| 76 |
flash[:notice] = l(:notice_issue_done_ratios_updated) |
| 77 |
else
|
| 78 |
flash[:error] = l(:error_issue_done_ratios_not_updated) |
| 79 |
end
|
| 80 |
redirect_to :action => 'index' |
| 81 |
end
|
| 82 |
end
|