diff options
author | Go MAEDA <maeda@farend.jp> | 2019-02-12 11:50:54 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2019-02-12 11:50:54 +0000 |
commit | b6592a73e89958858e6378649b3aafa6cf4583f2 (patch) | |
tree | 59870f6f4b98a3802c0cd2a08dbb053cae04fc3b /app | |
parent | cbc34f2c5b3cc0e40144886cc37d5c6c1ec9839e (diff) | |
download | redmine-b6592a73e89958858e6378649b3aafa6cf4583f2.tar.gz redmine-b6592a73e89958858e6378649b3aafa6cf4583f2.zip |
Show Edit/Preview tabs for full width layout custom fields with text formatting enabled (#29712).
Patch by Marius BALTEANU.
git-svn-id: http://svn.redmine.org/redmine/trunk@17858 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r-- | app/helpers/custom_fields_helper.rb | 9 | ||||
-rw-r--r-- | app/models/custom_field.rb | 4 | ||||
-rw-r--r-- | app/views/issues/_form_custom_fields.html.erb | 1 |
3 files changed, 11 insertions, 3 deletions
diff --git a/app/helpers/custom_fields_helper.rb b/app/helpers/custom_fields_helper.rb index 08c8c5887..e0ca4529b 100644 --- a/app/helpers/custom_fields_helper.rb +++ b/app/helpers/custom_fields_helper.rb @@ -55,7 +55,7 @@ module CustomFieldsHelper items = [] items << [l(:label_custom_field_plural), custom_fields_path] items << [l(custom_field.type_name), custom_fields_path(:tab => custom_field.class.name)] if custom_field - items << (custom_field.nil? || custom_field.new_record? ? l(:label_custom_field_new) : custom_field.name) + items << (custom_field.nil? || custom_field.new_record? ? l(:label_custom_field_new) : custom_field.name) title(*items) end @@ -79,11 +79,14 @@ 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 << ' wiki-edit' if custom_value.custom_field.full_text_formatting? + custom_value.custom_field.format.edit_tag self, custom_field_tag_id(prefix, custom_value.custom_field), custom_field_tag_name(prefix, custom_value.custom_field), custom_value, - :class => "#{custom_value.custom_field.field_format}_cf" + :class => css end # Return custom field name tag @@ -92,7 +95,7 @@ module CustomFieldsHelper css = title ? "field-description" : nil content_tag 'span', custom_field.name, :title => title, :class => css end - + # Return custom field label tag def custom_field_label_tag(name, custom_value, options={}) required = options[:required] || custom_value.custom_field.is_required? diff --git a/app/models/custom_field.rb b/app/models/custom_field.rb index 008ef49f9..1c71dfad9 100644 --- a/app/models/custom_field.rb +++ b/app/models/custom_field.rb @@ -190,6 +190,10 @@ class CustomField < ActiveRecord::Base full_width_layout == '1' end + def full_text_formatting? + text_formatting == 'full' + end + # Returns a ORDER BY clause that can used to sort customized # objects by their value of the custom field. # Returns nil if the custom field can not be used for sorting. diff --git a/app/views/issues/_form_custom_fields.html.erb b/app/views/issues/_form_custom_fields.html.erb index 13bedd546..fddcd742f 100644 --- a/app/views/issues/_form_custom_fields.html.erb +++ b/app/views/issues/_form_custom_fields.html.erb @@ -20,4 +20,5 @@ <% custom_field_values_full_width.each do |value| %> <p><%= custom_field_tag_with_label :issue, value, :required => @issue.required_attribute?(value.custom_field_id) %></p> + <%= wikitoolbar_for "issue_custom_field_values_#{value.custom_field_id}", preview_issue_path(:project_id => @issue.project, :issue_id => @issue.id) if value.custom_field.full_text_formatting? %> <% end %> |