Updated code based on Jocelyn's suggestions.

This commit is contained in:
jvelilla
2015-05-21 16:46:06 -03:00
parent 53f3162b4a
commit 306b39ab78
2 changed files with 18 additions and 14 deletions

View File

@@ -1,6 +1,5 @@
note note
description: "Summary description for {NODE_PAGE_BUILDER}." description: "Paginator builder for CMS nodes."
author: ""
date: "$Date$" date: "$Date$"
revision: "$Revision$" revision: "$Revision$"
@@ -9,28 +8,36 @@ class
inherit inherit
PAGE_BUILDER [CMS_NODE] NODE_PAGINATION_BUILDER [CMS_NODE]
rename
make as page_make CMS_NODE_HANDLER
redefine
make
end end
create create
make make
feature {NONE} -- Initialization feature {NONE} -- Initialization
make (a_api: CMS_API; a_module_api: CMS_NODE_API) make (a_api: CMS_API; a_module_api: CMS_NODE_API)
-- Create an object.
do do
page_make (a_api, a_module_api) Precursor (a_api, a_module_api)
limit := 5 limit := 5
offset := 0 offset := 0
ensure then
limit_set: limit = 5
offset_set: offset = 0
end end
feature -- Pager feature -- Pager
list: LIST[CMS_NODE] list: LIST [CMS_NODE]
-- <Precursor>.
do do
create {ARRAYED_LIST[CMS_NODE]}Result.make (0) --NOTE: the current implementation does not use
-- order by and ordering.
create {ARRAYED_LIST [CMS_NODE]} Result.make (0)
Result := node_api.recent_nodes (offset.as_integer_32, limit.as_integer_32) Result := node_api.recent_nodes (offset.as_integer_32, limit.as_integer_32)
end end

View File

@@ -1,13 +1,10 @@
note note
description: "Generic Page Builder Interface" description: "Generic Node Pagination Builder Interface"
date: "$Date$" date: "$Date$"
revision: "$Revision$" revision: "$Revision$"
deferred class deferred class
PAGE_BUILDER [G->CMS_NODE] NODE_PAGINATION_BUILDER [G]
inherit
CMS_NODE_HANDLER
feature -- Access feature -- Access