diff --git a/examples/demo/modules/blog/cms_blog_api.e b/examples/demo/modules/blog/cms_blog_api.e index f0fb9f1..4442bb7 100644 --- a/examples/demo/modules/blog/cms_blog_api.e +++ b/examples/demo/modules/blog/cms_blog_api.e @@ -46,13 +46,41 @@ feature -- Access node blogs_order_created_desc: LIST[CMS_NODE] -- List of nodes ordered by creation date (descending) do - Result := node_storage.blogs + Result := add_authors(node_storage.blogs) end blogs_order_created_desc_limited (a_limit:INTEGER_32; a_offset:INTEGER_32) : LIST[CMS_NODE] -- List of nodes ordered by creation date and limited by limit and offset + local + tmp: LIST[CMS_NODE] do - Result := node_storage.blogs_limited (a_limit, a_offset) + -- load all posts and add the authors to each post + Result := add_authors(node_storage.blogs_limited (a_limit, a_offset)) + + end + +feature {NONE} -- Helpers + + add_authors(posts: LIST[CMS_NODE]) : LIST[CMS_NODE] + -- sets the authors of all given sql results + do + Result := posts + if posts /= Void then + across + Result + as + sql_result + loop + if + sql_result.item /= Void and then + attached {CMS_PARTIAL_USER} sql_result.item.author as l_partial_author + then + if attached cms_api.user_api.user_by_id (l_partial_author.id) as l_author then + sql_result.item.set_author (l_author) + end + end + end + end end end diff --git a/examples/demo/modules/blog/handler/blog_handler.e b/examples/demo/modules/blog/handler/blog_handler.e index bfec0e7..4498368 100644 --- a/examples/demo/modules/blog/handler/blog_handler.e +++ b/examples/demo/modules/blog/handler/blog_handler.e @@ -33,6 +33,8 @@ inherit REFACTORING_HELPER + CMS_API_ACCESS + create make diff --git a/modules/node/handler/cms_node_type_webform_manager.e b/modules/node/handler/cms_node_type_webform_manager.e index 697e73b..7ee2140 100644 --- a/modules/node/handler/cms_node_type_webform_manager.e +++ b/modules/node/handler/cms_node_type_webform_manager.e @@ -54,9 +54,11 @@ feature -- Forms ... create fset.make fset.set_legend ("Body") + -- Add summary fset.extend (sum) fset.extend_html_text("
") + -- Add content (body) fset.extend (ta) fset.extend_html_text ("
")