Do not include empty blocks, this way, we avoid empty sidebars if not needed.

This commit is contained in:
2015-08-18 10:58:31 +02:00
parent b5e7d5d201
commit cfec9dc7f8
6 changed files with 60 additions and 8 deletions

View File

@@ -738,7 +738,9 @@ feature -- Generation
prepare (page: CMS_HTML_PAGE)
local
lnk: CMS_LINK
l_region: CMS_BLOCK_REGION
l_menu_list_prepared: ARRAYED_LIST [CMS_LINK_COMPOSITE]
l_empty_blocks: detachable ARRAYED_LIST [CMS_BLOCK]
do
-- Menu
create {CMS_LOCAL_LINK} lnk.make ("Home", "")
@@ -756,14 +758,29 @@ feature -- Generation
across
regions as reg_ic
loop
l_region := reg_ic.item
across
reg_ic.item.blocks as ic
l_region.blocks as ic
loop
if attached {CMS_MENU_BLOCK} ic.item as l_menu_block then
l_menu_list_prepared.force (l_menu_block.menu)
prepare_links (l_menu_block.menu)
if l_menu_block.menu.is_empty then
if l_empty_blocks = Void then
create l_empty_blocks.make (1)
end
l_empty_blocks.force (l_menu_block)
end
end
end
if l_empty_blocks /= Void then
across
l_empty_blocks as ic
loop
l_region.remove (ic.item)
end
l_empty_blocks := Void
end
end
-- Prepare menu not in a block.