comparison app/controllers/custom_fields_controller.rb @ 1517:dffacf8a6908 redmine-2.5

Update to Redmine SVN revision 13367 on 2.5-stable branch
author Chris Cannam
date Tue, 09 Sep 2014 09:29:00 +0100
parents e248c7af89ec
children
comparison
equal deleted inserted replaced
1516:b450a9d58aed 1517:dffacf8a6908
25 25
26 def index 26 def index
27 respond_to do |format| 27 respond_to do |format|
28 format.html { 28 format.html {
29 @custom_fields_by_type = CustomField.all.group_by {|f| f.class.name } 29 @custom_fields_by_type = CustomField.all.group_by {|f| f.class.name }
30 @tab = params[:tab] || 'IssueCustomField'
31 } 30 }
32 format.api { 31 format.api {
33 @custom_fields = CustomField.all 32 @custom_fields = CustomField.all
34 } 33 }
35 end 34 end
36 end 35 end
37 36
38 def new 37 def new
38 @custom_field.field_format = 'string' if @custom_field.field_format.blank?
39 @custom_field.default_value = nil
39 end 40 end
40 41
41 def create 42 def create
42 if @custom_field.save 43 if @custom_field.save
43 flash[:notice] = l(:notice_successful_create) 44 flash[:notice] = l(:notice_successful_create)
73 private 74 private
74 75
75 def build_new_custom_field 76 def build_new_custom_field
76 @custom_field = CustomField.new_subclass_instance(params[:type], params[:custom_field]) 77 @custom_field = CustomField.new_subclass_instance(params[:type], params[:custom_field])
77 if @custom_field.nil? 78 if @custom_field.nil?
78 render_404 79 render :action => 'select_type'
79 else
80 @custom_field.default_value = nil
81 end 80 end
82 end 81 end
83 82
84 def find_custom_field 83 def find_custom_field
85 @custom_field = CustomField.find(params[:id]) 84 @custom_field = CustomField.find(params[:id])