@@ -544,7 +544,7 class Query < ActiveRecord::Base | |||||
544 | # Returns the SQL sort order that should be prepended for grouping |
|
544 | # Returns the SQL sort order that should be prepended for grouping | |
545 | def group_by_sort_order |
|
545 | def group_by_sort_order | |
546 | if grouped? && (column = group_by_column) |
|
546 | if grouped? && (column = group_by_column) | |
547 | order = (sort_criteria_order_for(column.name) || column.default_order).try(:upcase) |
|
547 | order = (sort_criteria_order_for(column.name) || column.default_order || 'asc').try(:upcase) | |
548 | column.sortable.is_a?(Array) ? |
|
548 | column.sortable.is_a?(Array) ? | |
549 | column.sortable.collect {|s| "#{s} #{order}"} : |
|
549 | column.sortable.collect {|s| "#{s} #{order}"} : | |
550 | "#{column.sortable} #{order}" |
|
550 | "#{column.sortable} #{order}" |
@@ -111,6 +111,47 class IssuesTest < Redmine::IntegrationTest | |||||
111 | assert_equal 0, Issue.find(1).attachments.length |
|
111 | assert_equal 0, Issue.find(1).attachments.length | |
112 | end |
|
112 | end | |
113 |
|
113 | |||
|
114 | def test_next_and_previous_links_should_be_displayed_after_query_grouped_and_sorted_by_version | |||
|
115 | with_settings :default_language => 'en' do | |||
|
116 | get '/projects/ecookbook/issues?set_filter=1&group_by=fixed_version&sort=priority:desc,fixed_version,id' | |||
|
117 | assert_response :success | |||
|
118 | assert_select 'td.id', :text => '5' | |||
|
119 | ||||
|
120 | get '/issues/5' | |||
|
121 | assert_response :success | |||
|
122 | assert_select '.next-prev-links .position', :text => '5 of 6' | |||
|
123 | end | |||
|
124 | end | |||
|
125 | ||||
|
126 | def test_next_and_previous_links_should_be_displayed_after_filter | |||
|
127 | with_settings :default_language => 'en' do | |||
|
128 | get '/projects/ecookbook/issues?set_filter=1&tracker_id=1' | |||
|
129 | assert_response :success | |||
|
130 | assert_select 'td.id', :text => '5' | |||
|
131 | ||||
|
132 | get '/issues/5' | |||
|
133 | assert_response :success | |||
|
134 | assert_select '.next-prev-links .position', :text => '3 of 5' | |||
|
135 | end | |||
|
136 | end | |||
|
137 | ||||
|
138 | def test_next_and_previous_links_should_be_displayed_after_saved_query | |||
|
139 | query = IssueQuery.create!(:name => 'Calendar Query', | |||
|
140 | :visibility => IssueQuery::VISIBILITY_PUBLIC, | |||
|
141 | :filters => {'tracker_id' => {:operator => '=', :values => ['1']}} | |||
|
142 | ) | |||
|
143 | ||||
|
144 | with_settings :default_language => 'en' do | |||
|
145 | get "/projects/ecookbook/issues?set_filter=1&query_id=#{query.id}" | |||
|
146 | assert_response :success | |||
|
147 | assert_select 'td.id', :text => '5' | |||
|
148 | ||||
|
149 | get '/issues/5' | |||
|
150 | assert_response :success | |||
|
151 | assert_select '.next-prev-links .position', :text => '6 of 8' | |||
|
152 | end | |||
|
153 | end | |||
|
154 | ||||
114 | def test_other_formats_links_on_index |
|
155 | def test_other_formats_links_on_index | |
115 | get '/projects/ecookbook/issues' |
|
156 | get '/projects/ecookbook/issues' | |
116 |
|
157 |
General Comments 0
You need to be logged in to leave comments.
Login now