Always set the content type when it is known for node view.

This commit is contained in:
Jocelyn Fiat
2017-03-30 14:28:00 +02:00
parent 3072b99151
commit cd48fe182a
6 changed files with 21 additions and 8 deletions

View File

@@ -135,7 +135,7 @@ feature {NONE} -- Implementation: routes
r.add_warning_message ("Error with block [login]")
end
end
r.set_value ("Basic Auth", "optional_content_type")
r.set_optional_content_type ("Basic Auth")
end
r.execute
end

View File

@@ -83,9 +83,11 @@ feature -- Output
local
s: STRING
do
create s.make_empty
a_response.set_value (a_node, "node")
a_response.set_title (a_node.title)
a_response.set_value (a_node, "node")
a_response.set_value (a_node.content_type, "optional_content_type")
create s.make_empty
append_content_as_html_to (a_node, False, s, a_response)
a_response.set_main_content (s)
end

View File

@@ -48,6 +48,7 @@ feature -- Execution
end
end
if l_node /= Void then
set_optional_content_type (l_node.content_type)
if
attached node_api.node_type_for (l_node) as l_content_type and then
attached node_api.node_type_webform_manager (l_content_type) as l_manager

View File

@@ -265,7 +265,7 @@ feature -- Hooks
if r.is_authenticated then
r.add_error_message ("You are already signed in!")
else
r.set_value ("Login", "optional_content_type")
r.set_optional_content_type ("Login")
end
r.execute
end

View File

@@ -218,9 +218,7 @@ feature -- Hooks
if api.user_is_authenticated then
r.add_error_message ("You are already signed in!")
elseif req.is_get_request_method then
r.set_value ("Login", "optional_content_type")
r.set_optional_content_type ("Login")
elseif req.is_post_request_method then
create s.make_empty
if attached req.string_item ("openid") as p_openid then

View File

@@ -155,6 +155,13 @@ feature -- Access: CMS
values: CMS_VALUE_TABLE
-- Associated values indexed by string name.
feature -- Specific values
optional_content_type: detachable ANY
do
Result := values.item ("optional_content_type")
end
feature -- User access
is_authenticated: BOOLEAN
@@ -326,6 +333,11 @@ feature -- Element change
main_content := s
end
set_optional_content_type (a_content_type: detachable ANY)
do
set_value (a_content_type, "optional_content_type")
end
set_value (v: detachable ANY; k: READABLE_STRING_GENERAL)
-- Set value `v' associated with name `k'.
do
@@ -1434,7 +1446,7 @@ feature {NONE} -- Execution
end
end
if attached {READABLE_STRING_GENERAL} values.item ("optional_content_type") as l_type then
if attached {READABLE_STRING_GENERAL} optional_content_type as l_type then
create cms_page.make_typed (utf.utf_32_string_to_utf_8_string_8 (l_type))
else
create cms_page.make