Updated block and template to render regions

This commit is contained in:
jvelilla
2014-11-06 22:33:48 -03:00
parent b90e3b3df0
commit f1b911b6e3
28 changed files with 307 additions and 813 deletions

View File

@@ -20,10 +20,10 @@ feature {NONE} -- Initialization
do
to_implement ("Refactor, take the info from a Database or Configuration file.")
create items.make (5)
force (create {CMS_MENU}.make ("main-menu", 3))
force (create {CMS_MENU}.make_with_title ("management", "Management", 3))
force (create {CMS_MENU}.make_with_title ("navigation", "Navigation", 3))
force (create {CMS_MENU}.make_with_title ("user", "User", 3))
force (create {CMS_MENU}.make ("main-menu", 3)) -- primary menu
force (create {CMS_MENU}.make_with_title ("management", "Management", 3)) -- secondary in admin view.
force (create {CMS_MENU}.make_with_title ("navigation", "Navigation", 3)) -- secondary
force (create {CMS_MENU}.make_with_title ("user", "User", 3)) -- first_side_bar
end
feature -- Access

View File

@@ -153,7 +153,7 @@ feature -- Hooks
perms: detachable ARRAYED_LIST [READABLE_STRING_8]
do
create lnk.make ("List of nodes", "/nodes")
a_menu_system.main_menu.extend (lnk)
a_menu_system.navigation_menu.extend (lnk)
end
end

View File

@@ -201,6 +201,29 @@ feature -- Blocks
l_region.extend (b)
end
set_blocks (a_page: CMS_HTML_PAGE)
-- Set blocks to the current `a_page'
do
debug
fixme ("Experimental code")
end
-- top_header_block
set_header_block (a_page)
end
set_header_block (a_page: CMS_HTML_PAGE)
do
if not main_menu.is_empty then
a_page.register_variable (main_menu, "primary_nav")
end
if not navigation_menu.is_empty then
a_page.register_variable (navigation_menu, "secondary_nav")
end
end
get_blocks
do
fixme ("find a way to have this in configuration or database, and allow different order")
@@ -312,7 +335,7 @@ feature -- Blocks
l_hb.append ("[
</ul>
</div>
</div>
</div>
]")
end
@@ -616,18 +639,19 @@ feature -- Generation
call_menu_alter_hooks (menu_system)
prepare_menu_system (menu_system)
get_blocks
across
regions as reg_ic
loop
across
reg_ic.item.blocks as ic
loop
if attached {CMS_MENU_BLOCK} ic.item as l_menu_block then
recursive_get_active (l_menu_block.menu, request)
end
end
end
set_blocks (page)
-- get_blocks
-- across
-- regions as reg_ic
-- loop
-- across
-- reg_ic.item.blocks as ic
-- loop
-- if attached {CMS_MENU_BLOCK} ic.item as l_menu_block then
-- recursive_get_active (l_menu_block.menu, request)
-- end
-- end
-- end
if attached title as l_title then
page.set_title (l_title)
@@ -635,16 +659,16 @@ feature -- Generation
page.set_title ("CMS::" + request.path_info)
end
-- blocks
across
regions as reg_ic
loop
across
reg_ic.item.blocks as ic
loop
page.add_to_region (theme.block_html (ic.item), reg_ic.item.name)
end
end
-- -- blocks
-- across
-- regions as reg_ic
-- loop
-- across
-- reg_ic.item.blocks as ic
-- loop
-- page.add_to_region (theme.block_html (ic.item), reg_ic.item.name)
-- end
-- end
end
common_prepare (page: CMS_HTML_PAGE)

View File

@@ -88,7 +88,7 @@ feature -- Conversion
to_implement ("Maybe we need a SMARTY_CMS_REGION_TEMPLATE")
to_implement ("Provide a default Menu using HTML hardcoded, maybe using the Default or providing a default implementation in CMS_THEME.menu_html")
-- Use the similar pattern to SMARTY_CMS_PAGE_TEMPLATE, with a different prepare
-- feature.
-- feature
create tpl.make ("tpl/menu", Current)
create l_page.make
l_page.register_variable (a_menu, "menu")