Project

General

Profile

Defect #32471 » 0002-Unify-css-classes-for-custom-fields-in-issue-show-is.patch

Marius BĂLTEANU, 2020-04-05 10:45

View differences:

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.field_format}_cf"
css = custom_value.custom_field.css_classes
data = nil
if custom_value.custom_field.full_text_formatting?
css += ' wiki-edit'
......
custom_field,
objects,
value,
:class => "#{custom_field.field_format}_cf")
:class => custom_field.css_classes)
end
# Returns custom field value tag
app/models/custom_field.rb
end
def css_classes
"cf_#{id}"
"#{field_format}_cf cf_#{id}"
end
protected
test/functional/projects_controller_test.rb
ProjectCustomField.find_by_name('Development status').update_attribute :visible, true
get(:show, :params => {:id => 'ecookbook'})
assert_response :success
assert_select 'li[class=?]', 'cf_3', :text => /Development status/
assert_select 'li.list_cf.cf_3', :text => /Development status/
end
def test_show_should_not_display_hidden_custom_fields
test/functional/users_controller_test.rb
get :show, :params => {:id => 2}
assert_response :success
assert_select 'li[class=?]', 'cf_4', :text => /Phone number/
assert_select 'li.cf_4.string_cf', :text => /Phone number/
end
def test_show_should_not_display_hidden_custom_fields
test/helpers/custom_fields_helper_test.rb
field = IssueCustomField.create!(:name => 'Long text', :field_format => 'text', :text_formatting => 'full')
value = CustomValue.new(:value => 'bar', :custom_field => field)
assert_select_in custom_field_tag('object', value), 'textarea[class=?]', 'text_cf wiki-edit'
assert_select_in custom_field_tag('object', value), "textarea.text_cf.wiki-edit.cf_#{field.id}"
end
def test_select_type_radio_buttons
(8-8/9)