Added refactoring helper class to add comments.
This commit is contained in:
@@ -143,7 +143,7 @@ feature -- Blocks initialization
|
||||
|
||||
-- FIXME: let the user choose ...
|
||||
create l_table.make_caseless (10)
|
||||
l_table["page_top"] := "top"
|
||||
l_table["top"] := "top"
|
||||
l_table["header"] := "header"
|
||||
l_table["highlighted"] := "highlighted"
|
||||
l_table["help"] := "help"
|
||||
@@ -152,7 +152,7 @@ feature -- Blocks initialization
|
||||
l_table["management"] := "first_sidebar"
|
||||
l_table["navigation"] := "first_sidebar"
|
||||
l_table["user"] := "first_sidebar"
|
||||
l_table["page_bottom"] := "page_bottom"
|
||||
l_table["bottom"] := "page_bottom"
|
||||
block_region_settings := l_table
|
||||
end
|
||||
|
||||
@@ -275,13 +275,13 @@ feature -- Blocks
|
||||
local
|
||||
s: STRING
|
||||
do
|
||||
fixme ("Avoid Hardcoded HTML")
|
||||
fixme ("Avoid Hardcoded HTML!!!")
|
||||
-- create s.make_from_string ("<a href=%""+ url ("/", Void) +"%"><img id=%"logo%" src=%"" + logo_location + "%"/></a><div id=%"title%">" + html_encoded (site_name) + "</div>")
|
||||
create s.make_empty
|
||||
s.append ("<div id=%"menu-bar%">")
|
||||
s.append (theme.menu_html (main_menu, True))
|
||||
s.append ("</div>")
|
||||
create Result.make ("top_header", Void, s, formats.full_html)
|
||||
create Result.make ("header", Void, s, formats.full_html)
|
||||
Result.set_is_raw (True)
|
||||
end
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
note
|
||||
description: "Summary description for {CMS_HTML_PAGE}."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
author: ""
|
||||
date: "$Date: 2014-11-04 09:57:24 -0300 (ma. 04 de nov. de 2014) $"
|
||||
revision: "$Revision: 96034 $"
|
||||
|
||||
class
|
||||
CMS_HTML_PAGE
|
||||
@@ -23,6 +24,7 @@ feature {NONE} -- Initialization
|
||||
do
|
||||
create regions.make (5)
|
||||
language := "en"
|
||||
|
||||
status_code := {HTTP_STATUS_CODE}.ok
|
||||
create header.make
|
||||
create {ARRAYED_LIST [STRING]} head_lines.make (5)
|
||||
@@ -65,7 +67,7 @@ feature -- Header
|
||||
|
||||
feature -- Region
|
||||
|
||||
regions: HASH_TABLE [STRING_8, STRING_8]
|
||||
regions: STRING_TABLE [STRING_8]
|
||||
-- header
|
||||
-- content
|
||||
-- footer
|
||||
@@ -83,21 +85,6 @@ feature -- Region
|
||||
end
|
||||
end
|
||||
|
||||
header_region: STRING_8
|
||||
do
|
||||
Result := region ("header")
|
||||
end
|
||||
|
||||
content_region: STRING_8
|
||||
do
|
||||
Result := region ("content")
|
||||
end
|
||||
|
||||
footer_region: STRING_8
|
||||
do
|
||||
Result := region ("content")
|
||||
end
|
||||
|
||||
feature -- Element change
|
||||
|
||||
register_variable (a_value: detachable ANY; k: READABLE_STRING_GENERAL)
|
||||
@@ -118,41 +105,11 @@ feature -- Element change
|
||||
end
|
||||
end
|
||||
|
||||
add_to_header_region (s: STRING)
|
||||
do
|
||||
add_to_region (s, "header")
|
||||
end
|
||||
|
||||
add_to_content_region (s: STRING)
|
||||
do
|
||||
add_to_region (s, "content")
|
||||
end
|
||||
|
||||
add_to_footer_region (s: STRING)
|
||||
do
|
||||
add_to_region (s, "footer")
|
||||
end
|
||||
|
||||
set_region (s: STRING; k: STRING)
|
||||
do
|
||||
regions.force (s, k)
|
||||
end
|
||||
|
||||
set_header_region (s: STRING)
|
||||
do
|
||||
set_region (s, "header")
|
||||
end
|
||||
|
||||
set_content_region (s: STRING)
|
||||
do
|
||||
set_region (s, "content")
|
||||
end
|
||||
|
||||
set_footer_region (s: STRING)
|
||||
do
|
||||
set_region (s, "footer")
|
||||
end
|
||||
|
||||
feature -- Element change
|
||||
|
||||
set_status_code (c: like status_code)
|
||||
@@ -170,6 +127,50 @@ feature -- Element change
|
||||
title := s
|
||||
end
|
||||
|
||||
add_meta_name_content (a_name: STRING; a_content: STRING)
|
||||
local
|
||||
s: STRING_8
|
||||
do
|
||||
s := "<meta name=%"" + a_name + "%" content=%"" + a_content + "%" />"
|
||||
head_lines.extend (s)
|
||||
end
|
||||
|
||||
add_meta_http_equiv (a_http_equiv: STRING; a_content: STRING)
|
||||
local
|
||||
s: STRING_8
|
||||
do
|
||||
s := "<meta http-equiv=%"" + a_http_equiv + "%" content=%"" + a_content + "%" />"
|
||||
head_lines.extend (s)
|
||||
end
|
||||
|
||||
add_style (a_href: STRING; a_media: detachable STRING)
|
||||
local
|
||||
s: STRING_8
|
||||
do
|
||||
s := "<link rel=%"stylesheet%" href=%""+ a_href + "%" type=%"text/css%""
|
||||
if a_media /= Void then
|
||||
s.append (" media=%""+ a_media + "%"")
|
||||
end
|
||||
s.append ("/>")
|
||||
head_lines.extend (s)
|
||||
end
|
||||
|
||||
add_javascript_url (a_src: STRING)
|
||||
local
|
||||
s: STRING_8
|
||||
do
|
||||
s := "<script type=%"text/javascript%" src=%"" + a_src + "%"></script>"
|
||||
head_lines.extend (s)
|
||||
end
|
||||
|
||||
add_javascript_content (a_script: STRING)
|
||||
local
|
||||
s: STRING_8
|
||||
do
|
||||
s := "<script type=%"text/javascript%">%N" + a_script + "%N</script>"
|
||||
head_lines.extend (s)
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2014, Jocelyn Fiat, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
note
|
||||
description: "Summary description for {WSF_CMS_THEME}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
CMS_THEME
|
||||
|
||||
inherit
|
||||
|
||||
REFACTORING_HELPER
|
||||
|
||||
|
||||
feature {NONE} -- Access
|
||||
|
||||
setup: CMS_SETUP
|
||||
@@ -14,16 +18,20 @@ feature {NONE} -- Access
|
||||
feature -- Access
|
||||
|
||||
name: STRING
|
||||
-- theme name.
|
||||
deferred
|
||||
end
|
||||
|
||||
regions: ARRAY [STRING]
|
||||
-- theme's regions.
|
||||
deferred
|
||||
end
|
||||
|
||||
page_template: CMS_TEMPLATE
|
||||
-- theme template page.
|
||||
deferred
|
||||
end
|
||||
|
||||
feature -- Conversion
|
||||
|
||||
menu_html (a_menu: CMS_MENU; is_horizontal: BOOLEAN): STRING_8
|
||||
@@ -33,6 +41,7 @@ feature -- Conversion
|
||||
end
|
||||
|
||||
block_html (a_block: CMS_BLOCK): STRING_8
|
||||
-- Render a block as HTML.
|
||||
deferred
|
||||
end
|
||||
|
||||
@@ -47,6 +56,7 @@ feature {NONE} -- Implementation
|
||||
local
|
||||
cl: STRING
|
||||
do
|
||||
fixme ("Remove HTML from Eiffel")
|
||||
create cl.make_empty
|
||||
if lnk.is_active then
|
||||
cl.append ("active ")
|
||||
|
||||
@@ -18,7 +18,7 @@ feature {NONE} -- Initialization
|
||||
create items.make_caseless (1)
|
||||
create regions.make (5)
|
||||
across
|
||||
(<<"header", "content", "footer", "first_sidebar", "second_sidebar">>) as ic
|
||||
(<<"top","header", "highlighted","help", "content", "footer", "first_sidebar", "second_sidebar", "bottom">>) as ic
|
||||
loop
|
||||
regions.force (ic.item, ic.item)
|
||||
end
|
||||
|
||||
@@ -55,7 +55,7 @@ feature -- Access
|
||||
across
|
||||
theme.regions as r
|
||||
loop
|
||||
variables.force (page.region (r.item), r.item)
|
||||
variables.force (page.region (r.item), "region_" + r.item)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -10,8 +10,6 @@ class
|
||||
inherit
|
||||
CMS_THEME
|
||||
|
||||
REFACTORING_HELPER
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
@@ -82,15 +80,43 @@ feature -- Conversion
|
||||
-- Render Menu as HTML.
|
||||
-- A theme will define a menu.tpl
|
||||
do
|
||||
to_implement ("Add implementation")
|
||||
Result := "to be implemented"
|
||||
create Result.make_from_string ("<div id=%""+ a_menu.name +"%" class=%"menu%">")
|
||||
if is_horizontal then
|
||||
Result.append ("<ul class=%"horizontal%" >%N")
|
||||
else
|
||||
Result.append ("<ul class=%"vertical%" >%N")
|
||||
end
|
||||
across
|
||||
a_menu as c
|
||||
loop
|
||||
append_cms_link_to (c.item, Result)
|
||||
end
|
||||
Result.append ("</ul>%N")
|
||||
Result.append ("</div>")
|
||||
end
|
||||
|
||||
|
||||
block_html (a_block: CMS_BLOCK): STRING_8
|
||||
local
|
||||
s: STRING
|
||||
do
|
||||
to_implement ("Add implementation")
|
||||
Result := "to be implemented"
|
||||
if attached {CMS_CONTENT_BLOCK} a_block as l_content_block and then l_content_block.is_raw then
|
||||
create s.make_empty
|
||||
if attached l_content_block.title as l_title then
|
||||
s.append ("<div class=%"title%">" + html_encoded (l_title) + "</div>")
|
||||
end
|
||||
s.append (l_content_block.to_html (Current))
|
||||
else
|
||||
create s.make_from_string ("<div class=%"block%" id=%"" + a_block.name + "%">")
|
||||
if attached a_block.title as l_title then
|
||||
s.append ("<div class=%"title%">" + html_encoded (l_title) + "</div>")
|
||||
end
|
||||
s.append ("<div class=%"inside%">")
|
||||
s.append (a_block.to_html (Current))
|
||||
s.append ("</div>")
|
||||
s.append ("</div>")
|
||||
end
|
||||
Result := s
|
||||
end
|
||||
|
||||
prepare (page: CMS_HTML_PAGE)
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
</head>
|
||||
<body>
|
||||
<head>
|
||||
<title>{$title/}</title>
|
||||
<title>{$page_title/}</title>
|
||||
</head>
|
||||
<body>
|
||||
<!-- Page Top -->
|
||||
|
||||
@@ -98,7 +98,6 @@ feature -- Element change
|
||||
children := lst
|
||||
end
|
||||
|
||||
|
||||
set_expanded (b: like is_expanded)
|
||||
do
|
||||
if b then
|
||||
@@ -121,7 +120,6 @@ feature -- Element change
|
||||
internal_is_expandable := b
|
||||
end
|
||||
|
||||
|
||||
set_permission_arguments (args: like permission_arguments)
|
||||
do
|
||||
permission_arguments := args
|
||||
|
||||
Reference in New Issue
Block a user