Browse Source

Fill the issue id when logging time from the time log list of an issue (#26520).

git-svn-id: http://svn.redmine.org/redmine/trunk@16924 e93f8b46-1217-0410-a6f0-8f06a7374b81
tags/4.0.0
Jean-Philippe Lang 6 years ago
parent
commit
e89b93f8d1

+ 7
- 0
app/models/time_entry_query.rb View File

[['spent_on', 'desc']] [['spent_on', 'desc']]
end end


# If a filter against a single issue is set, returns its id, otherwise nil.
def filtered_issue_id
if value_for('issue_id').to_s =~ /\A(\d+)\z/
$1
end
end

def base_scope def base_scope
TimeEntry.visible. TimeEntry.visible.
joins(:project, :user). joins(:project, :user).

+ 1
- 1
app/views/timelog/index.html.erb View File

<div class="contextual"> <div class="contextual">
<%= link_to l(:button_log_time), <%= link_to l(:button_log_time),
_new_time_entry_path(@project, @issue),
_new_time_entry_path(@project, @query.filtered_issue_id),
:class => 'icon icon-time-add' if User.current.allowed_to?(:log_time, @project, :global => true) %> :class => 'icon icon-time-add' if User.current.allowed_to?(:log_time, @project, :global => true) %>
</div> </div>



+ 6
- 0
test/functional/timelog_controller_test.rb View File



assert_select '.total-for-hours', :text => 'Hours: 162.90' assert_select '.total-for-hours', :text => 'Hours: 162.90'
assert_select 'form#query_form[action=?]', '/projects/ecookbook/time_entries' assert_select 'form#query_form[action=?]', '/projects/ecookbook/time_entries'

# 'Log time' shoudl link to log time on the filtered issue
assert_select 'a[href=?]', "/projects/ecookbook/time_entries/new"
end end


def test_index_with_display_subprojects_issues_to_false_should_not_include_subproject_entries def test_index_with_display_subprojects_issues_to_false_should_not_include_subproject_entries


get :index, :params => {:project_id => 'ecookbook', :issue_id => issue.id.to_s, :set_filter => 1} get :index, :params => {:project_id => 'ecookbook', :issue_id => issue.id.to_s, :set_filter => 1}
assert_select '.total-for-hours', :text => 'Hours: 7.00' assert_select '.total-for-hours', :text => 'Hours: 7.00'

# 'Log time' shoudl link to log time on the filtered issue
assert_select 'a[href=?]', "/issues/#{issue.id}/time_entries/new"
end end


def test_index_at_project_level_with_issue_fixed_version_id_short_filter def test_index_at_project_level_with_issue_fixed_version_id_short_filter

Loading…
Cancel
Save