Small changes/fixes

This commit is contained in:
Severin Münger
2013-09-13 01:08:18 +02:00
parent 9c65194d91
commit f53974b138
8 changed files with 57 additions and 33 deletions

View File

@@ -13,14 +13,14 @@ feature --State
-- Return state which contains the current html and if there is an event handle attached -- Return state which contains the current html and if there is an event handle attached
do do
create Result.make create Result.make
Result.put (create {JSON_NUMBER}.make_integer(page), create {JSON_STRING}.make_json("page")) Result.put (create {JSON_NUMBER}.make_integer (page), create {JSON_STRING}.make_json ("page"))
Result.put (create {JSON_NUMBER}.make_integer(page_size), create {JSON_STRING}.make_json("page_size")) Result.put (create {JSON_NUMBER}.make_integer (page_size), create {JSON_STRING}.make_json ("page_size"))
if attached sort_column as a_sort_column then if attached sort_column as a_sort_column then
Result.put (create {JSON_STRING}.make_json(a_sort_column), create {JSON_STRING}.make_json("sort_column")) Result.put (create {JSON_STRING}.make_json (a_sort_column), create {JSON_STRING}.make_json ("sort_column"))
else else
Result.put (create {JSON_NULL}, create {JSON_STRING}.make_json("sort_column")) Result.put (create {JSON_NULL}, create {JSON_STRING}.make_json ("sort_column"))
end end
Result.put (create {JSON_BOOLEAN}.make_boolean(sort_direction), create {JSON_STRING}.make_json("sort_direction")) Result.put (create {JSON_BOOLEAN}.make_boolean (sort_direction), create {JSON_STRING}.make_json ("sort_direction"))
end end
set_state (new_state: JSON_OBJECT) set_state (new_state: JSON_OBJECT)
@@ -40,6 +40,7 @@ feature --State
sort_direction := new_sort_direction.item sort_direction := new_sort_direction.item
end end
end end
feature feature
set_page (a_page: like page) set_page (a_page: like page)
@@ -71,6 +72,7 @@ feature
sort_direction: BOOLEAN sort_direction: BOOLEAN
data: ITERABLE [G] data: ITERABLE [G]
deferred deferred
end end
end end

View File

@@ -6,16 +6,19 @@ note
class class
WSF_GRID_COLUMN WSF_GRID_COLUMN
create create
make_column make_column
feature {NONE} feature {NONE}
make_column(a_header,a_field:STRING) make_column (a_header, a_field: STRING)
do do
header:=a_header header := a_header
field_name:=a_field field_name := a_field
sorting_name:=a_field sorting_name := a_field
end end
feature feature
header: STRING header: STRING

View File

@@ -63,13 +63,13 @@ feature -- Implementation
render: STRING render: STRING
local local
attributes: STRING attrs: STRING
do do
attributes := "type=%"checkbox%"" attrs := "type=%"checkbox%""
if checked then if checked then
attributes := attributes + " checked" attrs := attrs + " checked"
end end
Result := render_tag_with_tagname ("div", render_tag_with_tagname ("label", render_tag ("", attributes) + " " + label, "", ""), "", "checkbox") Result := render_tag_with_tagname ("div", render_tag_with_tagname ("label", render_tag ("", attrs) + " " + label, "", ""), "", "checkbox")
end end
value: BOOLEAN value: BOOLEAN

View File

@@ -16,25 +16,36 @@ create
feature feature
collapse: WSF_STATELESS_MULTI_CONTROL [WSF_STATELESS_CONTROL] collapse: WSF_STATELESS_MULTI_CONTROL [WSF_STATELESS_CONTROL]
nav: WSF_STATELESS_MULTI_CONTROL [WSF_STATELESS_CONTROL]
nav: WSF_STATELESS_MULTI_CONTROL [WSF_STATELESS_CONTROL]
feature {NONE} -- Initialization feature {NONE} -- Initialization
make_navbar(brand:STRING) make_navbar (brand: STRING)
local local
container: WSF_STATELESS_MULTI_CONTROL [WSF_STATELESS_CONTROL] container: WSF_STATELESS_MULTI_CONTROL [WSF_STATELESS_CONTROL]
header: WSF_STATELESS_MULTI_CONTROL [WSF_STATELESS_CONTROL] header: WSF_STATELESS_MULTI_CONTROL [WSF_STATELESS_CONTROL]
collapse_button: WSF_STATELESS_MULTI_CONTROL [WSF_STATELESS_CONTROL]
do do
make_multi_control make_multi_control
add_class ("navbar navbar-inverse navbar-fixed-top") add_class ("navbar navbar-inverse navbar-fixed-top")
create container.make_multi_control
create header.make_multi_control create header.make_multi_control
create nav.make_multi_control create collapse_button.make_with_tag_name ("button")
create collapse.make_multi_control create collapse.make_multi_control
add_control (header) create nav.make_multi_control
container.add_class ("container")
header.add_class ("navbar-header") header.add_class ("navbar-header")
collapse_button.add_class ("navbar-toggle")
collapse_button.set_attributes ("data-target=%".navbar-collapse%" data-toggle=%"collapse%" type=%"button%"")
collapse.add_class ("navbar-collapse")
collapse.add_control (nav)
container.add_control (header)
container.add_control (collapse)
add_control (container)
-- EXAMPLE NAVBAR USED AS REFERENCE
-- <div class="navbar navbar-inverse navbar-fixed-top"> -- <div class="navbar navbar-inverse navbar-fixed-top">
-- <div class="container"> -- <div class="container">
-- <div class="navbar-header"> -- <div class="navbar-header">

