]> source.dussan.org Git - redmine.git/commitdiff
Hide version and/or category on issue details when no versions and/or categories...
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 17 Oct 2015 07:00:38 +0000 (07:00 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 17 Oct 2015 07:00:38 +0000 (07:00 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@14679 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/views/issues/show.html.erb
test/functional/issues_controller_test.rb

index f980f0b401abf0932be75955444162f99cd7a74e..4c60587d2d6fc60714c61c3033ac40c7b1173d6a 100644 (file)
   unless @issue.disabled_core_fields.include?('assigned_to_id')
     rows.left l(:field_assigned_to), avatar(@issue.assigned_to, :size => "14").to_s.html_safe + (@issue.assigned_to ? link_to_user(@issue.assigned_to) : "-"), :class => 'assigned-to'
   end
-  unless @issue.disabled_core_fields.include?('category_id')
+  unless @issue.disabled_core_fields.include?('category_id') || (@issue.category.nil? && @issue.project.issue_categories.none?)
     rows.left l(:field_category), (@issue.category ? @issue.category.name : "-"), :class => 'category'
   end
-  unless @issue.disabled_core_fields.include?('fixed_version_id')
+  unless @issue.disabled_core_fields.include?('fixed_version_id') || (@issue.fixed_version.nil? && @issue.assignable_versions.none?)
     rows.left l(:field_fixed_version), (@issue.fixed_version ? link_to_version(@issue.fixed_version) : "-"), :class => 'fixed-version'
   end
 
index b2e496534a96926a1b3297e244394520eab465c6..9c56b2a24e18fb21df62e84531e49e6819194aed 100644 (file)
@@ -1377,6 +1377,22 @@ class IssuesControllerTest < ActionController::TestCase
     end
   end
 
+  def test_show_should_display_category_field_if_categories_are_defined
+    Issue.update_all :category_id => nil
+
+    get :show, :id => 1
+    assert_response :success
+    assert_select 'table.attributes .category'
+  end
+
+  def test_show_should_not_display_category_field_if_no_categories_are_defined
+    Project.find(1).issue_categories.delete_all
+
+    get :show, :id => 1
+    assert_response :success
+    assert_select 'table.attributes .category', 0
+  end
+
   def test_show_should_display_link_to_the_assignee
     get :show, :id => 2
     assert_response :success