Feature #202 » textilize-time-entry-comments_r25176.patch
| app/helpers/queries_helper.rb | ||
|---|---|---|
|
link_to value, issue_path(item)
|
||
|
when :parent, :'issue.parent'
|
||
|
value ? (value.visible? ? link_to_issue(value, :subject => false) : "##{value.id}") : ''
|
||
|
when :description
|
||
|
item.description? ? content_tag('div', textilizable(item, :description), :class => "wiki") : ''
|
||
|
when :last_notes
|
||
|
item.last_notes.present? ? content_tag('div', textilizable(item, :last_notes), :class => "wiki") : ''
|
||
|
when :description, :last_notes, :comments
|
||
|
item.send(column.name).present? ? content_tag('div', textilizable(item, column.name), :class => 'wiki') : ''
|
||
|
when :done_ratio
|
||
|
progress_bar(value)
|
||
|
when :relations
|
||
| app/views/issues/tabs/_time_entries.html.erb | ||
|---|---|---|
|
<%= l_hours_short time_entry.hours %>
|
||
|
</li>
|
||
|
</ul>
|
||
|
<div class="journal-note">
|
||
|
<%= time_entry.comments %>
|
||
|
</div>
|
||
|
<% if time_entry.comments.present? %>
|
||
|
<div class="wiki journal-note">
|
||
|
<%= textilizable(time_entry, :comments) %>
|
||
|
</div>
|
||
|
<% end %>
|
||
|
</div>
|
||
|
</div>
|
||
|
<%= call_hook(:view_issues_history_time_entry_bottom, { :time_entry => time_entry }) %>
|
||
| app/views/timelog/_form.html.erb | ||
|---|---|---|
|
<% end %>
|
||
|
<p><%= f.date_field :spent_on, :size => 10, :required => true %><%= calendar_for('time_entry_spent_on') %></p>
|
||
|
<p><%= f.hours_field :hours, :size => 6, :required => true %></p>
|
||
|
<p><%= f.text_field :comments, :size => 100, :maxlength => 1024, :required => Setting.timelog_required_fields.include?('comments') %></p>
|
||
|
<p>
|
||
|
<%= f.textarea :comments, :cols => 60,
|
||
|
:rows => [[3, @time_entry.comments.to_s.length / 50].max, 10].min,
|
||
|
:maxlength => 1024,
|
||
|
:class => 'wiki-edit',
|
||
|
:data => wiki_textarea_stimulus_attributes,
|
||
|
:required => Setting.timelog_required_fields.include?('comments') %>
|
||
|
</p>
|
||
|
<%= wikitoolbar_for 'time_entry_comments', (@project ? preview_issue_path(:project_id => @project) : preview_text_path) %>
|
||
|
<p><%= f.select :activity_id, activity_collection_for_select_options(@time_entry), :required => true %></p>
|
||
|
<% @time_entry.editable_custom_field_values.each do |value| %>
|
||
|
<p><%= custom_field_tag_with_label :time_entry, value %></p>
|
||
| test/functional/issues_controller_test.rb | ||
|---|---|---|
|
end
|
||
|
end
|
||
|
def test_show_spent_time_tab_should_textilize_time_entry_comments
|
||
|
@request.session[:user_id] = 1
|
||
|
TimeEntry.find(3).update!(:comments => '*formatted comment*')
|
||
|
with_settings :text_formatting => 'textile' do
|
||
|
get(:issue_tab, :params => {:id => 3, :name => 'time_entries'}, :xhr => true)
|
||
|
end
|
||
|
assert_response :success
|
||
|
assert_select 'div[id=?]', 'time-entry-3' do
|
||
|
assert_select 'div.wiki.journal-note strong', :text => 'formatted comment'
|
||
|
end
|
||
|
end
|
||
|
def test_show_should_display_open_badge_for_open_issue
|
||
|
get :show, params: {id: 1}
|
||
| test/functional/timelog_controller_test.rb | ||
|---|---|---|
|
end
|
||
|
assert_select 'label[for=?]', 'time_entry_user_id', 0
|
||
|
assert_select 'select[name=?]', 'time_entry[user_id]', 0
|
||
|
assert_select 'textarea.wiki-edit[name=?][maxlength=?]', 'time_entry[comments]', '1024'
|
||
|
assert_select 'script', :text => /new jsToolBar\(document\.getElementById\('time_entry_comments'\)\)/
|
||
|
assert_select 'script', :text => %r{preview/text}
|
||
|
end
|
||
|
def test_new_should_mark_comments_as_required_if_setting_requires_it
|
||
|
@request.session[:user_id] = 3
|
||
|
with_settings :timelog_required_fields => ['comments'] do
|
||
|
get :new
|
||
|
end
|
||
|
assert_response :success
|
||
|
assert_select 'label[for=?] span.required', 'time_entry_comments'
|
||
|
end
|
||
|
def test_new_with_project_id
|
||
| ... | ... | |
|
assert_select 'input[name=?][type=hidden]', 'project_id'
|
||
|
assert_select 'input[name=?][type=hidden]', 'issue_id', 0
|
||
|
assert_select 'select[name=?]', 'time_entry[project_id]', 0
|
||
|
assert_select 'script', :text => %r{issues/preview}
|
||
|
end
|
||
|
def test_new_with_issue_id
|
||
| test/helpers/queries_helper_test.rb | ||
|---|---|---|
|
assert_select_in options, 'option[value=?]', "cf_#{i_cf.id}.cf_#{u_cf.id}", text: "User's Phone number"
|
||
|
assert_select_in options, 'optgroup[label=?]', 'User', 1
|
||
|
end
|
||
|
def test_column_value_should_textilize_item
|
||
|
with_settings :text_formatting => 'textile' do
|
||
|
column = QueryColumn.new(:description)
|
||
|
item = Issue.generate!(:description => '*issue description*')
|
||
|
value = column.value_object(item)
|
||
|
assert_select_in column_value(column, item, value), 'div.wiki>p>strong', :text => 'issue description'
|
||
|
column = QueryColumn.new(:last_notes)
|
||
|
Journal.generate!(journalized: item, notes: '*last note*')
|
||
|
value = column.value_object(item)
|
||
|
assert_select_in column_value(column, item, value), 'div.wiki>p>strong', :text => 'last note'
|
||
|
column = QueryColumn.new(:comments)
|
||
|
item = TimeEntry.generate!(:comments => '*time entry comments*')
|
||
|
value = column.value_object(item)
|
||
|
assert_select_in column_value(column, item, value), 'div.wiki>p>strong', :text => 'time entry comments'
|
||
|
end
|
||
|
end
|
||
|
end
|
||