To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

Statistics Download as Zip
| Branch: | Tag: | Revision:

root / app / controllers / issue_statuses_controller.rb @ 1298:4f746d8966dd

History | View | Annotate | Download (2.42 KB)

1 909:cbb26bc654de Chris
# Redmine - project management software
2 1295:622f24f53b42 Chris
# Copyright (C) 2006-2013  Jean-Philippe Lang
3 0:513646585e45 Chris
#
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 909:cbb26bc654de Chris
#
9 0:513646585e45 Chris
# 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 909:cbb26bc654de Chris
#
14 0:513646585e45 Chris
# 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 909:cbb26bc654de Chris
  before_filter :require_admin, :except => :index
22
  before_filter :require_admin_or_api_request, :only => :index
23
  accept_api_auth :index
24
25 0:513646585e45 Chris
  def index
26 909:cbb26bc654de Chris
    respond_to do |format|
27
      format.html {
28 1295:622f24f53b42 Chris
        @issue_status_pages, @issue_statuses = paginate IssueStatus.sorted, :per_page => 25
29 909:cbb26bc654de Chris
        render :action => "index", :layout => false if request.xhr?
30
      }
31
      format.api {
32
        @issue_statuses = IssueStatus.all(:order => 'position')
33
      }
34
    end
35 0:513646585e45 Chris
  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 909:cbb26bc654de Chris
    if request.post? && @issue_status.save
44 0:513646585e45 Chris
      flash[:notice] = l(:notice_successful_create)
45 1295:622f24f53b42 Chris
      redirect_to issue_statuses_path
46 0:513646585e45 Chris
    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 909:cbb26bc654de Chris
    if request.put? && @issue_status.update_attributes(params[:issue_status])
58 0:513646585e45 Chris
      flash[:notice] = l(:notice_successful_update)
59 1295:622f24f53b42 Chris
      redirect_to issue_statuses_path
60 0:513646585e45 Chris
    else
61
      render :action => 'edit'
62
    end
63
  end
64
65
  def destroy
66
    IssueStatus.find(params[:id]).destroy
67 1295:622f24f53b42 Chris
    redirect_to issue_statuses_path
68 0:513646585e45 Chris
  rescue
69
    flash[:error] = l(:error_unable_delete_issue_status)
70 1295:622f24f53b42 Chris
    redirect_to issue_statuses_path
71
  end
72 909:cbb26bc654de Chris
73 0:513646585e45 Chris
  def update_issue_done_ratio
74 909:cbb26bc654de Chris
    if request.post? && IssueStatus.update_issue_done_ratios
75 0:513646585e45 Chris
      flash[:notice] = l(:notice_issue_done_ratios_updated)
76
    else
77
      flash[:error] =  l(:error_issue_done_ratios_not_updated)
78
    end
79 1295:622f24f53b42 Chris
    redirect_to issue_statuses_path
80 0:513646585e45 Chris
  end
81
end