Project

General

Profile

Feature #202 » textilize-time-entry-comments-extra_r25176.patch

Takenori TAKAKI, 2026-09-29 09:43

View differences:

app/views/issues/_edit.html.erb
21 21
        <p><%= time_entry.select :activity_id, activity_collection_for_select_options %></p>
22 22
        </div>
23 23
        </div>
24
        <p><%= time_entry.text_field :comments, :size => 60 %></p>
24
        <p>
25
          <%= time_entry.textarea :comments, :cols => 60, :rows => 3,
26
                                  :maxlength => 1024,
27
                                  :class => 'wiki-edit',
28
                                  :data => wiki_textarea_stimulus_attributes %>
29
        </p>
30
        <%= wikitoolbar_for 'time_entry_comments', preview_issue_path(:project_id => @project, :issue_id => @issue) %>
25 31
        <% @time_entry.editable_custom_field_values.each do |value| %>
26 32
          <p><%= custom_field_tag_with_label :time_entry, value %></p>
27 33
        <% end %>
app/views/my/blocks/_timelog.html.erb
52 52
      <%= entry.activity %>
53 53
    </td>
54 54
    <td class="subject"><%= entry.project %> <%= h(' - ') + link_to_issue(entry.issue, :truncate => 50) if entry.issue %></td>
55
    <td class="comments"><%= entry.comments %></td>
55
    <td class="comments"><%= content_tag('div', textilizable(entry, :comments), :class => 'wiki') if entry.comments.present? %></td>
56 56
    <td class="hours"><%= html_hours(format_hours(entry.hours)) %></td>
57 57
    <td class="buttons"><%= link_to_context_menu %></td>
58 58
  </tr>
app/views/timelog/bulk_edit.html.erb
65 65

  
66 66
    <p>
67 67
      <label for="time_entry_comments"><%= l(:field_comments) %></label>
68
      <%= text_field(:time_entry, :comments, :size => 100, :value => @time_entry_params[:comments]) %>
68
      <%= textarea_tag 'time_entry[comments]', @time_entry_params[:comments],
69
                       :cols => 60, :rows => 3,
70
                       :maxlength => 1024, :class => 'wiki-edit',
71
                       :data => wiki_textarea_stimulus_attributes %>
69 72
    </p>
73
    <%= wikitoolbar_for 'time_entry_comments', (@project ? preview_issue_path(:project_id => @project) : preview_text_path) %>
70 74

  
71 75
    <% @custom_fields.each do |custom_field| %>
72 76
      <p>
test/functional/issues_controller_test.rb
6363 6363
    assert_select 'select[name=?]', 'time_entry[activity_id]' do
6364 6364
      assert_select 'option[value="10"][selected=selected]', :text => 'Development'
6365 6365
    end
6366
    assert_select 'input[name=?][value=test_get_edit_with_params]', 'time_entry[comments]'
6366
    assert_select 'textarea.wiki-edit[name=?]', 'time_entry[comments]', :text => 'test_get_edit_with_params'
6367
    assert_select 'script', :text => /new jsToolBar\(document\.getElementById\('time_entry_comments'\)\)/
6367 6368
  end
6368 6369

  
6369 6370
  def test_get_edit_with_multi_custom_field
......
7317 7318
    assert_select_error /Activity cannot be blank/
7318 7319
    assert_select_error /Hours cannot be blank/
7319 7320
    assert_select 'textarea[name=?]', 'issue[notes]', :text => notes
7320
    assert_select 'input[name=?][value=?]', 'time_entry[comments]', 'this is my comment'
7321
    assert_select 'textarea[name=?]', 'time_entry[comments]', :text => 'this is my comment'
7321 7322
  end
7322 7323

  
7323 7324
  def test_put_with_spent_time_when_assigned_to_of_private_issue_is_update_at_the_same_time
test/functional/issues_controller_transaction_test.rb
327 327
    end
328 328

  
329 329
    assert_select 'input[name=?][value=?]', 'time_entry[hours]', '2:30'
330
    assert_select 'input[name=?][value=?]', 'time_entry[comments]', 'should not be added'
330
    assert_select 'textarea[name=?]', 'time_entry[comments]', :text => 'should not be added'
331 331
    assert_select 'select[name=?]', 'time_entry[activity_id]' do
332 332
      assert_select 'option[value=?][selected=selected]', TimeEntryActivity.first.id.to_s
333 333
    end
test/functional/my_controller_test.rb
43 43
    with_issue =
44 44
      TimeEntry.create!(
45 45
        :user => User.find(2), :spent_on => Date.yesterday,
46
        :hours => 2.5, :activity_id => 10, :issue_id => 1
46
        :hours => 2.5, :activity_id => 10, :issue_id => 1,
47
        :comments => '*formatted*'
47 48
      )
48 49
    without_issue =
49 50
      TimeEntry.create!(
50 51
        :user => User.find(2), :spent_on => Date.yesterday,
51 52
        :hours => 3.5, :activity_id => 10, :project_id => 1
52 53
      )
53
    get :page
54
    with_settings :text_formatting => 'textile' do
55
      get :page
56
    end
54 57
    assert_response :success
55 58
    assert_select "tr#time-entry-#{with_issue.id}" do
56 59
      assert_select 'td.subject a[href="/issues/1"]'
57 60
      assert_select 'td.hours', :text => '2:30'
61
      assert_select 'td.comments div.wiki strong', :text => 'formatted'
58 62
    end
59 63
    assert_select "tr#time-entry-#{without_issue.id}" do
60 64
      assert_select 'td.hours', :text => '3:30'
65
      assert_select 'td.comments div.wiki', 0
61 66
    end
62 67
  end
63 68

  
test/functional/timelog_controller_test.rb
752 752
      # System wide custom field
753 753
      assert_select 'select[name=?]', 'time_entry[custom_field_values][10]'
754 754

  
755
      assert_select 'textarea.wiki-edit[name=?]', 'time_entry[comments]', :text => ''
756

  
755 757
      # Activities
756 758
      assert_select 'select[name=?]', 'time_entry[activity_id]' do
757 759
        assert_select 'option[value=""]', :text => '(No change)'
(12-12/12)