Feature #202 » textilize-time-entry-comments_r25176.patch
| app/helpers/queries_helper.rb | ||
|---|---|---|
| 261 | 261 |
link_to value, issue_path(item) |
| 262 | 262 |
when :parent, :'issue.parent' |
| 263 | 263 |
value ? (value.visible? ? link_to_issue(value, :subject => false) : "##{value.id}") : ''
|
| 264 |
when :description |
|
| 265 |
item.description? ? content_tag('div', textilizable(item, :description), :class => "wiki") : ''
|
|
| 266 |
when :last_notes |
|
| 267 |
item.last_notes.present? ? content_tag('div', textilizable(item, :last_notes), :class => "wiki") : ''
|
|
| 264 |
when :description, :last_notes, :comments |
|
| 265 |
item.send(column.name).present? ? content_tag('div', textilizable(item, column.name), :class => 'wiki') : ''
|
|
| 268 | 266 |
when :done_ratio |
| 269 | 267 |
progress_bar(value) |
| 270 | 268 |
when :relations |
| app/views/issues/tabs/_time_entries.html.erb | ||
|---|---|---|
| 25 | 25 |
<%= l_hours_short time_entry.hours %> |
| 26 | 26 |
</li> |
| 27 | 27 |
</ul> |
| 28 |
<div class="journal-note"> |
|
| 29 |
<%= time_entry.comments %> |
|
| 30 |
</div> |
|
| 28 |
<% if time_entry.comments.present? %> |
|
| 29 |
<div class="wiki journal-note"> |
|
| 30 |
<%= textilizable(time_entry, :comments) %> |
|
| 31 |
</div> |
|
| 32 |
<% end %> |
|
| 31 | 33 |
</div> |
| 32 | 34 |
</div> |
| 33 | 35 |
<%= call_hook(:view_issues_history_time_entry_bottom, { :time_entry => time_entry }) %>
|
| 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>
|
|
| 30 |
<p> |
|
| 31 |
<%= f.textarea :comments, :cols => 60, |
|
| 32 |
:rows => [[3, @time_entry.comments.to_s.length / 50].max, 10].min, |
|
| 33 |
:maxlength => 1024, |
|
| 34 |
:class => 'wiki-edit', |
|
| 35 |
:data => wiki_textarea_stimulus_attributes, |
|
| 36 |
:required => Setting.timelog_required_fields.include?('comments') %>
|
|
| 37 |
</p> |
|
| 38 |
<%= wikitoolbar_for 'time_entry_comments', (@project ? preview_issue_path(:project_id => @project) : preview_text_path) %> |
|
| 31 | 39 |
<p><%= f.select :activity_id, activity_collection_for_select_options(@time_entry), :required => true %></p> |
| 32 | 40 |
<% @time_entry.editable_custom_field_values.each do |value| %> |
| 33 | 41 |
<p><%= custom_field_tag_with_label :time_entry, value %></p> |
| test/functional/issues_controller_test.rb | ||
|---|---|---|
| 3427 | 3427 |
end |
| 3428 | 3428 |
end |
| 3429 | 3429 | |
| 3430 |
def test_show_spent_time_tab_should_textilize_time_entry_comments |
|
| 3431 |
@request.session[:user_id] = 1 |
|
| 3432 |
TimeEntry.find(3).update!(:comments => '*formatted comment*') |
|
| 3433 | ||
| 3434 |
with_settings :text_formatting => 'textile' do |
|
| 3435 |
get(:issue_tab, :params => {:id => 3, :name => 'time_entries'}, :xhr => true)
|
|
| 3436 |
end |
|
| 3437 |
assert_response :success |
|
| 3438 | ||
| 3439 |
assert_select 'div[id=?]', 'time-entry-3' do |
|
| 3440 |
assert_select 'div.wiki.journal-note strong', :text => 'formatted comment' |
|
| 3441 |
end |
|
| 3442 |
end |
|
| 3443 | ||
| 3430 | 3444 |
def test_show_should_display_open_badge_for_open_issue |
| 3431 | 3445 |
get :show, params: {id: 1}
|
| 3432 | 3446 | |
| test/functional/timelog_controller_test.rb | ||
|---|---|---|
| 41 | 41 |
end |
| 42 | 42 |
assert_select 'label[for=?]', 'time_entry_user_id', 0 |
| 43 | 43 |
assert_select 'select[name=?]', 'time_entry[user_id]', 0 |
| 44 |
assert_select 'textarea.wiki-edit[name=?][maxlength=?]', 'time_entry[comments]', '1024' |
|
| 45 |
assert_select 'script', :text => /new jsToolBar\(document\.getElementById\('time_entry_comments'\)\)/
|
|
| 46 |
assert_select 'script', :text => %r{preview/text}
|
|
| 47 |
end |
|
| 48 | ||
| 49 |
def test_new_should_mark_comments_as_required_if_setting_requires_it |
|
| 50 |
@request.session[:user_id] = 3 |
|
| 51 |
with_settings :timelog_required_fields => ['comments'] do |
|
| 52 |
get :new |
|
| 53 |
end |
|
| 54 |
assert_response :success |
|
| 55 |
assert_select 'label[for=?] span.required', 'time_entry_comments' |
|
| 44 | 56 |
end |
| 45 | 57 | |
| 46 | 58 |
def test_new_with_project_id |
| ... | ... | |
| 51 | 63 |
assert_select 'input[name=?][type=hidden]', 'project_id' |
| 52 | 64 |
assert_select 'input[name=?][type=hidden]', 'issue_id', 0 |
| 53 | 65 |
assert_select 'select[name=?]', 'time_entry[project_id]', 0 |
| 66 |
assert_select 'script', :text => %r{issues/preview}
|
|
| 54 | 67 |
end |
| 55 | 68 | |
| 56 | 69 |
def test_new_with_issue_id |
| test/helpers/queries_helper_test.rb | ||
|---|---|---|
| 109 | 109 |
assert_select_in options, 'option[value=?]', "cf_#{i_cf.id}.cf_#{u_cf.id}", text: "User's Phone number"
|
| 110 | 110 |
assert_select_in options, 'optgroup[label=?]', 'User', 1 |
| 111 | 111 |
end |
| 112 | ||
| 113 |
def test_column_value_should_textilize_item |
|
| 114 |
with_settings :text_formatting => 'textile' do |
|
| 115 |
column = QueryColumn.new(:description) |
|
| 116 |
item = Issue.generate!(:description => '*issue description*') |
|
| 117 |
value = column.value_object(item) |
|
| 118 |
assert_select_in column_value(column, item, value), 'div.wiki>p>strong', :text => 'issue description' |
|
| 119 |
column = QueryColumn.new(:last_notes) |
|
| 120 |
Journal.generate!(journalized: item, notes: '*last note*') |
|
| 121 |
value = column.value_object(item) |
|
| 122 |
assert_select_in column_value(column, item, value), 'div.wiki>p>strong', :text => 'last note' |
|
| 123 |
column = QueryColumn.new(:comments) |
|
| 124 |
item = TimeEntry.generate!(:comments => '*time entry comments*') |
|
| 125 |
value = column.value_object(item) |
|
| 126 |
assert_select_in column_value(column, item, value), 'div.wiki>p>strong', :text => 'time entry comments' |
|
| 127 |
end |
|
| 128 |
end |
|
| 112 | 129 |
end |