Fixed rendering, added navbar

This commit is contained in:
Severin Münger
2013-09-13 23:24:49 +02:00
parent 15676a7c9e
commit 09544ba6d2
8 changed files with 96 additions and 23 deletions

View File

@@ -30,7 +30,7 @@ feature
across
((page - 1) * page_size) |..| (page * page_size - 1) as c
loop
list.extend (create {DEMO_DATA}.make(c.item,"Name"+c.item.out,"desc "+c.item.out))
list.extend (create {DEMO_DATA}.make (c.item, "Name" + c.item.out, "desc " + c.item.out))
end
Result := list
end

View File

@@ -18,6 +18,8 @@ feature
initialize_controls
local
container: WSF_MULTI_CONTROL[WSF_STATELESS_CONTROL]
navbar: WSF_NAVBAR_CONTROL
form: WSF_FORM_CONTROL
n1_container: WSF_FORM_ELEMENT_CONTROL [STRING]
n2_container: WSF_FORM_ELEMENT_CONTROL [STRING]
@@ -26,6 +28,8 @@ feature
s: FLAG_AUTOCOMPLETION
do
create s.make(<<["dz", "Algeria"], ["be", "Belgium"] , ["ca", "Canada"],["de", "Deutschland"], ["england", "England"], ["fi", "Finland"], ["gr", "Greece"], ["hu", "Hungary"]>>)
create container.make_multi_control ("container")
create navbar.make_navbar ("Sample Page")
create textbox1.make_input ("txtBox1", "1")
create textbox2.make_input ("txtBox2", "2")
create autocompletion1.make_autocomplete ("autocompletion1", s)
@@ -53,7 +57,9 @@ feature
form.add_control (cats_container)
form.add_control (button1)
form.add_control (create {WSF_FORM_ELEMENT_CONTROL [STRING]}.make_form_element ("Result", textbox_result))
control := form
container.add_control (navbar)
container.add_control (form)
control := container
end
handle_click

View File

@@ -1,5 +1,6 @@
/* ignore this line */
.container { margin:30px; }
body {
padding-top: 30px;
}
.twitter-typeahead {
width: 100%;

View File

@@ -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)

View 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

View File

@@ -1,4 +1,4 @@
note
note
description: "Summary description for {WSF_CONTROL}."
author: ""
date: "$Date$"

View File

@@ -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

View File

@@ -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 + ">"