Adds a link back to the issue list that we are coming from.

git-svn-id: http://svn.redmine.org/redmine/trunk@16478 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2017-04-04 17:49:40 +00:00
parent 7b125bc292
commit 8fe94c30fe
3 changed files with 12 additions and 1 deletions

View File

@@ -412,6 +412,7 @@ class IssuesController < ApplicationController
else else
retrieve_query_from_session retrieve_query_from_session
if @query if @query
@per_page = per_page_option
limit = 500 limit = 500
issue_ids = @query.issue_ids(:limit => (limit + 1)) issue_ids = @query.issue_ids(:limit => (limit + 1))
if (idx = issue_ids.index(@issue.id)) && idx < limit if (idx = issue_ids.index(@issue.id)) && idx < limit
@@ -422,6 +423,11 @@ class IssuesController < ApplicationController
@prev_issue_id = issue_ids[idx - 1] if idx > 0 @prev_issue_id = issue_ids[idx - 1] if idx > 0
@next_issue_id = issue_ids[idx + 1] if idx < (issue_ids.size - 1) @next_issue_id = issue_ids[idx + 1] if idx < (issue_ids.size - 1)
end end
query_params = @query.as_params
if @issue_position
query_params = query_params.merge(:page => (@issue_position / per_page_option) + 1, :per_page => per_page_option)
end
@query_path = _project_issues_path(@query.project, query_params)
end end
end end
end end

View File

@@ -11,7 +11,11 @@
:title => "##{@prev_issue_id}", :title => "##{@prev_issue_id}",
:accesskey => accesskey(:previous) %> | :accesskey => accesskey(:previous) %> |
<% if @issue_position && @issue_count %> <% if @issue_position && @issue_count %>
<span class="position"><%= l(:label_item_position, :position => @issue_position, :count => @issue_count) %></span> | <span class="position">
<%= link_to_if @query_path,
l(:label_item_position, :position => @issue_position, :count => @issue_count),
@query_path %>
</span> |
<% end %> <% end %>
<%= link_to_if @next_issue_id, <%= link_to_if @next_issue_id,
"#{l(:label_next)} \xc2\xbb", "#{l(:label_next)} \xc2\xbb",

View File

@@ -130,6 +130,7 @@ class IssuesTest < Redmine::IntegrationTest
get '/issues/5' get '/issues/5'
assert_response :success assert_response :success
assert_select '.next-prev-links .position', :text => '3 of 5' assert_select '.next-prev-links .position', :text => '3 of 5'
assert_select '.next-prev-links .position a[href^=?]', '/projects/ecookbook/issues?'
end end
end end