@@ -1,5 +1,5 | |||
|
1 |
# |
|
|
2 | # Copyright (C) 2006 Jean-Philippe Lang | |
|
1 | # Redmine - project management software | |
|
2 | # Copyright (C) 2006-2011 Jean-Philippe Lang | |
|
3 | 3 | # |
|
4 | 4 | # This program is free software; you can redistribute it and/or |
|
5 | 5 | # modify it under the terms of the GNU General Public License |
@@ -37,7 +37,7 module CustomFieldsHelper | |||
|
37 | 37 | field_id = "#{name}_custom_field_values_#{custom_field.id}" |
|
38 | 38 | |
|
39 | 39 | field_format = Redmine::CustomFieldFormat.find_by_name(custom_field.field_format) |
|
40 | case field_format.edit_as | |
|
40 | case field_format.try(:edit_as) | |
|
41 | 41 | when "date" |
|
42 | 42 | text_field_tag(field_name, custom_value.value, :id => field_id, :size => 10) + |
|
43 | 43 | calendar_for(field_id) |
@@ -72,7 +72,7 module CustomFieldsHelper | |||
|
72 | 72 | field_name = "#{name}[custom_field_values][#{custom_field.id}]" |
|
73 | 73 | field_id = "#{name}_custom_field_values_#{custom_field.id}" |
|
74 | 74 | field_format = Redmine::CustomFieldFormat.find_by_name(custom_field.field_format) |
|
75 | case field_format.edit_as | |
|
75 | case field_format.try(:edit_as) | |
|
76 | 76 | when "date" |
|
77 | 77 | text_field_tag(field_name, '', :id => field_id, :size => 10) + |
|
78 | 78 | calendar_for(field_id) |
@@ -1,5 +1,5 | |||
|
1 | 1 | # Redmine - project management software |
|
2 |
# Copyright (C) 2006-20 |
|
|
2 | # Copyright (C) 2006-2011 Jean-Philippe Lang | |
|
3 | 3 | # |
|
4 | 4 | # This program is free software; you can redistribute it and/or |
|
5 | 5 | # modify it under the terms of the GNU General Public License |
@@ -26,4 +26,21 class CustomFieldsHelperTest < HelperTestCase | |||
|
26 | 26 | assert_equal 'Yes', format_value('1', 'bool') |
|
27 | 27 | assert_equal 'No', format_value('0', 'bool') |
|
28 | 28 | end |
|
29 | ||
|
30 | def test_unknow_field_format_should_be_edited_as_string | |
|
31 | field = CustomField.new(:field_format => 'foo') | |
|
32 | value = CustomValue.new(:value => 'bar', :custom_field => field) | |
|
33 | field.id = 52 | |
|
34 | ||
|
35 | assert_equal '<input id="object_custom_field_values_52" name="object[custom_field_values][52]" type="text" value="bar" />', | |
|
36 | custom_field_tag('object', value) | |
|
37 | end | |
|
38 | ||
|
39 | def test_unknow_field_format_should_be_bulk_edited_as_string | |
|
40 | field = CustomField.new(:field_format => 'foo') | |
|
41 | field.id = 52 | |
|
42 | ||
|
43 | assert_equal '<input id="object_custom_field_values_52" name="object[custom_field_values][52]" type="text" value="" />', | |
|
44 | custom_field_tag_for_bulk_edit('object', field) | |
|
45 | end | |
|
29 | 46 | end |
General Comments 0
You need to be logged in to leave comments.
Login now