GitLab steht wegen Wartungsarbeiten am Montag, den 10. Mai, zwischen 17:00 und 19:00 Uhr nicht zur Verfügung.

Commit 29092000 authored by jplang's avatar jplang

Fix link to issues when displaying a project query (#1565).

git-svn-id: https://svn.redmine.org/redmine/trunk@16409 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 7e43f8fb
......@@ -387,19 +387,23 @@ class Query < ActiveRecord::Base
end
def as_params
params = {}
filters.each do |field, options|
params[:f] ||= []
params[:f] << field
params[:op] ||= {}
params[:op][field] = options[:operator]
params[:v] ||= {}
params[:v][field] = options[:values]
if new_record?
params = {}
filters.each do |field, options|
params[:f] ||= []
params[:f] << field
params[:op] ||= {}
params[:op][field] = options[:operator]
params[:v] ||= {}
params[:v][field] = options[:values]
end
params[:c] = column_names
params[:sort] = sort_criteria.to_param
params[:set_filter] = 1
params
else
{:query_id => id}
end
params[:c] = column_names
params[:sort] = sort_criteria.to_param
params[:set_filter] = 1
params
end
def validate_query_filters
......
......@@ -6,7 +6,8 @@
</div>
<h3>
<%= link_to query.name, issues_path(query.as_params) %>
<%= "#{query.project} |" if query.project %>
<%= link_to query.name, _project_issues_path(query.project, query.as_params) %>
(<%= query.issue_count %>)
</h3>
......@@ -38,7 +39,7 @@
<% content_for :header_tags do %>
<%= auto_discovery_link_tag(:atom,
issues_path(query.as_params.merge(:format => 'atom', :key => User.current.rss_key)),
_project_issues_path(query.project, query.as_params.merge(:format => 'atom', :key => User.current.rss_key)),
{:title => query.name}) %>
<% end %>
......
......@@ -108,7 +108,7 @@ class MyControllerTest < Redmine::ControllerTest
end
end
def test_page_with_issuequery_block_and_selected_query
def test_page_with_issuequery_block_and_global_query
user = User.find(2)
query = IssueQuery.create!(:name => 'All issues', :user => user, :column_names => [:tracker, :subject, :status, :assigned_to])
user.pref.my_page_layout = {'top' => ['issuequery']}
......@@ -119,6 +119,7 @@ class MyControllerTest < Redmine::ControllerTest
assert_response :success
assert_select '#block-issuequery' do
assert_select 'a[href=?]', "/issues?query_id=#{query.id}"
# assert number of columns (columns from query + id column + checkbox column)
assert_select 'table.issues th', 6
# assert results limit
......@@ -127,7 +128,27 @@ class MyControllerTest < Redmine::ControllerTest
end
end
def test_page_with_issuequery_block_and_selected_query_and_custom_columns
def test_page_with_issuequery_block_and_project_query
user = User.find(2)
query = IssueQuery.create!(:name => 'All issues', :project => Project.find(1), :user => user, :column_names => [:tracker, :subject, :status, :assigned_to])
user.pref.my_page_layout = {'top' => ['issuequery']}
user.pref.my_page_settings = {'issuequery' => {:query_id => query.id}}
user.pref.save!
get :page
assert_response :success
assert_select '#block-issuequery' do
assert_select 'a[href=?]', "/projects/ecookbook/issues?query_id=#{query.id}"
# assert number of columns (columns from query + id column + checkbox column)
assert_select 'table.issues th', 6
# assert results limit
assert_select 'table.issues tr.issue', 10
assert_select 'table.issues td.assigned_to'
end
end
def test_page_with_issuequery_block_and_query_should_display_custom_columns
user = User.find(2)
query = IssueQuery.create!(:name => 'All issues', :user => user, :column_names => [:tracker, :subject, :status, :assigned_to])
user.pref.my_page_layout = {'top' => ['issuequery']}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment