Fixed that the sidebar may be displayed empty (#15414).
git-svn-id: http://svn.redmine.org/redmine/trunk@12310 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
7df9f8d31e
commit
bba304ef39
|
@ -1173,18 +1173,13 @@ module ApplicationHelper
|
||||||
super sources, options
|
super sources, options
|
||||||
end
|
end
|
||||||
|
|
||||||
def content_for(name, content = nil, &block)
|
# TODO: remove this in 2.5.0
|
||||||
@has_content ||= {}
|
|
||||||
@has_content[name] = true
|
|
||||||
super(name, content, &block)
|
|
||||||
end
|
|
||||||
|
|
||||||
def has_content?(name)
|
def has_content?(name)
|
||||||
(@has_content && @has_content[name]) || false
|
content_for?(name)
|
||||||
end
|
end
|
||||||
|
|
||||||
def sidebar_content?
|
def sidebar_content?
|
||||||
has_content?(:sidebar) || view_layouts_base_sidebar_hook_response.present?
|
content_for?(:sidebar) || view_layouts_base_sidebar_hook_response.present?
|
||||||
end
|
end
|
||||||
|
|
||||||
def view_layouts_base_sidebar_hook_response
|
def view_layouts_base_sidebar_hook_response
|
||||||
|
|
|
@ -320,6 +320,16 @@ class ProjectsControllerTest < ActionController::TestCase
|
||||||
assert_select 'li', :text => /Development status/
|
assert_select 'li', :text => /Development status/
|
||||||
end
|
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
|
def test_show_should_not_display_hidden_custom_fields
|
||||||
ProjectCustomField.find_by_name('Development status').update_attribute :visible, false
|
ProjectCustomField.find_by_name('Development status').update_attribute :visible, false
|
||||||
get :show, :id => 'ecookbook'
|
get :show, :id => 'ecookbook'
|
||||||
|
|
Loading…
Reference in New Issue