Add javascript function

This commit is contained in:
hassany
2014-03-19 21:37:07 +01:00
parent b87392906b
commit 7c5637c063

View File

@@ -142,6 +142,16 @@ feature -- Implementation
Result.append ("<script src=%"")
Result.append (base_path)
Result.append ("assets/widget.js%"></script>")
if attached additional_javascripts as ajs then
across
ajs as js
loop
Result.append ("<script src=%"")
Result.append (base_path)
Result.append (js.item)
Result.append ("%"></script>")
end
end
Result.append ("<script type=%"text/javascript%">$(function() {var page= new WSF_PAGE_CONTROL(")
Result.append (full_state.representation)
Result.append (");page.initialize();});</script>")
@@ -149,6 +159,16 @@ feature -- Implementation
else
Result.append ("<div data-name=%"" + control_name + "%" data-type=%"WSF_PAGE_CONTROL%">")
Result.append (control.render)
if attached additional_javascripts as ajs then
across
ajs as js
loop
Result.append ("<script src=%"")
Result.append (base_path)
Result.append (js.item)
Result.append ("%"></script>")
end
end
Result.append ("<script type=%"text/javascript%">$(function() {var page= new WSF_PAGE_CONTROL(")
Result.append (full_state.representation)
Result.append (");page.initialize();});</script>")
@@ -175,6 +195,19 @@ feature -- Implementation
end
end
add_javascript (path: STRING_32)
local
ajs: attached like additional_javascripts
do
if attached additional_javascripts as aajs then
ajs := aajs
else
create ajs.make (1)
end
ajs.extend (path)
additional_javascripts := ajs
end
feature -- Event handling
handle_callback (cname: LIST [STRING_32]; event: STRING_32; event_parameter: detachable ANY)
@@ -226,4 +259,7 @@ feature {NONE} -- Root control
control: WSF_CONTROL
-- The root control of this page
additional_javascripts: detachable ARRAYED_LIST [STRING_32]
-- List containing the additional javascipt files
end