Feature #14275 » 14275.patch
| app/helpers/custom_fields_helper.rb | ||
|---|---|---|
|
# Return custom field html tag corresponding to its format
|
||
|
def custom_field_tag(prefix, custom_value)
|
||
|
css = custom_value.custom_field.css_classes
|
||
|
cf = custom_value.custom_field
|
||
|
css = cf.css_classes
|
||
|
placeholder = cf.description
|
||
|
placeholder&.tr!("\n", ' ') if cf.field_format != 'text'
|
||
|
data = nil
|
||
|
if custom_value.custom_field.full_text_formatting?
|
||
|
if cf.full_text_formatting?
|
||
|
css += ' wiki-edit'
|
||
|
data = {
|
||
|
:auto_complete => true
|
||
|
}
|
||
|
end
|
||
|
custom_value.custom_field.format.edit_tag(
|
||
|
cf.format.edit_tag(
|
||
|
self,
|
||
|
custom_field_tag_id(prefix, custom_value.custom_field),
|
||
|
custom_field_tag_name(prefix, custom_value.custom_field),
|
||
|
custom_field_tag_id(prefix, cf),
|
||
|
custom_field_tag_name(prefix, cf),
|
||
|
custom_value,
|
||
|
:class => css,
|
||
|
:placeholder => placeholder,
|
||
|
:data => data)
|
||
|
end
|
||
| public/stylesheets/application.css | ||
|---|---|---|
|
outline: none;
|
||
|
}
|
||
|
input:placeholder-shown {
|
||
|
text-overflow: ellipsis;
|
||
|
}
|
||
|
select[multiple=multiple] {background: #fff; padding-right: initial; height: auto;}
|
||
|
fieldset {border: 1px solid #e4e4e4; margin:0; min-width: inherit;}
|
||
|
legend {color: #333;}
|
||
| test/helpers/custom_fields_helper_test.rb | ||
|---|---|---|
|
assert_select_in custom_field_tag('object', value), "textarea.text_cf.wiki-edit.cf_#{field.id}"
|
||
|
end
|
||
|
def test_custom_field_tag_class_should_contain_placeholder
|
||
|
field = IssueCustomField.create!(:name => 'Text', :field_format => 'string', :description => "Foo\nBar\nBaz")
|
||
|
value = CustomValue.new(:value => 'bar', :custom_field => field)
|
||
|
assert_select_in custom_field_tag('object', value), "input.string_cf.cf_#{field.id}[placeholder=?]", 'Foo Bar Baz'
|
||
|
end
|
||
|
def test_select_type_radio_buttons
|
||
|
result = select_type_radio_buttons('UserCustomField')
|
||
|
assert_select_in result, 'input[type="radio"]', :count => 10
|
||