##// END OF EJS Templates
Fixes boolean custom fields tags (broken by r1592) (#1640)....
Jean-Philippe Lang -
r1653:025581bb284a
parent child
Show More
@@ -37,7 +37,7 module CustomFieldsHelper
37 when "text"
37 when "text"
38 text_area_tag(field_name, custom_value.value, :id => field_id, :rows => 3, :style => 'width:90%')
38 text_area_tag(field_name, custom_value.value, :id => field_id, :rows => 3, :style => 'width:90%')
39 when "bool"
39 when "bool"
40 check_box_tag(field_name, custom_value.value, :id => field_id)
40 check_box_tag(field_name, '1', custom_value.true?, :id => field_id) + hidden_field_tag(field_name, '0')
41 when "list"
41 when "list"
42 blank_option = custom_field.is_required? ?
42 blank_option = custom_field.is_required? ?
43 (custom_field.default_value.blank? ? "<option value=\"\">--- #{l(:actionview_instancetag_blank_option)} ---</option>" : '') :
43 (custom_field.default_value.blank? ? "<option value=\"\">--- #{l(:actionview_instancetag_blank_option)} ---</option>" : '') :
@@ -25,6 +25,11 class CustomValue < ActiveRecord::Base
25 end
25 end
26 end
26 end
27
27
28 # Returns true if the boolean custom value is true
29 def true?
30 self.value == '1'
31 end
32
28 protected
33 protected
29 def validate
34 def validate
30 if value.blank?
35 if value.blank?
General Comments 0
You need to be logged in to leave comments. Login now