diff --git a/examples/demo/site/themes/bootstrap/assets/css/node.css b/examples/demo/site/themes/bootstrap/assets/css/node.css index 244882b..85b78c9 100644 --- a/examples/demo/site/themes/bootstrap/assets/css/node.css +++ b/examples/demo/site/themes/bootstrap/assets/css/node.css @@ -16,3 +16,8 @@ li.cms_type_blog a::before { ul.cms-nodes li:first-child { border-top: none; } + +.summary{ + margin-top:20px; + font-weight:bold; +} \ No newline at end of file diff --git a/modules/node/handler/blog_handler.e b/modules/node/handler/blog_handler.e index a6a2934..63786b3 100644 --- a/modules/node/handler/blog_handler.e +++ b/modules/node/handler/blog_handler.e @@ -46,8 +46,20 @@ feature -- HTTP Methods if n.content_type.is_equal ("blog") then lnk := node_api.node_link (n) s.append ("
  • ") + + -- Title with link s.append (l_page.link (lnk.title, lnk.location, Void)) - --s.append (l_page.link (n.title + " (#" + n.id.out + ")", node_api.node_path (n), Void)) + + -- Summary + if attached n.summary as l_summary then + s.append ("
    ") + if attached api.format (n.format) as f then + s.append (f.formatted_output (l_summary)) + else + s.append (l_page.formats.default_format.formatted_output (l_summary)) + end + end + s.append ("
  • %N") end end diff --git a/modules/node/handler/cms_node_type_webform_manager.e b/modules/node/handler/cms_node_type_webform_manager.e index c86f2d3..e3d8316 100644 --- a/modules/node/handler/cms_node_type_webform_manager.e +++ b/modules/node/handler/cms_node_type_webform_manager.e @@ -37,7 +37,7 @@ feature -- Forms ... if a_node /= Void then ta.set_text_value (a_node.content) end --- ta.set_label ("Body") + ta.set_label ("Content") ta.set_description ("This is the main content") ta.set_is_required (False) @@ -48,7 +48,7 @@ feature -- Forms ... if a_node /= Void then sum.set_text_value (a_node.summary) end --- sum.set_label ("Summary") + sum.set_label ("Summary") sum.set_description ("This is the summary") sum.set_is_required (False) @@ -104,7 +104,7 @@ feature -- Forms ... update_node (response: NODE_RESPONSE; fd: WSF_FORM_DATA; a_node: CMS_NODE) local - b: detachable READABLE_STRING_8 + b,s: detachable READABLE_STRING_8 f: detachable CONTENT_FORMAT do if attached fd.integer_item ("id") as l_id and then l_id > 0 then @@ -117,6 +117,12 @@ feature -- Forms ... if attached fd.string_item ("body") as l_body then b := l_body end + + -- Read out the summary field from the form data + if attached fd.string_item ("summary") as l_summary then + s := l_summary + end + if attached fd.string_item ("format") as s_format and then attached response.api.format (s_format) as f_format then f := f_format elseif a_node /= Void and then attached a_node.format as s_format and then attached response.api.format (s_format) as f_format then @@ -124,15 +130,19 @@ feature -- Forms ... else f := response.formats.default_format end + + -- Update node with summary and body content if b /= Void then - a_node.set_content (b, Void, f.name) -- FIXME: summary + a_node.set_content (b, s, f.name) end + + end new_node (response: NODE_RESPONSE; fd: WSF_FORM_DATA; a_node: detachable CMS_NODE): G -- local - b: detachable READABLE_STRING_8 + b,s: detachable READABLE_STRING_8 f: detachable CONTENT_FORMAT l_node: detachable like new_node do @@ -166,9 +176,16 @@ feature -- Forms ... end l_node.set_author (response.user) + --Summary + if attached fd.string_item ("summary") as l_summary then + s := l_summary + end + + --Content if attached fd.string_item ("body") as l_body then b := l_body end + if attached fd.string_item ("format") as s_format and then attached response.api.format (s_format) as f_format then f := f_format elseif a_node /= Void and then attached a_node.format as s_format and then attached response.api.format (s_format) as f_format then @@ -176,8 +193,10 @@ feature -- Forms ... else f := response.formats.default_format end + + -- Update node with summary and content if b /= Void then - l_node.set_content (b, Void, f.name) + l_node.set_content (b, s, f.name) end Result := l_node end @@ -216,6 +235,19 @@ feature -- Output s.append (")") end s.append ("") + + if attached a_node.summary as l_summary then + s.append ("

    ") + if attached node_api.cms_api.format (a_node.format) as f then + s.append (f.formatted_output (l_summary)) + else + s.append (a_response.formats.default_format.formatted_output (l_summary)) + end + + s.append ("

    ") + + end + if attached a_node.content as l_content then s.append ("

    ") if attached node_api.cms_api.format (a_node.format) as f then