From b51ac235c5808c68541c941e509ddba11dd6eec1 Mon Sep 17 00:00:00 2001 From: Marius BALTEANU Date: Sat, 4 Apr 2020 18:23:18 +0300 Subject: [PATCH 2/3] Unify css classes for custom fields in issue#show, issue#edit and issue#bulk_edit --- app/helpers/custom_fields_helper.rb | 4 ++-- app/models/custom_field.rb | 2 +- test/functional/projects_controller_test.rb | 2 +- test/functional/users_controller_test.rb | 2 +- test/helpers/custom_fields_helper_test.rb | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/helpers/custom_fields_helper.rb b/app/helpers/custom_fields_helper.rb index 5f5c057dc..229d5c11f 100644 --- a/app/helpers/custom_fields_helper.rb +++ b/app/helpers/custom_fields_helper.rb @@ -79,7 +79,7 @@ module CustomFieldsHelper # 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' @@ -135,7 +135,7 @@ module CustomFieldsHelper custom_field, objects, value, - :class => "#{custom_field.field_format}_cf") + :class => custom_field.css_classes) end # Returns custom field value tag diff --git a/app/models/custom_field.rb b/app/models/custom_field.rb index 80129b3d8..9743d1a21 100644 --- a/app/models/custom_field.rb +++ b/app/models/custom_field.rb @@ -306,7 +306,7 @@ class CustomField < ActiveRecord::Base end def css_classes - "cf_#{id}" + "#{field_format}_cf cf_#{id}" end protected diff --git a/test/functional/projects_controller_test.rb b/test/functional/projects_controller_test.rb index 94b861811..fb186d662 100644 --- a/test/functional/projects_controller_test.rb +++ b/test/functional/projects_controller_test.rb @@ -677,7 +677,7 @@ class ProjectsControllerTest < Redmine::ControllerTest 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 diff --git a/test/functional/users_controller_test.rb b/test/functional/users_controller_test.rb index 40105bb2e..7be370de2 100644 --- a/test/functional/users_controller_test.rb +++ b/test/functional/users_controller_test.rb @@ -141,7 +141,7 @@ class UsersControllerTest < Redmine::ControllerTest 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 diff --git a/test/helpers/custom_fields_helper_test.rb b/test/helpers/custom_fields_helper_test.rb index 676b34c15..501f31f12 100644 --- a/test/helpers/custom_fields_helper_test.rb +++ b/test/helpers/custom_fields_helper_test.rb @@ -93,7 +93,7 @@ class CustomFieldsHelperTest < Redmine::HelperTest 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 -- 2.22.0