Merge branch 'widget' of github.com:ynh/EWF into widget

This commit is contained in:
Severin Münger
2013-09-15 22:14:07 +02:00
6 changed files with 28 additions and 33 deletions

View File

@@ -35,9 +35,11 @@ feature {NONE} -- Initialization
map_agent_uri ("/", agent execute_hello, Void) map_agent_uri ("/", agent execute_hello, Void)
map_agent_uri ("/grid", agent grid_demo, Void) map_agent_uri ("/grid", agent grid_demo, Void)
map_agent_uri ("/repeater", agent repeater_demo, Void) map_agent_uri ("/repeater", agent repeater_demo, Void)
map_agent_uri ("/widget.js", agent load_js, Void) map_agent_uri ("/widget.js", agent load_file("widget.js", ?, ?), Void)
map_agent_uri ("/widget.css", agent load_css, Void) map_agent_uri ("/jquery.min.js", agent load_file("jquery.min.js", ?, ?), Void)
map_agent_uri ("/bootstrap.min.css", agent load_bootstrap, Void) map_agent_uri ("/typeahead.min.js", agent load_file("typeahead.min.js", ?, ?), Void)
map_agent_uri ("/widget.css", agent load_file("widget.css", ?, ?), Void)
map_agent_uri ("/bootstrap.min.css", agent load_file("bootstrap.min.css", ?, ?), Void)
end end
feature -- Helper: mapping feature -- Helper: mapping
@@ -79,27 +81,11 @@ feature -- Execution
page.execute page.execute
end end
load_js (req: WSF_REQUEST; res: WSF_RESPONSE) load_file (name: STRING; req: WSF_REQUEST; res: WSF_RESPONSE)
local local
f: WSF_FILE_RESPONSE f: WSF_FILE_RESPONSE
do do
create f.make_html ("widget.js") create f.make_html (name)
res.send (f)
end
load_css (req: WSF_REQUEST; res: WSF_RESPONSE)
local
f: WSF_FILE_RESPONSE
do
create f.make_html ("widget.css")
res.send (f)
end
load_bootstrap (req: WSF_REQUEST; res: WSF_RESPONSE)
local
f: WSF_FILE_RESPONSE
do
create f.make_html ("bootstrap.min.css")
res.send (f) res.send (f)
end end

File diff suppressed because one or more lines are too long

5
examples/widgetapp/jquery.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -27,7 +27,6 @@ feature
n4_container: WSF_FORM_ELEMENT_CONTROL [STRING] n4_container: WSF_FORM_ELEMENT_CONTROL [STRING]
n5_container: WSF_FORM_ELEMENT_CONTROL [STRING] n5_container: WSF_FORM_ELEMENT_CONTROL [STRING]
cats_container: WSF_FORM_ELEMENT_CONTROL [LIST [STRING]] cats_container: WSF_FORM_ELEMENT_CONTROL [LIST [STRING]]
s: FLAG_AUTOCOMPLETION
do do
Precursor Precursor
create form.make_form_control ("panel") create form.make_form_control ("panel")
@@ -44,8 +43,7 @@ feature
n2_container.add_validator (create {WSF_DECIMAL_VALIDATOR}.make_decimal_validator ("Invalid Number")) n2_container.add_validator (create {WSF_DECIMAL_VALIDATOR}.make_decimal_validator ("Invalid Number"))
form.add_control (n2_container) form.add_control (n2_container)
--Flag autocomplete --Flag autocomplete
create s.make (<<["dz", "Algeria"], ["be", "Belgium"], ["ca", "Canada"], ["de", "Deutschland"], ["england", "England"], ["fi", "Finland"], ["gr", "Greece"], ["hu", "Hungary"]>>) create autocompletion1.make_autocomplete ("autocompletion1", create {FLAG_AUTOCOMPLETION}.make)
create autocompletion1.make_autocomplete ("autocompletion1", s)
create n3_container.make_form_element ("Flag Autocomplete", autocompletion1) create n3_container.make_form_element ("Flag Autocomplete", autocompletion1)
form.add_control (n3_container) form.add_control (n3_container)
--Contact autocomplete --Contact autocomplete

7
examples/widgetapp/typeahead.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -61,7 +61,7 @@ feature
control.handle_callback (control_name, event, event_parameter) control.handle_callback (control_name, event, event_parameter)
create states_changes.make create states_changes.make
control.read_state_changes (states_changes) control.read_state_changes (states_changes)
response.put_header ({HTTP_STATUS_CODE}.ok, <<["Content-Type", "application/json"]>>) response.put_header ({HTTP_STATUS_CODE}.ok, <<["Content-Type", "application/json; charset=ISO-8859-1"]>>)
response.put_string (states_changes.representation) response.put_string (states_changes.representation)
else else
process process
@@ -86,12 +86,12 @@ feature
control.read_state (states) control.read_state (states)
data.append (states.representation) data.append (states.representation)
data.append (";</script>") data.append (";</script>")
data.append ("<script src=%"//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js%"></script>") data.append ("<script src=%"/jquery.min.js%"></script>")
data.append ("<script src=%"//cdnjs.cloudflare.com/ajax/libs/typeahead.js/0.9.3/typeahead.min.js%"></script>") data.append ("<script src=%"/typeahead.min.js%"></script>")
data.append ("<script src=%"/widget.js%"></script>") data.append ("<script src=%"/widget.js%"></script>")
data.append ("</body></html>") data.append ("</body></html>")
create page.make create page.make
page.put_header ({HTTP_STATUS_CODE}.ok, <<["Content-Type", "text/html"]>>) page.put_header ({HTTP_STATUS_CODE}.ok, <<["Content-Type", "text/html; charset=ISO-8859-1"]>>)
page.set_body (data) page.set_body (data)
response.send (page) response.send (page)
end end