textilization_for_spent_time_comments_with_test.patch

Takenori TAKAKI, 2022-06-01 09:05

Download (3.71 KB)

View differences:

app/helpers/queries_helper.rb
254 254
        link_to value, issue_path(item)
255 255
      when :parent
256 256
        value ? (value.visible? ? link_to_issue(value, :subject => false) : "##{value.id}") : ''
257
      when :description
258
        item.description? ? content_tag('div', textilizable(item, :description), :class => "wiki") : ''
259
      when :last_notes
260
        item.last_notes.present? ? content_tag('div', textilizable(item, :last_notes), :class => "wiki") : ''
257
      when :description, :last_notes, :comments
258
        item.send(column.name).present? ? content_tag('div', textilizable(item, column.name), :class => 'wiki') : ''
261 259
      when :done_ratio
262 260
        progress_bar(value)
263 261
      when :relations
app/views/timelog/_form.html.erb
27 27
  <% end %>
28 28
  <p><%= f.date_field :spent_on, :size => 10, :required => true %><%= calendar_for('time_entry_spent_on') %></p>
29 29
  <p><%= f.hours_field :hours, :size => 6, :required => true %></p>
30
  <p><%= f.text_field :comments, :size => 100, :maxlength => 1024, :required => Setting.timelog_required_fields.include?('comments') %></p>
31 30
  <p><%= f.select :activity_id, activity_collection_for_select_options(@time_entry), :required => true %></p>
31
  <p><%= f.text_area :comments,
32
                     :class => 'wiki-edit',
33
                     :cols => 60,
34
                     :rows => [[5, @time_entry.comments.to_s.length / 50].max, 10].min,
35
                     :maxlength => 1024 %></p>
32 36
  <% @time_entry.editable_custom_field_values.each do |value| %>
33 37
    <p><%= custom_field_tag_with_label :time_entry, value %></p>
34 38
    <% if value.custom_field.full_text_formatting? %>
......
38 42
  <%= call_hook(:view_timelog_edit_form_bottom, { :time_entry => @time_entry, :form => f }) %>
39 43
</div>
40 44

  
45
<%= wikitoolbar_for 'time_entry_comments' %>
46

  
41 47
<%= javascript_tag do %>
42 48
  $(document).ready(function(){
43 49
    $('#time_entry_project_id').change(function(){
test/helpers/queries_helper_test.rb
21 21

  
22 22
class QueriesHelperTest < Redmine::HelperTest
23 23
  include QueriesHelper
24
  include ERB::Util
24 25

  
25 26
  fixtures :projects, :enabled_modules, :users, :members,
26 27
           :member_roles, :roles, :trackers, :issue_statuses,
......
95 96
      assert_include "Non", csv
96 97
    end
97 98
  end
99

  
100
  def test_column_value_should_textilize_item
101
    with_settings :text_formatting => 'textile' do
102
      column = QueryColumn.new(:description)
103
      item = Issue.generate!(:description => '*issue description*')
104
      value = column.value_object(item)
105
      assert_select_in column_value(column, item, value), 'div.wiki>p>strong', :text => 'issue description'
106

  
107
      column = QueryColumn.new(:last_notes)
108
      Journal.generate!(journalized: item, notes: '*last note*')
109
      value = column.value_object(item)
110
      assert_select_in column_value(column, item, value), 'div.wiki>p>strong', :text => 'last note'
111

  
112
      column = QueryColumn.new(:comments)
113
      item = TimeEntry.generate!(:comments => '*time entry comments*')
114
      value = column.value_object(item)
115
      assert_select_in column_value(column, item, value), 'div.wiki>p>strong', :text => 'time entry comments'
116
    end
117
  end
98 118
end