From bbbdac12c8b293c26f2db72d80e81700bb42f798 Mon Sep 17 00:00:00 2001 From: Jocelyn Fiat Date: Wed, 16 Dec 2015 21:03:03 +0100 Subject: [PATCH] Moved taxonomy html generation to CMS_TAXONOMY_API. --- .../handler/cms_node_type_webform_manager.e | 25 ++------------- modules/taxonomy/cms_taxonomy_api.e | 31 +++++++++++++++++++ 2 files changed, 33 insertions(+), 23 deletions(-) diff --git a/modules/node/handler/cms_node_type_webform_manager.e b/modules/node/handler/cms_node_type_webform_manager.e index db5aac4..10e866d 100644 --- a/modules/node/handler/cms_node_type_webform_manager.e +++ b/modules/node/handler/cms_node_type_webform_manager.e @@ -334,30 +334,9 @@ feature -- Output if a_response /= Void and then - attached {CMS_TAXONOMY_API} cms_api.module_api ({CMS_TAXONOMY_MODULE}) as l_taxonomy_api and then - attached l_taxonomy_api.vocabularies_for_type (content_type.name) as vocs and then not vocs.is_empty + attached {CMS_TAXONOMY_API} cms_api.module_api ({CMS_TAXONOMY_MODULE}) as l_taxonomy_api then - vocs.sort - across - vocs as ic - loop - if - attached l_taxonomy_api.terms_of_content (a_node, ic.item) as l_terms and then - not l_terms.is_empty - then - a_output.append ("%N") - end - end + l_taxonomy_api.append_taxonomy_to_xhtml (a_node, a_response, a_output) end -- We don't show the summary on the detail page, since its just a short view of the full content. Otherwise we would write the same thing twice. diff --git a/modules/taxonomy/cms_taxonomy_api.e b/modules/taxonomy/cms_taxonomy_api.e index 5c9ffe6..7fec959 100644 --- a/modules/taxonomy/cms_taxonomy_api.e +++ b/modules/taxonomy/cms_taxonomy_api.e @@ -488,6 +488,37 @@ feature -- Web forms end end + append_taxonomy_to_xhtml (a_content: CMS_CONTENT; a_response: CMS_RESPONSE; a_output: STRING) + -- Append taxonomy related to `a_content' to xhtml string `a_output', + -- using `a_response' helper routines. + do + if + attached vocabularies_for_type (a_content.content_type) as vocs and then not vocs.is_empty + then + vocs.sort + across + vocs as ic + loop + if + attached terms_of_content (a_content, ic.item) as l_terms and then + not l_terms.is_empty + then + a_output.append ("%N") + end + end + end + end + feature -- Helpers splitted_string (s: READABLE_STRING_32; sep: CHARACTER): LIST [READABLE_STRING_32]