Mercurial > hg > soundsoftware-site
comparison app/controllers/issue_categories_controller.rb @ 1298:4f746d8966dd redmine_2.3_integration
Merge from redmine-2.3 branch to create new branch redmine-2.3-integration
author | Chris Cannam |
---|---|
date | Fri, 14 Jun 2013 09:28:30 +0100 |
parents | 622f24f53b42 |
children | e248c7af89ec |
comparison
equal
deleted
inserted
replaced
1297:0a574315af3e | 1298:4f746d8966dd |
---|---|
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. |
24 before_filter :authorize | 24 before_filter :authorize |
25 accept_api_auth :index, :show, :create, :update, :destroy | 25 accept_api_auth :index, :show, :create, :update, :destroy |
26 | 26 |
27 def index | 27 def index |
28 respond_to do |format| | 28 respond_to do |format| |
29 format.html { redirect_to :controller => 'projects', :action => 'settings', :tab => 'categories', :id => @project } | 29 format.html { redirect_to_settings_in_projects } |
30 format.api { @categories = @project.issue_categories.all } | 30 format.api { @categories = @project.issue_categories.all } |
31 end | 31 end |
32 end | 32 end |
33 | 33 |
34 def show | 34 def show |
35 respond_to do |format| | 35 respond_to do |format| |
36 format.html { redirect_to :controller => 'projects', :action => 'settings', :tab => 'categories', :id => @project } | 36 format.html { redirect_to_settings_in_projects } |
37 format.api | 37 format.api |
38 end | 38 end |
39 end | 39 end |
40 | 40 |
41 def new | 41 def new |
53 @category.safe_attributes = params[:issue_category] | 53 @category.safe_attributes = params[:issue_category] |
54 if @category.save | 54 if @category.save |
55 respond_to do |format| | 55 respond_to do |format| |
56 format.html do | 56 format.html do |
57 flash[:notice] = l(:notice_successful_create) | 57 flash[:notice] = l(:notice_successful_create) |
58 redirect_to :controller => 'projects', :action => 'settings', :tab => 'categories', :id => @project | 58 redirect_to_settings_in_projects |
59 end | 59 end |
60 format.js | 60 format.js |
61 format.api { render :action => 'show', :status => :created, :location => issue_category_path(@category) } | 61 format.api { render :action => 'show', :status => :created, :location => issue_category_path(@category) } |
62 end | 62 end |
63 else | 63 else |
76 @category.safe_attributes = params[:issue_category] | 76 @category.safe_attributes = params[:issue_category] |
77 if @category.save | 77 if @category.save |
78 respond_to do |format| | 78 respond_to do |format| |
79 format.html { | 79 format.html { |
80 flash[:notice] = l(:notice_successful_update) | 80 flash[:notice] = l(:notice_successful_update) |
81 redirect_to :controller => 'projects', :action => 'settings', :tab => 'categories', :id => @project | 81 redirect_to_settings_in_projects |
82 } | 82 } |
83 format.api { render_api_ok } | 83 format.api { render_api_ok } |
84 end | 84 end |
85 else | 85 else |
86 respond_to do |format| | 86 respond_to do |format| |
97 if params[:reassign_to_id] && (params[:todo] == 'reassign' || params[:todo].blank?) | 97 if params[:reassign_to_id] && (params[:todo] == 'reassign' || params[:todo].blank?) |
98 reassign_to = @project.issue_categories.find_by_id(params[:reassign_to_id]) | 98 reassign_to = @project.issue_categories.find_by_id(params[:reassign_to_id]) |
99 end | 99 end |
100 @category.destroy(reassign_to) | 100 @category.destroy(reassign_to) |
101 respond_to do |format| | 101 respond_to do |format| |
102 format.html { redirect_to :controller => 'projects', :action => 'settings', :id => @project, :tab => 'categories' } | 102 format.html { redirect_to_settings_in_projects } |
103 format.api { render_api_ok } | 103 format.api { render_api_ok } |
104 end | 104 end |
105 return | 105 return |
106 end | 106 end |
107 @categories = @project.issue_categories - [@category] | 107 @categories = @project.issue_categories - [@category] |
108 end | 108 end |
109 | 109 |
110 private | 110 private |
111 | |
112 def redirect_to_settings_in_projects | |
113 redirect_to settings_project_path(@project, :tab => 'categories') | |
114 end | |
115 | |
111 # Wrap ApplicationController's find_model_object method to set | 116 # Wrap ApplicationController's find_model_object method to set |
112 # @category instead of just @issue_category | 117 # @category instead of just @issue_category |
113 def find_model_object | 118 def find_model_object |
114 super | 119 super |
115 @category = @object | 120 @category = @object |