Added debug output to CMS_BLOCK.
Updated SHARED_LOGGER to remove a few obsolete calls on json parser. Added favicon.ico specific handling. Fixed issue with theme and non raw block.
This commit is contained in:
@@ -83,7 +83,10 @@ feature {NONE} -- JSON
|
||||
create Result
|
||||
if attached json_file_from (a_path) as json_file then
|
||||
l_parser := new_json_parser (json_file)
|
||||
if attached {JSON_OBJECT} l_parser.parse as jv and then l_parser.is_parsed and then
|
||||
l_parser.parse_content
|
||||
if
|
||||
l_parser.is_valid and then
|
||||
attached l_parser.parsed_json_object as jv and then
|
||||
attached {JSON_OBJECT} jv.item ("logger") as l_logger and then
|
||||
attached {JSON_STRING} l_logger.item ("backup_count") as l_count and then
|
||||
attached {JSON_STRING} l_logger.item ("level") as l_level then
|
||||
|
||||
@@ -5,6 +5,9 @@ note
|
||||
deferred class
|
||||
CMS_BLOCK
|
||||
|
||||
inherit
|
||||
DEBUG_OUTPUT
|
||||
|
||||
feature -- Access
|
||||
|
||||
name: READABLE_STRING_8
|
||||
@@ -35,4 +38,28 @@ feature -- Conversion
|
||||
deferred
|
||||
end
|
||||
|
||||
feature -- Status report
|
||||
|
||||
debug_output: STRING_32
|
||||
-- String that should be displayed in debugger to represent `Current'.
|
||||
do
|
||||
create Result.make_from_string_general ("Block")
|
||||
if is_raw then
|
||||
Result.append_string_general (" <raw>")
|
||||
end
|
||||
if not is_enabled then
|
||||
Result.append_string_general (" <disabled>")
|
||||
end
|
||||
Result.append_character (' ')
|
||||
Result.append_character ('[')
|
||||
Result.append_string_general (name)
|
||||
Result.append_character (']')
|
||||
if attached title as l_title then
|
||||
Result.append_character (' ')
|
||||
Result.append_character ('%"')
|
||||
Result.append (l_title)
|
||||
Result.append_character ('%"')
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -119,6 +119,7 @@ feature -- Settings: router
|
||||
local
|
||||
l_root_handler: CMS_ROOT_HANDLER
|
||||
l_methods: WSF_REQUEST_METHODS
|
||||
h: WSF_URI_HANDLER
|
||||
do
|
||||
log.write_debug (generator + ".configure_api_root")
|
||||
create l_root_handler.make (api)
|
||||
@@ -126,6 +127,7 @@ feature -- Settings: router
|
||||
l_methods.enable_get
|
||||
a_router.handle_with_request_methods ("/", l_root_handler, l_methods)
|
||||
a_router.handle_with_request_methods ("", l_root_handler, l_methods)
|
||||
map_uri_agent_with_request_methods ("/favicon.ico", agent handle_favicon, a_router.methods_head_get)
|
||||
end
|
||||
|
||||
configure_api_file_handler (a_router: WSF_ROUTER)
|
||||
@@ -238,6 +240,23 @@ feature -- Access
|
||||
|
||||
feature -- Execution
|
||||
|
||||
handle_favicon (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
local
|
||||
ut: FILE_UTILITIES
|
||||
p: PATH
|
||||
r: NOT_FOUND_ERROR_CMS_RESPONSE
|
||||
f: WSF_FILE_RESPONSE
|
||||
do
|
||||
p := api.setup.theme_assets_location.extended ("favicon.ico")
|
||||
if ut.file_path_exists (p) then
|
||||
create f.make_with_path (p)
|
||||
res.send (f)
|
||||
else
|
||||
create r.make (req, res, api)
|
||||
r.execute
|
||||
end
|
||||
end
|
||||
|
||||
execute_default (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
-- Default request handler if no other are relevant
|
||||
local
|
||||
|
||||
@@ -62,7 +62,7 @@ feature -- Conversion
|
||||
debug ("refactor_fixme")
|
||||
fixme ("Refactor HTML code to use the new Bootstrap theme template")
|
||||
end
|
||||
if attached a_block.is_raw then
|
||||
if a_block.is_raw then
|
||||
create s.make_empty
|
||||
if attached a_block.title as l_title then
|
||||
s.append ("<div class=%"title%">" + html_encoded (l_title) + "</div>")
|
||||
|
||||
Reference in New Issue
Block a user