@@ -27,8 +27,14 | |||||
27 | </p> |
|
27 | </p> | |
28 | <% end %> |
|
28 | <% end %> | |
29 |
|
29 | |||
30 |
<% |
|
30 | <% case @custom_field.field_format %> | |
31 | <p><%= @custom_field.field_format == 'bool' ? f.check_box(:default_value) : f.text_field(:default_value) %></p> |
|
31 | <% when 'bool' %> | |
|
32 | <p><%= f.check_box(:default_value) %></p> | |||
|
33 | <% when 'text' %> | |||
|
34 | <p><%= f.text_area(:default_value, :rows => 8) %></p> | |||
|
35 | <% when 'user', 'version' %> | |||
|
36 | <% else %> | |||
|
37 | <p><%= f.text_field(:default_value) %></p> | |||
32 | <% end %> |
|
38 | <% end %> | |
33 |
|
39 | |||
34 | <%= call_hook(:view_custom_fields_form_upper_box, :custom_field => @custom_field, :form => f) %> |
|
40 | <%= call_hook(:view_custom_fields_form_upper_box, :custom_field => @custom_field, :form => f) %> |
@@ -454,6 +454,8 table.fields_permissions td.readonly {background:#ddd;} | |||||
454 | table.fields_permissions td.required {background:#d88;} |
|
454 | table.fields_permissions td.required {background:#d88;} | |
455 |
|
455 | |||
456 | textarea#custom_field_possible_values {width: 99%} |
|
456 | textarea#custom_field_possible_values {width: 99%} | |
|
457 | textarea#custom_field_default_value {width: 99%} | |||
|
458 | ||||
457 | input#content_comments {width: 99%} |
|
459 | input#content_comments {width: 99%} | |
458 |
|
460 | |||
459 | p.pagination {margin-top:8px; font-size: 90%} |
|
461 | p.pagination {margin-top:8px; font-size: 90%} |
@@ -56,6 +56,30 class CustomFieldsControllerTest < ActionController::TestCase | |||||
56 | end |
|
56 | end | |
57 | end |
|
57 | end | |
58 |
|
58 | |||
|
59 | def test_default_value_should_be_an_input_for_string_custom_field | |||
|
60 | get :new, :type => 'IssueCustomField', :custom_field => {:field_format => 'string'} | |||
|
61 | assert_response :success | |||
|
62 | assert_select 'input[name=?]', 'custom_field[default_value]' | |||
|
63 | end | |||
|
64 | ||||
|
65 | def test_default_value_should_be_a_textarea_for_text_custom_field | |||
|
66 | get :new, :type => 'IssueCustomField', :custom_field => {:field_format => 'text'} | |||
|
67 | assert_response :success | |||
|
68 | assert_select 'textarea[name=?]', 'custom_field[default_value]' | |||
|
69 | end | |||
|
70 | ||||
|
71 | def test_default_value_should_be_a_checkbox_for_bool_custom_field | |||
|
72 | get :new, :type => 'IssueCustomField', :custom_field => {:field_format => 'bool'} | |||
|
73 | assert_response :success | |||
|
74 | assert_select 'input[name=?][type=checkbox]', 'custom_field[default_value]' | |||
|
75 | end | |||
|
76 | ||||
|
77 | def test_default_value_should_not_be_present_for_user_custom_field | |||
|
78 | get :new, :type => 'IssueCustomField', :custom_field => {:field_format => 'user'} | |||
|
79 | assert_response :success | |||
|
80 | assert_select '[name=?]', 'custom_field[default_value]', 0 | |||
|
81 | end | |||
|
82 | ||||
59 | def test_new_js |
|
83 | def test_new_js | |
60 | get :new, :type => 'IssueCustomField', :custom_field => {:field_format => 'list'}, :format => 'js' |
|
84 | get :new, :type => 'IssueCustomField', :custom_field => {:field_format => 'list'}, :format => 'js' | |
61 | assert_response :success |
|
85 | assert_response :success |
General Comments 0
You need to be logged in to leave comments.
Login now