Added summary and categories to recent change item.

This commit is contained in:
2016-11-30 15:40:12 +01:00
parent ff58c6aff9
commit 41fb8d5730
3 changed files with 54 additions and 2 deletions

View File

@@ -362,6 +362,16 @@ feature -- Hooks
end
ch.set_information (l_info)
ch.set_author (n.author)
ch.set_summary (n.summary)
if attached {CMS_TAXONOMY_API} l_node_api.cms_api.module_api ({CMS_TAXONOMY_MODULE}) as l_taxonomy_api then
if attached l_taxonomy_api.terms_of_content (n, Void) as l_terms then
across
l_terms as t_ic
loop
ch.add_category (t_ic.item.text)
end
end
end
a_changes.force (ch)
else
-- Forbidden

View File

@@ -39,6 +39,12 @@ feature -- Access
source: READABLE_STRING_8
-- Source of Current event.
categories: detachable LIST [READABLE_STRING_GENERAL]
-- Optional categories (tags, terms) related to associated content.
summary: detachable READABLE_STRING_32
-- Optional summary related to associated content.
information: detachable READABLE_STRING_8
-- Optional information related to Current event.
--| For instance: creation, trashed, modified, ...
@@ -60,12 +66,30 @@ feature -- Element change
end
end
set_summary (a_summary: like summary)
-- Set `summary' to `a_summary'.
do
summary := a_summary
end
set_information (a_info: like information)
-- Set `information' to `a_info'.
do
information := a_info
end
add_category (a_cat: READABLE_STRING_GENERAL)
local
cats: like categories
do
cats := categories
if cats = Void then
create {ARRAYED_LIST [READABLE_STRING_GENERAL]} cats.make (1)
categories := cats
end
cats.force (a_cat)
end
feature -- Comparison
is_less alias "<" (other: like Current): BOOLEAN

View File

@@ -107,6 +107,7 @@ feature -- Hook
l_feed_item: FEED_ITEM
lnk: FEED_LINK
nb: NATURAL_32
s: STRING_32
do
l_user := Void -- Public access for the feed!
create l_changes.make (a_size, create {DATE_TIME}.make_now_utc, a_source)
@@ -137,8 +138,25 @@ feature -- Hook
ch := ic.item
create l_feed_item.make (ch.link.title)
l_feed_item.set_date (ch.date)
l_feed_item.set_description (ch.information)
l_feed_item.set_category (ch.source)
create s.make_empty
if attached ch.information as l_information then
s.append (l_information)
end
if attached ch.summary as sum then
if not s.is_empty then
s.append ("%N%N")
end
s.append (sum)
end
l_feed_item.set_description (s)
if attached ch.categories as lst then
across
lst as cats_ic
loop
l_feed_item.set_category (cats_ic.item)
end
end
create lnk.make (a_response.absolute_url (ch.link.location, Void))
l_feed_item.links.force (lnk, "")
l_feed.extend (l_feed_item)