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
<p><%= time_entry.select :activity_id, activity_collection_for_select_options %></p>
</div>
</div>
<p><%= time_entry.text_field :comments, :size => 60 %></p>
<p>
<%= time_entry.textarea :comments, :cols => 60, :rows => 3,
:maxlength => 1024,
:class => 'wiki-edit',
:data => wiki_textarea_stimulus_attributes %>
</p>
<%= wikitoolbar_for 'time_entry_comments', preview_issue_path(:project_id => @project, :issue_id => @issue) %>
<% @time_entry.editable_custom_field_values.each do |value| %>
<p><%= custom_field_tag_with_label :time_entry, value %></p>
<% end %>
app/views/my/blocks/_timelog.html.erb
<%= entry.activity %>
</td>
<td class="subject"><%= entry.project %> <%= h(' - ') + link_to_issue(entry.issue, :truncate => 50) if entry.issue %></td>
<td class="comments"><%= entry.comments %></td>
<td class="comments"><%= content_tag('div', textilizable(entry, :comments), :class => 'wiki') if entry.comments.present? %></td>
<td class="hours"><%= html_hours(format_hours(entry.hours)) %></td>
<td class="buttons"><%= link_to_context_menu %></td>
</tr>
app/views/timelog/bulk_edit.html.erb
<p>
<label for="time_entry_comments"><%= l(:field_comments) %></label>
<%= text_field(:time_entry, :comments, :size => 100, :value => @time_entry_params[:comments]) %>
<%= textarea_tag 'time_entry[comments]', @time_entry_params[:comments],
:cols => 60, :rows => 3,
:maxlength => 1024, :class => 'wiki-edit',
:data => wiki_textarea_stimulus_attributes %>
</p>
<%= wikitoolbar_for 'time_entry_comments', (@project ? preview_issue_path(:project_id => @project) : preview_text_path) %>
<% @custom_fields.each do |custom_field| %>
<p>
test/functional/issues_controller_test.rb
assert_select 'select[name=?]', 'time_entry[activity_id]' do
assert_select 'option[value="10"][selected=selected]', :text => 'Development'
end
assert_select 'input[name=?][value=test_get_edit_with_params]', 'time_entry[comments]'
assert_select 'textarea.wiki-edit[name=?]', 'time_entry[comments]', :text => 'test_get_edit_with_params'
assert_select 'script', :text => /new jsToolBar\(document\.getElementById\('time_entry_comments'\)\)/
end
def test_get_edit_with_multi_custom_field
......
assert_select_error /Activity cannot be blank/
assert_select_error /Hours cannot be blank/
assert_select 'textarea[name=?]', 'issue[notes]', :text => notes
assert_select 'input[name=?][value=?]', 'time_entry[comments]', 'this is my comment'
assert_select 'textarea[name=?]', 'time_entry[comments]', :text => 'this is my comment'
end
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
end
assert_select 'input[name=?][value=?]', 'time_entry[hours]', '2:30'
assert_select 'input[name=?][value=?]', 'time_entry[comments]', 'should not be added'
assert_select 'textarea[name=?]', 'time_entry[comments]', :text => 'should not be added'
assert_select 'select[name=?]', 'time_entry[activity_id]' do
assert_select 'option[value=?][selected=selected]', TimeEntryActivity.first.id.to_s
end
test/functional/my_controller_test.rb
with_issue =
TimeEntry.create!(
:user => User.find(2), :spent_on => Date.yesterday,
:hours => 2.5, :activity_id => 10, :issue_id => 1
:hours => 2.5, :activity_id => 10, :issue_id => 1,
:comments => '*formatted*'
)
without_issue =
TimeEntry.create!(
:user => User.find(2), :spent_on => Date.yesterday,
:hours => 3.5, :activity_id => 10, :project_id => 1
)
get :page
with_settings :text_formatting => 'textile' do
get :page
end
assert_response :success
assert_select "tr#time-entry-#{with_issue.id}" do
assert_select 'td.subject a[href="/issues/1"]'
assert_select 'td.hours', :text => '2:30'
assert_select 'td.comments div.wiki strong', :text => 'formatted'
end
assert_select "tr#time-entry-#{without_issue.id}" do
assert_select 'td.hours', :text => '3:30'
assert_select 'td.comments div.wiki', 0
end
end
test/functional/timelog_controller_test.rb
# System wide custom field
assert_select 'select[name=?]', 'time_entry[custom_field_values][10]'
assert_select 'textarea.wiki-edit[name=?]', 'time_entry[comments]', :text => ''
# Activities
assert_select 'select[name=?]', 'time_entry[activity_id]' do
assert_select 'option[value=""]', :text => '(No change)'
(12-12/12)