]> source.dussan.org Git - redmine.git/commitdiff
Fixed that the sidebar may be displayed empty (#15414).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Wed, 20 Nov 2013 19:17:20 +0000 (19:17 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Wed, 20 Nov 2013 19:17:20 +0000 (19:17 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@12310 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/helpers/application_helper.rb
test/functional/projects_controller_test.rb

index 2b37ad312bc1fe7afd297852b49a29886fdff3c4..7bee2117e28e454efae9e177827dbaf5d04655a6 100644 (file)
@@ -1173,18 +1173,13 @@ module ApplicationHelper
     super sources, options
   end
 
-  def content_for(name, content = nil, &block)
-    @has_content ||= {}
-    @has_content[name] = true
-    super(name, content, &block)
-  end
-
+  # TODO: remove this in 2.5.0
   def has_content?(name)
-    (@has_content && @has_content[name]) || false
+    content_for?(name)
   end
 
   def sidebar_content?
-    has_content?(:sidebar) || view_layouts_base_sidebar_hook_response.present?
+    content_for?(:sidebar) || view_layouts_base_sidebar_hook_response.present?
   end
 
   def view_layouts_base_sidebar_hook_response
index 79721d589204a045b4a8b44e3b33e2fc32720cab..6f294d6d0f6e1976c02e5dce854cbbe731a4b3fd 100644 (file)
@@ -320,6 +320,16 @@ class ProjectsControllerTest < ActionController::TestCase
     assert_select 'li', :text => /Development status/
   end
 
+  def test_show_should_not_display_empty_sidebar
+    p = Project.find(1)
+    p.enabled_module_names = []
+    p.save!
+
+    get :show, :id => 'ecookbook'
+    assert_response :success
+    assert_select '#main.nosidebar'
+  end
+
   def test_show_should_not_display_hidden_custom_fields
     ProjectCustomField.find_by_name('Development status').update_attribute :visible, false
     get :show, :id => 'ecookbook'