Feature #43959 » 0001-Show-wiki-toolbar-for-long-text-custom-fields-on-ver.patch
| app/views/versions/_form.html.erb | ||
|---|---|---|
|
<% @version.visible_custom_field_values.each do |value| %>
|
||
|
<p><%= custom_field_tag_with_label :version, value %></p>
|
||
|
<%= wikitoolbar_for("version_custom_field_values_#{value.custom_field_id}", preview_text_path) if value.custom_field.full_text_formatting? %>
|
||
|
<% end %>
|
||
|
</div>
|
||
| test/functional/versions_custom_fields_visibility_test.rb | ||
|---|---|---|
|
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
|
||
| ... | ... | |
|
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
|
||