Fixed rendering, added navbar
This commit is contained in:
@@ -22,11 +22,13 @@ feature
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make_navbar (brand: STRING)
|
||||
make_navbar (b: STRING)
|
||||
local
|
||||
container: WSF_STATELESS_MULTI_CONTROL [WSF_STATELESS_CONTROL]
|
||||
header: WSF_STATELESS_MULTI_CONTROL [WSF_STATELESS_CONTROL]
|
||||
collapse_button: WSF_STATELESS_MULTI_CONTROL [WSF_STATELESS_CONTROL]
|
||||
brand: WSF_BASIC_CONTROL
|
||||
icon_bar: WSF_BASIC_CONTROL
|
||||
do
|
||||
make_multi_control
|
||||
add_class ("navbar navbar-inverse navbar-fixed-top")
|
||||
@@ -34,11 +36,23 @@ feature {NONE} -- Initialization
|
||||
create header.make_multi_control
|
||||
create collapse_button.make_with_tag_name ("button")
|
||||
create collapse.make_multi_control
|
||||
create nav.make_multi_control
|
||||
create nav.make_with_tag_name ("ul")
|
||||
create brand.make_control ("a")
|
||||
create icon_bar.make_control ("span")
|
||||
container.add_class ("container")
|
||||
header.add_class ("navbar-header")
|
||||
collapse_button.add_class ("navbar-toggle")
|
||||
collapse_button.set_attributes ("data-target=%".navbar-collapse%" data-toggle=%"collapse%" type=%"button%"")
|
||||
icon_bar.add_class ("icon-bar")
|
||||
collapse_button.add_control (icon_bar)
|
||||
collapse_button.add_control (icon_bar)
|
||||
collapse_button.add_control (icon_bar)
|
||||
--collapse_button.set_attributes ("data-target=%".navbar-collapse%" data-toggle=%"collapse%" type=%"button%"")
|
||||
brand.add_class ("navbar-brand")
|
||||
brand.set_attributes ("href=%"#%"")
|
||||
brand.set_content (b)
|
||||
header.add_control (collapse_button)
|
||||
header.add_control (brand)
|
||||
nav.add_class ("nav navbar-nav")
|
||||
collapse.add_class ("navbar-collapse")
|
||||
collapse.add_control (nav)
|
||||
container.add_control (header)
|
||||
|
||||
49
library/server/wsf_html/webcontrol/wsf_basic_control.e
Normal file
49
library/server/wsf_html/webcontrol/wsf_basic_control.e
Normal file
@@ -0,0 +1,49 @@
|
||||
note
|
||||
description: "Summary description for {WSF_BASIC_CONTROL}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_BASIC_CONTROL
|
||||
|
||||
inherit
|
||||
|
||||
WSF_STATELESS_CONTROL
|
||||
|
||||
create
|
||||
make_control
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
attributes: STRING
|
||||
|
||||
content: STRING
|
||||
|
||||
make_control (t: STRING)
|
||||
do
|
||||
make (t)
|
||||
attributes := ""
|
||||
content := ""
|
||||
end
|
||||
|
||||
feature -- Rendering
|
||||
|
||||
render: STRING
|
||||
do
|
||||
Result := render_tag (content, attributes)
|
||||
end
|
||||
|
||||
feature
|
||||
|
||||
set_attributes (a: STRING)
|
||||
do
|
||||
attributes := a
|
||||
end
|
||||
|
||||
set_content (c: STRING)
|
||||
do
|
||||
content := c
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,4 +1,4 @@
|
||||
note
|
||||
note
|
||||
description: "Summary description for {WSF_CONTROL}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
|
||||
@@ -5,7 +5,7 @@ note
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_MULTI_CONTROL [G -> WSF_CONTROL]
|
||||
WSF_MULTI_CONTROL [G -> WSF_STATELESS_CONTROL]
|
||||
|
||||
inherit
|
||||
|
||||
@@ -23,7 +23,7 @@ feature {NONE} -- Initialization
|
||||
|
||||
make_multi_control (n: STRING)
|
||||
do
|
||||
make_with_tag_name(n, "div")
|
||||
make_with_tag_name (n, "div")
|
||||
end
|
||||
|
||||
make_with_tag_name (n, t: STRING)
|
||||
@@ -41,7 +41,9 @@ feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- STATE MANAGEMENT
|
||||
across
|
||||
controls as c
|
||||
loop
|
||||
c.item.load_state (new_states)
|
||||
if attached {WSF_CONTROL} c.item as cont then
|
||||
cont.load_state (new_states)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -50,7 +52,9 @@ feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- STATE MANAGEMENT
|
||||
across
|
||||
controls as c
|
||||
loop
|
||||
c.item.set_state (new_state)
|
||||
if attached {WSF_CONTROL} c.item as cont then
|
||||
cont.set_state (new_state)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -61,7 +65,9 @@ feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- STATE MANAGEMENT
|
||||
across
|
||||
controls as c
|
||||
loop
|
||||
c.item.read_state (states)
|
||||
if attached {WSF_CONTROL} c.item as cont then
|
||||
cont.read_state (states)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -72,7 +78,9 @@ feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- STATE MANAGEMENT
|
||||
across
|
||||
controls as c
|
||||
loop
|
||||
c.item.read_state_changes (states)
|
||||
if attached {WSF_CONTROL} c.item as cont then
|
||||
cont.read_state_changes (states)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -92,7 +100,9 @@ feature --EVENT HANDLING
|
||||
across
|
||||
controls as c
|
||||
loop
|
||||
c.item.handle_callback (cname, event)
|
||||
if attached {WSF_CONTROL} c.item as cont then
|
||||
cont.handle_callback (cname, event)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -15,8 +15,6 @@ feature
|
||||
|
||||
--TODO: Maybe improve
|
||||
|
||||
attributes: detachable STRING
|
||||
|
||||
feature {NONE}
|
||||
|
||||
make (a_tag_name: STRING)
|
||||
@@ -29,11 +27,6 @@ feature {NONE}
|
||||
|
||||
feature
|
||||
|
||||
set_attributes (a: STRING)
|
||||
do
|
||||
attributes := a
|
||||
end
|
||||
|
||||
add_class (c: STRING)
|
||||
do
|
||||
css_classes.extend (c)
|
||||
@@ -61,7 +54,7 @@ feature
|
||||
l_attributes := l_attributes + " class=%"" + css_classes_string + "%""
|
||||
end
|
||||
Result := "<" + tag + " " + l_attributes
|
||||
if body.is_empty and not tag.is_equal ("textarea") then
|
||||
if body.is_empty and not tag.is_equal ("textarea") and not tag.is_equal ("span") and not tag.is_equal ("button") then
|
||||
Result := Result + " />"
|
||||
else
|
||||
Result := Result + " >" + body + "</" + tag + ">"
|
||||
|
||||
Reference in New Issue
Block a user