#3: Routet page and limited entries
The blog module routes /blog/{page} and the blog handler limits the entries per page (given as a feature) and sets the offsets according to the given page number
This commit is contained in:
@@ -106,14 +106,6 @@ feature -- Access: router
|
||||
end
|
||||
|
||||
|
||||
--feature -- Access: router
|
||||
|
||||
--setup_router (a_router: WSF_ROUTER; a_api: CMS_API)
|
||||
-- <Precursor>
|
||||
-- do
|
||||
-- a_router.handle_with_request_methods ("/blogs/", create {WSF_URI_AGENT_HANDLER}.make (agent handle_blogs (?,?, a_api)), a_router.methods_get)
|
||||
-- end
|
||||
|
||||
configure_web (a_api: CMS_API; a_node_api: CMS_BLOG_API; a_router: WSF_ROUTER)
|
||||
local
|
||||
l_blog_handler: BLOG_HANDLER
|
||||
@@ -121,8 +113,14 @@ configure_web (a_api: CMS_API; a_node_api: CMS_BLOG_API; a_router: WSF_ROUTER)
|
||||
do
|
||||
-- TODO: for now, focused only on web interface, add REST api later. [2015-May-18]
|
||||
create l_blog_handler.make (a_api, a_node_api)
|
||||
create l_uri_mapping.make_trailing_slash_ignored ("/blogs", l_blog_handler)
|
||||
|
||||
-- Let the class BLOG_HANDLER handle the requests on "/blogs"
|
||||
create l_uri_mapping.make_trailing_slash_ignored("/blogs", l_blog_handler)
|
||||
a_router.map_with_request_methods (l_uri_mapping, a_router.methods_get)
|
||||
|
||||
-- We can add a page number after /blogs/ to get older posts
|
||||
a_router.handle_with_request_methods ("/blogs/{page}", l_blog_handler, a_router.methods_get)
|
||||
|
||||
end
|
||||
|
||||
feature -- Hooks
|
||||
@@ -136,6 +134,7 @@ feature -- Hooks
|
||||
local
|
||||
lnk: CMS_LOCAL_LINK
|
||||
do
|
||||
-- Add the link to the blog to the main menu
|
||||
create lnk.make ("Blogs", "/blogs/")
|
||||
a_menu_system.primary_menu.extend (lnk)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user