#1: Added the summary field to all nodes. It gets saved if we edit the node. On a node page the summary is shown first, then the main content. In the blog list the title and the summry is shown
This commit is contained in:
@@ -16,3 +16,8 @@ li.cms_type_blog a::before {
|
|||||||
ul.cms-nodes li:first-child {
|
ul.cms-nodes li:first-child {
|
||||||
border-top: none;
|
border-top: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.summary{
|
||||||
|
margin-top:20px;
|
||||||
|
font-weight:bold;
|
||||||
|
}
|
||||||
@@ -46,8 +46,20 @@ feature -- HTTP Methods
|
|||||||
if n.content_type.is_equal ("blog") then
|
if n.content_type.is_equal ("blog") then
|
||||||
lnk := node_api.node_link (n)
|
lnk := node_api.node_link (n)
|
||||||
s.append ("<li class=%"cms_type_"+ n.content_type +"%">")
|
s.append ("<li class=%"cms_type_"+ n.content_type +"%">")
|
||||||
|
|
||||||
|
-- Title with link
|
||||||
s.append (l_page.link (lnk.title, lnk.location, Void))
|
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 ("<br />")
|
||||||
|
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 ("</li>%N")
|
s.append ("</li>%N")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ feature -- Forms ...
|
|||||||
if a_node /= Void then
|
if a_node /= Void then
|
||||||
ta.set_text_value (a_node.content)
|
ta.set_text_value (a_node.content)
|
||||||
end
|
end
|
||||||
-- ta.set_label ("Body")
|
ta.set_label ("Content")
|
||||||
ta.set_description ("This is the main content")
|
ta.set_description ("This is the main content")
|
||||||
ta.set_is_required (False)
|
ta.set_is_required (False)
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ feature -- Forms ...
|
|||||||
if a_node /= Void then
|
if a_node /= Void then
|
||||||
sum.set_text_value (a_node.summary)
|
sum.set_text_value (a_node.summary)
|
||||||
end
|
end
|
||||||
-- sum.set_label ("Summary")
|
sum.set_label ("Summary")
|
||||||
sum.set_description ("This is the summary")
|
sum.set_description ("This is the summary")
|
||||||
sum.set_is_required (False)
|
sum.set_is_required (False)
|
||||||
|
|
||||||
@@ -104,7 +104,7 @@ feature -- Forms ...
|
|||||||
|
|
||||||
update_node (response: NODE_RESPONSE; fd: WSF_FORM_DATA; a_node: CMS_NODE)
|
update_node (response: NODE_RESPONSE; fd: WSF_FORM_DATA; a_node: CMS_NODE)
|
||||||
local
|
local
|
||||||
b: detachable READABLE_STRING_8
|
b,s: detachable READABLE_STRING_8
|
||||||
f: detachable CONTENT_FORMAT
|
f: detachable CONTENT_FORMAT
|
||||||
do
|
do
|
||||||
if attached fd.integer_item ("id") as l_id and then l_id > 0 then
|
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
|
if attached fd.string_item ("body") as l_body then
|
||||||
b := l_body
|
b := l_body
|
||||||
end
|
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
|
if attached fd.string_item ("format") as s_format and then attached response.api.format (s_format) as f_format then
|
||||||
f := f_format
|
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
|
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
|
else
|
||||||
f := response.formats.default_format
|
f := response.formats.default_format
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Update node with summary and body content
|
||||||
if b /= Void then
|
if b /= Void then
|
||||||
a_node.set_content (b, Void, f.name) -- FIXME: summary
|
a_node.set_content (b, s, f.name)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
new_node (response: NODE_RESPONSE; fd: WSF_FORM_DATA; a_node: detachable CMS_NODE): G
|
new_node (response: NODE_RESPONSE; fd: WSF_FORM_DATA; a_node: detachable CMS_NODE): G
|
||||||
-- <Precursor>
|
-- <Precursor>
|
||||||
local
|
local
|
||||||
b: detachable READABLE_STRING_8
|
b,s: detachable READABLE_STRING_8
|
||||||
f: detachable CONTENT_FORMAT
|
f: detachable CONTENT_FORMAT
|
||||||
l_node: detachable like new_node
|
l_node: detachable like new_node
|
||||||
do
|
do
|
||||||
@@ -166,9 +176,16 @@ feature -- Forms ...
|
|||||||
end
|
end
|
||||||
l_node.set_author (response.user)
|
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
|
if attached fd.string_item ("body") as l_body then
|
||||||
b := l_body
|
b := l_body
|
||||||
end
|
end
|
||||||
|
|
||||||
if attached fd.string_item ("format") as s_format and then attached response.api.format (s_format) as f_format then
|
if attached fd.string_item ("format") as s_format and then attached response.api.format (s_format) as f_format then
|
||||||
f := f_format
|
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
|
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
|
else
|
||||||
f := response.formats.default_format
|
f := response.formats.default_format
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Update node with summary and content
|
||||||
if b /= Void then
|
if b /= Void then
|
||||||
l_node.set_content (b, Void, f.name)
|
l_node.set_content (b, s, f.name)
|
||||||
end
|
end
|
||||||
Result := l_node
|
Result := l_node
|
||||||
end
|
end
|
||||||
@@ -216,6 +235,19 @@ feature -- Output
|
|||||||
s.append (")")
|
s.append (")")
|
||||||
end
|
end
|
||||||
s.append ("</div>")
|
s.append ("</div>")
|
||||||
|
|
||||||
|
if attached a_node.summary as l_summary then
|
||||||
|
s.append ("<p class=%"summary%">")
|
||||||
|
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 ("</p>")
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
if attached a_node.content as l_content then
|
if attached a_node.content as l_content then
|
||||||
s.append ("<p class=%"content%">")
|
s.append ("<p class=%"content%">")
|
||||||
if attached node_api.cms_api.format (a_node.format) as f then
|
if attached node_api.cms_api.format (a_node.format) as f then
|
||||||
|
|||||||
Reference in New Issue
Block a user