Updated the CMS pagination component.
Harmonized count type to NATURAL_64 for recent_nodes (more to do later). Fix get is active code.
This commit is contained in:
@@ -41,20 +41,36 @@ feature -- HTTP Methods
|
||||
s: STRING
|
||||
n: CMS_NODE
|
||||
lnk: CMS_LOCAL_LINK
|
||||
l_page_helper: CMS_NODE_PAGINATION_HELPER
|
||||
l_page_helper: CMS_PAGINATION_GENERATOR
|
||||
s_pager: STRING
|
||||
l_count: NATURAL_64
|
||||
do
|
||||
-- At the moment the template is hardcoded, but we can
|
||||
-- At the moment the template are hardcoded, but we can
|
||||
-- get them from the configuration file and load them into
|
||||
-- the setup class.
|
||||
|
||||
l_count := node_api.nodes_count
|
||||
|
||||
create {GENERIC_VIEW_CMS_RESPONSE} l_response.make (req, res, api)
|
||||
create l_page_helper.make ("nodes/", req, l_response, node_api.nodes_count)
|
||||
|
||||
create s.make_empty
|
||||
l_page_helper.append_pagination_summary_to (s)
|
||||
l_page_helper.append_html_pager_to (s)
|
||||
if l_count > 1 then
|
||||
l_response.set_title ("Listing " + l_count.out + " nodes")
|
||||
else
|
||||
l_response.set_title ("Listing " + l_count.out + " node")
|
||||
end
|
||||
|
||||
if attached node_api.recent_nodes (l_page_helper.pager) as lst then
|
||||
create s_pager.make_empty
|
||||
create l_page_helper.make ("nodes/?page={page}&size={size}", node_api.nodes_count, 25) -- FIXME: Make this default page size a global CMS settings
|
||||
l_page_helper.get_setting_from_request (req)
|
||||
if l_page_helper.pages_count > 1 then
|
||||
l_page_helper.append_to_html (l_response, s_pager)
|
||||
if l_page_helper.page_size > 20 then
|
||||
s.append (s_pager)
|
||||
end
|
||||
end
|
||||
|
||||
if attached node_api.recent_nodes (l_page_helper.query_parameters) as lst then
|
||||
s.append ("<ul class=%"cms-nodes%">%N")
|
||||
across
|
||||
lst as ic
|
||||
@@ -63,14 +79,21 @@ feature -- HTTP Methods
|
||||
lnk := node_api.node_link (n)
|
||||
s.append ("<li class=%"cms_type_"+ n.content_type +"%">")
|
||||
s.append (l_response.link (lnk.title, lnk.location, Void))
|
||||
debug
|
||||
if attached node_api.content_type (n.content_type) as ct then
|
||||
s.append ("<span class=%"description%">")
|
||||
s.append (html_encoded (ct.title))
|
||||
s.append ("</span>")
|
||||
end
|
||||
end
|
||||
s.append ("</li>%N")
|
||||
end
|
||||
s.append ("</ul>%N")
|
||||
end
|
||||
l_page_helper.append_html_pager_to (s)
|
||||
-- Again the pager at the bottom, if needed
|
||||
s.append (s_pager)
|
||||
|
||||
l_response.set_main_content (s)
|
||||
l_response.add_block (create {CMS_CONTENT_BLOCK}.make ("nodes_warning", Void, "/nodes/ is not yet fully implemented<br/>", Void), "highlighted")
|
||||
l_response.execute
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user