From: Jean-Philippe Lang Date: Mon, 19 Jan 2015 21:36:59 +0000 (+0000) Subject: Fixed that group is not displayed when the first group is a boolean custom field... X-Git-Tag: 3.0.0~100 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=4730ef894fa9794e95e47919c9baa75fd5a264f8;p=redmine.git Fixed that group is not displayed when the first group is a boolean custom field group with "No" value (#18896). git-svn-id: http://svn.redmine.org/redmine/trunk@13922 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/views/issues/_list.html.erb b/app/views/issues/_list.html.erb index 48b5860a7..024866782 100644 --- a/app/views/issues/_list.html.erb +++ b/app/views/issues/_list.html.erb @@ -14,10 +14,10 @@ <% end %> - <% previous_group = false %> + <% previous_group, first = false, true %> <% issue_list(issues) do |issue, level| -%> - <% if @query.grouped? && (group = @query.group_by_column.value(issue)) != previous_group %> + <% if @query.grouped? && ((group = @query.group_by_column.value(issue)) != previous_group || first) %> <% reset_cycle %> @@ -27,7 +27,7 @@ "toggleAllRowGroups(this)", :class => 'toggle-all') %> - <% previous_group = group %> + <% previous_group, first = group, false %> <% end %> "> <%= check_box_tag("ids[]", issue.id, false, :id => nil) %> diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index d32c0ff49..7b7e7cbd4 100644 --- a/test/functional/issues_controller_test.rb +++ b/test/functional/issues_controller_test.rb @@ -305,11 +305,27 @@ class IssuesControllerTest < ActionController::TestCase assert_response :success end + assert_select 'tr.group', 3 assert_select 'tr.group', :text => /Yes/ assert_select 'tr.group', :text => /No/ assert_select 'tr.group', :text => /none/ end + def test_index_grouped_by_boolean_custom_field_with_false_group_in_first_position_should_show_the_group + cf = IssueCustomField.create!(:name => 'Bool', :is_for_all => true, :tracker_ids => [1,2,3], :field_format => 'bool', :is_filter => true) + CustomValue.create!(:custom_field => cf, :customized => Issue.find(1), :value => '0') + CustomValue.create!(:custom_field => cf, :customized => Issue.find(2), :value => '0') + + with_settings :default_language => 'en' do + get :index, :project_id => 1, :set_filter => 1, "cf_#{cf.id}" => "*", :group_by => "cf_#{cf.id}" + assert_response :success + assert_equal [1, 2], assigns(:issues).map(&:id).sort + end + + assert_select 'tr.group', 1 + assert_select 'tr.group', :text => /No/ + end + def test_index_with_query_grouped_by_tracker_in_normal_order 3.times {|i| Issue.generate!(:tracker_id => (i + 1))}