Project

General

Profile

Defect #24041 » update_issue_subject_v3.patch

Marius BĂLTEANU, 2016-10-25 10:18

View differences:

app/views/timelog/_form.html.erb
<% end %>
<p>
<%= f.text_field :issue_id, :size => 6 %>
<% if @time_entry.issue.try(:visible?) %>
<span id="time_entry_issue"><%= "#{@time_entry.issue.tracker.name} ##{@time_entry.issue.id}: #{@time_entry.issue.subject}" %></span>
<% end %>
<span id="time_entry_issue">
<%= link_to_issue(@time_entry.issue) if @time_entry.issue.try(:visible?) %>
</span>
</p>
<p><%= f.date_field :spent_on, :size => 10, :required => true %><%= calendar_for('time_entry_spent_on') %></p>
<p><%= f.text_field :hours, :size => 6, :required => true %></p>
app/views/timelog/new.js.erb
$('#time_entry_activity_id').html('<%= escape_javascript options_for_select(activity_collection_for_select_options(@time_entry), @time_entry.activity_id) %>');
$('#time_entry_issue').html('<%= escape_javascript link_to_issue(@time_entry.issue) if @time_entry.issue.try(:visible?) %>');
test/functional/timelog_controller_test.rb
assert_select 'input[name=?][type=hidden]', 'project_id', 0
assert_select 'input[name=?][type=hidden]', 'issue_id', 0
assert_select 'span[id=?]', 'time_entry_issue'
assert_select 'select[name=?]', 'time_entry[project_id]' do
# blank option for project
assert_select 'option[value=""]'
......
assert_select 'input[name=?][type=hidden]', 'project_id', 0
assert_select 'input[name=?][type=hidden]', 'issue_id'
assert_select 'a[href=?]', '/issues/2', :text => /Feature request #2/
assert_select 'select[name=?]', 'time_entry[project_id]', 0
end
......
end
assert_select_error /Issue is invalid/
assert_select "input[name=?][value=?]", "time_entry[issue_id]", issue.id.to_s
assert_select "#time_entry_issue", 0
assert_select "#time_entry_issue a", 0
assert !response.body.include?('issue_that_is_not_visible')
end
......
assert_select 'form#bulk_edit_form[action=?]', '/time_entries/bulk_update' do
# System wide custom field
assert_select 'select[name=?]', 'time_entry[custom_field_values][10]'
# Activities
assert_select 'select[name=?]', 'time_entry[activity_id]' do
assert_select 'option[value=""]', :text => '(No change)'
......
@request.session[:user_id] = 2
# makes user a manager on the other project
Member.create!(:user_id => 2, :project_id => 3, :role_ids => [1])
# update time entry activity
post :bulk_update, :params => {:ids => [1, 2, 4], :time_entry => { :activity_id => 9 }}
......
def test_index_at_project_level
get :index, :params => {:project_id => 'ecookbook', :c => ['project']}
assert_response :success
assert_select 'tr.time-entry', 4
# project and subproject
projects = css_select('table.time-entries tbody td.project').map(&:text).uniq.sort
assert_equal ["eCookbook", "eCookbook Subproject 1"], projects
......
def test_index_at_project_level_should_include_csv_export_dialog
get :index, :params => {
:project_id => 'ecookbook',
:project_id => 'ecookbook',
:f => ['spent_on'],
:op => {'spent_on' => '>='},
:v => {'spent_on' => ['2007-04-01']},
(5-5/5)