Adds a link to spent time on version details (#13558).

git-svn-id: http://svn.redmine.org/redmine/trunk@15648 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2016-07-13 18:34:45 +00:00
parent 7e54597dcc
commit abf3fe9c83
2 changed files with 15 additions and 2 deletions

View File

@@ -22,7 +22,8 @@
<% if User.current.allowed_to_view_all_time_entries?(@project) %> <% if User.current.allowed_to_view_all_time_entries?(@project) %>
<tr> <tr>
<th><%= l(:label_spent_time) %></th> <th><%= l(:label_spent_time) %></th>
<td class="total-hours"><%= html_hours(l_hours(@version.spent_hours)) %></td> <td class="total-hours"><%= link_to html_hours(l_hours(@version.spent_hours)),
project_time_entries_path(@version.project, :set_filter => 1, :"issue.fixed_version_id" => @version.id) %></td>
</tr> </tr>
<% end %> <% end %>
</table> </table>

View File

@@ -20,7 +20,7 @@ require File.expand_path('../../test_helper', __FILE__)
class VersionsControllerTest < ActionController::TestCase class VersionsControllerTest < ActionController::TestCase
fixtures :projects, :versions, :issues, :users, :roles, :members, fixtures :projects, :versions, :issues, :users, :roles, :members,
:member_roles, :enabled_modules, :issue_statuses, :member_roles, :enabled_modules, :issue_statuses,
:issue_categories :issue_categories, :enumerations
def setup def setup
User.current = nil User.current = nil
@@ -98,6 +98,18 @@ class VersionsControllerTest < ActionController::TestCase
assert_select 'h2', :text => /1.0/ assert_select 'h2', :text => /1.0/
end end
def test_show_should_link_to_spent_time_on_version
version = Version.generate!
issue = Issue.generate(:fixed_version => version)
TimeEntry.generate!(:issue => issue, :hours => 7.2)
get :show, :id => version.id
assert_response :success
assert_select '.total-hours', :text => '7.20 hours'
assert_select '.total-hours a[href=?]', "/projects/ecookbook/time_entries?issue.fixed_version_id=#{version.id}&set_filter=1"
end
def test_show_should_display_nil_counts def test_show_should_display_nil_counts
with_settings :default_language => 'en' do with_settings :default_language => 'en' do
get :show, :id => 2, :status_by => 'category' get :show, :id => 2, :status_by => 'category'