mirror of
https://github.com/redmine/redmine.git
synced 2025-11-09 14:56:01 +01:00
Show a custom field description as a placeholder (#14275).
Patch by Go MAEDA. git-svn-id: http://svn.redmine.org/redmine/trunk@21460 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -81,6 +81,8 @@ module CustomFieldsHelper
|
|||||||
def custom_field_tag(prefix, custom_value)
|
def custom_field_tag(prefix, custom_value)
|
||||||
cf = custom_value.custom_field
|
cf = custom_value.custom_field
|
||||||
css = cf.css_classes
|
css = cf.css_classes
|
||||||
|
placeholder = cf.description
|
||||||
|
placeholder&.tr!("\n", ' ') if cf.field_format != 'text'
|
||||||
data = nil
|
data = nil
|
||||||
if cf.full_text_formatting?
|
if cf.full_text_formatting?
|
||||||
css += ' wiki-edit'
|
css += ' wiki-edit'
|
||||||
@@ -94,6 +96,7 @@ module CustomFieldsHelper
|
|||||||
custom_field_tag_name(prefix, cf),
|
custom_field_tag_name(prefix, cf),
|
||||||
custom_value,
|
custom_value,
|
||||||
:class => css,
|
:class => css,
|
||||||
|
:placeholder => placeholder,
|
||||||
:data => data)
|
:data => data)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -514,6 +514,10 @@ textarea:focus, textarea:active {
|
|||||||
outline: none;
|
outline: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
input:placeholder-shown {
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
select[multiple=multiple] {background: #fff; padding-right: initial; height: auto;}
|
select[multiple=multiple] {background: #fff; padding-right: initial; height: auto;}
|
||||||
fieldset {border: 1px solid #e4e4e4; margin:0; min-width: inherit;}
|
fieldset {border: 1px solid #e4e4e4; margin:0; min-width: inherit;}
|
||||||
legend {color: #333;}
|
legend {color: #333;}
|
||||||
|
|||||||
@@ -96,6 +96,13 @@ class CustomFieldsHelperTest < Redmine::HelperTest
|
|||||||
assert_select_in custom_field_tag('object', value), "textarea.text_cf.wiki-edit.cf_#{field.id}"
|
assert_select_in custom_field_tag('object', value), "textarea.text_cf.wiki-edit.cf_#{field.id}"
|
||||||
end
|
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
|
def test_select_type_radio_buttons
|
||||||
result = select_type_radio_buttons('UserCustomField')
|
result = select_type_radio_buttons('UserCustomField')
|
||||||
assert_select_in result, 'input[type="radio"]', :count => 10
|
assert_select_in result, 'input[type="radio"]', :count => 10
|
||||||
|
|||||||
Reference in New Issue
Block a user