View File

@@ -67,11 +67,11 @@ feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- STATE MANAGEMENT
feature -- Rendering feature -- Rendering
render_tag_with_tagname (tag, body, attributes, css_classes_string: STRING): STRING render_tag_with_tagname (tag, body, attrs, css_classes_string: STRING): STRING
local local
l_attributes: STRING l_attributes: STRING
do do
l_attributes := attributes l_attributes := attrs
if not css_classes_string.is_empty then if not css_classes_string.is_empty then
l_attributes := l_attributes + " class=%"" + css_classes_string + "%"" l_attributes := l_attributes + " class=%"" + css_classes_string + "%""
end end

View File

@@ -16,7 +16,7 @@ create
feature {NONE} feature {NONE}
make_html (n,t,v: STRING) make_html (n, t, v: STRING)
do do
make_control (n, t) make_control (n, t)
html := v html := v
@@ -49,7 +49,7 @@ feature -- Implementation
render: STRING render: STRING
do do
Result := render_tag (html,"") Result := render_tag (html, "")
end end
set_html (t: STRING) set_html (t: STRING)
@@ -69,6 +69,4 @@ feature
html: STRING html: STRING
end end

View File

@@ -13,6 +13,10 @@ feature
css_classes: LINKED_LIST [STRING] css_classes: LINKED_LIST [STRING]
--TODO: Maybe improve
attributes: detachable STRING
feature {NONE} feature {NONE}
make (a_tag_name: STRING) make (a_tag_name: STRING)
@@ -25,12 +29,17 @@ feature {NONE}
feature feature
set_attributes (a: STRING)
do
attributes := a
end
add_class (c: STRING) add_class (c: STRING)
do do
css_classes.extend (c) css_classes.extend (c)
end end
render_tag (body, attributes: STRING): STRING render_tag (body, attrs: STRING): STRING
local local
css_classes_string: STRING css_classes_string: STRING
do do
@@ -40,14 +49,14 @@ feature
loop loop
css_classes_string := css_classes_string + " " + c.item css_classes_string := css_classes_string + " " + c.item
end end
Result := render_tag_with_tagname (tag_name, body, attributes, css_classes_string) Result := render_tag_with_tagname (tag_name, body, attrs, css_classes_string)
end end
render_tag_with_tagname (tag, body, attributes, css_classes_string: STRING): STRING render_tag_with_tagname (tag, body, attrs, css_classes_string: STRING): STRING
local local
l_attributes: STRING l_attributes: STRING
do do
l_attributes := attributes l_attributes := attrs
if not css_classes_string.is_empty then if not css_classes_string.is_empty then
l_attributes := l_attributes + " class=%"" + css_classes_string + "%"" l_attributes := l_attributes + " class=%"" + css_classes_string + "%""
end end

View File

@@ -24,6 +24,7 @@
<cluster name="input" location=".\webcontrol\input\"/> <cluster name="input" location=".\webcontrol\input\"/>
<cluster name="grid" location=".\webcontrol\grid\"/> <cluster name="grid" location=".\webcontrol\grid\"/>
<cluster name="autocompletions" location=".\webcontrol\autocompletions\"/> <cluster name="autocompletions" location=".\webcontrol\autocompletions\"/>
<cluster name="navbar" location="\home\severin\Documents\EWF\EWF\library\server\wsf_html\webcontrol\navbar\"/>
</cluster> </cluster>
<cluster name="widget" location=".\widget\" recursive="true"/> <cluster name="widget" location=".\widget\" recursive="true"/>
</target> </target>