Defect #5958 » 5958-patch.diff
| test/integration/layout_test.rb (working copy) | ||
|---|---|---|
| 116 | 116 |
get '/projects/ecookbook' |
| 117 | 117 |
assert_select 'div#quick-search form[action=/projects/ecookbook/search]' |
| 118 | 118 |
end |
| 119 | ||
| 120 |
def test_sidebar_is_shown_if_content_is_present |
|
| 121 |
log_user('admin','admin')
|
|
| 122 |
#project(1) has time_tracking enabled |
|
| 123 |
get '/projects/ecookbook' |
|
| 124 |
assert_select '#main.nosidebar', :count => 0 |
|
| 125 |
assert_select '#sidebar>p' |
|
| 126 |
end |
|
| 127 | ||
| 128 |
def test_sidebar_is_hidden_if_no_content |
|
| 129 |
log_user('admin','admin')
|
|
| 130 |
#project(2) has time_tracking disabled, |
|
| 131 |
#hence nothing in the sidebar |
|
| 132 |
get '/projects/onlinestore' |
|
| 133 |
assert_select '#main.nosidebar' |
|
| 134 |
assert_select '#sidebar>p', :count => 0 |
|
| 135 |
end |
|
| 119 | 136 |
end |
| app/helpers/application_helper.rb (working copy) | ||
|---|---|---|
| 1147 | 1147 |
super sources, options |
| 1148 | 1148 |
end |
| 1149 | 1149 | |
| 1150 |
def content_for(name, content = nil, &block) |
|
| 1151 |
@has_content ||= {}
|
|
| 1152 |
@has_content[name] = true |
|
| 1153 |
super(name, content, &block) |
|
| 1154 |
end |
|
| 1155 | ||
| 1156 | 1150 |
def has_content?(name) |
| 1157 |
(@has_content && @has_content[name]) || false |
|
| 1151 |
ActiveSupport::Deprecation.warn("ApplicationHelper#has_content? is deprecated and will be removed in Redmine 3.0. Please use #content_for? instead")
|
|
| 1152 |
content_for?(name) |
|
| 1158 | 1153 |
end |
| 1159 | 1154 | |
| 1160 | 1155 |
def sidebar_content? |
| 1161 |
has_content?(:sidebar) || view_layouts_base_sidebar_hook_response.present?
|
|
| 1156 |
content_for?(:sidebar) || view_layouts_base_sidebar_hook_response.present?
|
|
| 1162 | 1157 |
end |
| 1163 | 1158 | |
| 1164 | 1159 |
def view_layouts_base_sidebar_hook_response |
- « Previous
- 1
- 2
- 3
- Next »