From 3f84f484ac595b7cd49f0f7cdffc367f059019b5 Mon Sep 17 00:00:00 2001 From: MAEDA Go Date: Thu, 16 Apr 2026 17:43:08 +0900 Subject: [PATCH] Show wiki toolbar for long text custom fields on versions --- app/views/versions/_form.html.erb | 1 + .../versions_custom_fields_visibility_test.rb | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/views/versions/_form.html.erb b/app/views/versions/_form.html.erb index 62119769b..3d118c25b 100644 --- a/app/views/versions/_form.html.erb +++ b/app/views/versions/_form.html.erb @@ -16,6 +16,7 @@ <% @version.visible_custom_field_values.each do |value| %>

<%= custom_field_tag_with_label :version, value %>

+ <%= wikitoolbar_for("version_custom_field_values_#{value.custom_field_id}", preview_text_path) if value.custom_field.full_text_formatting? %> <% end %> diff --git a/test/functional/versions_custom_fields_visibility_test.rb b/test/functional/versions_custom_fields_visibility_test.rb index 1d07bc376..1994b4fbd 100644 --- a/test/functional/versions_custom_fields_visibility_test.rb +++ b/test/functional/versions_custom_fields_visibility_test.rb @@ -45,9 +45,15 @@ class VersionsCustomFieldsVisibilityTest < Redmine::ControllerTest cf1 = VersionCustomField.create!(:name => 'cf1', :field_format => 'string') cf2 = VersionCustomField.create!(:name => 'cf2', :field_format => 'string', :visible => false, :role_ids => [1]) cf3 = VersionCustomField.create!(:name => 'cf3', :field_format => 'string', :visible => false, :role_ids => [3]) + cf4 = VersionCustomField.create!(:name => 'cf4', :field_format => 'text', :text_formatting => 'full') version = Version.find(2) - version.custom_field_values = {cf1.id => 'Value1', cf2.id => 'Value2', cf3.id => 'Value3'} + version.custom_field_values = { + cf1.id => 'Value1', + cf2.id => 'Value2', + cf3.id => 'Value3', + cf4.id => 'Formatted text' + } version.save! @request.session[:user_id] = 2 @@ -58,6 +64,9 @@ class VersionsCustomFieldsVisibilityTest < Redmine::ControllerTest assert_select 'input[id=?]', "version_custom_field_values_#{cf1.id}" assert_select 'input[id=?]', "version_custom_field_values_#{cf2.id}" assert_select 'input[id=?]', "version_custom_field_values_#{cf3.id}", 0 + assert_select 'textarea[id=?].wiki-edit', "version_custom_field_values_#{cf4.id}" end + # Wikitoolbar should be shown for cf4 + assert_select 'head script[src*=?]', 'jstoolbar' end end -- 2.50.1