comparison app/controllers/enumerations_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
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.
44 end 44 end
45 45
46 def create 46 def create
47 if request.post? && @enumeration.save 47 if request.post? && @enumeration.save
48 flash[:notice] = l(:notice_successful_create) 48 flash[:notice] = l(:notice_successful_create)
49 redirect_to :action => 'index' 49 redirect_to enumerations_path
50 else 50 else
51 render :action => 'new' 51 render :action => 'new'
52 end 52 end
53 end 53 end
54 54
56 end 56 end
57 57
58 def update 58 def update
59 if request.put? && @enumeration.update_attributes(params[:enumeration]) 59 if request.put? && @enumeration.update_attributes(params[:enumeration])
60 flash[:notice] = l(:notice_successful_update) 60 flash[:notice] = l(:notice_successful_update)
61 redirect_to :action => 'index' 61 redirect_to enumerations_path
62 else 62 else
63 render :action => 'edit' 63 render :action => 'edit'
64 end 64 end
65 end 65 end
66 66
67 def destroy 67 def destroy
68 if !@enumeration.in_use? 68 if !@enumeration.in_use?
69 # No associated objects 69 # No associated objects
70 @enumeration.destroy 70 @enumeration.destroy
71 redirect_to :action => 'index' 71 redirect_to enumerations_path
72 return 72 return
73 elsif params[:reassign_to_id] 73 elsif params[:reassign_to_id]
74 if reassign_to = @enumeration.class.find_by_id(params[:reassign_to_id]) 74 if reassign_to = @enumeration.class.find_by_id(params[:reassign_to_id])
75 @enumeration.destroy(reassign_to) 75 @enumeration.destroy(reassign_to)
76 redirect_to :action => 'index' 76 redirect_to enumerations_path
77 return 77 return
78 end 78 end
79 end 79 end
80 @enumerations = @enumeration.class.all - [@enumeration] 80 @enumerations = @enumeration.class.system.all - [@enumeration]
81 end 81 end
82 82
83 private 83 private
84 84
85 def build_new_enumeration 85 def build_new_enumeration