sws 0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/doc/DOC.otl +34 -0
- data/doc/Makefile +13 -0
- data/doc/architecture.dia +0 -0
- data/doc/docbook/architecture.png +0 -0
- data/doc/docbook/concepts.docbook +474 -0
- data/doc/docbook/installation.docbook +57 -0
- data/doc/docbook/introduction.docbook +130 -0
- data/doc/docbook/sws_manual.docbook +35 -0
- data/doc/docbook/todo.docbook +38 -0
- data/doc/docbook/tutorial.docbook +594 -0
- data/examples/README +1 -0
- data/examples/addressbook/CardBrowse/CardBrowse.html +43 -0
- data/examples/addressbook/CardBrowse/CardBrowse.rb +65 -0
- data/examples/addressbook/CardBrowse/CardBrowse.sws +92 -0
- data/examples/addressbook/Login/LoginPage.html +12 -0
- data/examples/addressbook/Login/LoginPage.rb +19 -0
- data/examples/addressbook/Login/LoginPage.sws +15 -0
- data/examples/addressbook/README +1 -0
- data/examples/addressbook/addressbook.rb +70 -0
- data/examples/addressbook/application.yaml +8 -0
- data/examples/addressbook/db.yaml +7 -0
- data/examples/component_demo/CheckBoxDemo/CheckBoxDemo.html +11 -0
- data/examples/component_demo/CheckBoxDemo/CheckBoxDemo.rb +21 -0
- data/examples/component_demo/CheckBoxDemo/CheckBoxDemo.sws +25 -0
- data/examples/component_demo/ComponentDemo.rb +21 -0
- data/examples/component_demo/ConditionalDemo/ConditionalDemo.html +18 -0
- data/examples/component_demo/ConditionalDemo/ConditionalDemo.rb +2 -0
- data/examples/component_demo/ConditionalDemo/ConditionalDemo.sws +22 -0
- data/examples/component_demo/FileUploadDemo/FileUploadDemo.html +10 -0
- data/examples/component_demo/FileUploadDemo/FileUploadDemo.rb +9 -0
- data/examples/component_demo/FileUploadDemo/FileUploadDemo.sws +33 -0
- data/examples/component_demo/FormFieldsDemo/FormFieldsDemo.html +12 -0
- data/examples/component_demo/FormFieldsDemo/FormFieldsDemo.rb +21 -0
- data/examples/component_demo/FormFieldsDemo/FormFieldsDemo.sws +40 -0
- data/examples/component_demo/FormListsDemo/FormListsDemo.html +11 -0
- data/examples/component_demo/FormListsDemo/FormListsDemo.rb +37 -0
- data/examples/component_demo/FormListsDemo/FormListsDemo.sws +47 -0
- data/examples/component_demo/GenericDemo/GenericDemo.html +4 -0
- data/examples/component_demo/GenericDemo/GenericDemo.rb +2 -0
- data/examples/component_demo/GenericDemo/GenericDemo.sws +10 -0
- data/examples/component_demo/HyperlinkDemo/HyperlinkDemo.html +8 -0
- data/examples/component_demo/HyperlinkDemo/HyperlinkDemo.rb +20 -0
- data/examples/component_demo/HyperlinkDemo/HyperlinkDemo.sws +19 -0
- data/examples/component_demo/ImageLinkDemo/ImageLinkDemo.html +11 -0
- data/examples/component_demo/ImageLinkDemo/ImageLinkDemo.rb +2 -0
- data/examples/component_demo/ImageLinkDemo/ImageLinkDemo.sws +14 -0
- data/examples/component_demo/PageWrapper/PageWrapper.html +23 -0
- data/examples/component_demo/PageWrapper/PageWrapper.rb +2 -0
- data/examples/component_demo/PageWrapper/PageWrapper.sws +42 -0
- data/examples/component_demo/README +1 -0
- data/examples/component_demo/RepetitionDemo/RepetitionDemo.html +13 -0
- data/examples/component_demo/RepetitionDemo/RepetitionDemo.rb +19 -0
- data/examples/component_demo/RepetitionDemo/RepetitionDemo.sws +20 -0
- data/examples/component_demo/StringDemo/StringDemo.html +5 -0
- data/examples/component_demo/StringDemo/StringDemo.rb +16 -0
- data/examples/component_demo/StringDemo/StringDemo.sws +14 -0
- data/examples/component_demo/application.yaml +28 -0
- data/examples/component_demo/poweredby.jpg +0 -0
- data/examples/component_demo/style.css +1 -0
- data/examples/movies/Menu/Menu.html +3 -0
- data/examples/movies/Menu/Menu.rb +7 -0
- data/examples/movies/Menu/Menu.sws +7 -0
- data/examples/movies/MovieBrowse/MovieBrowse.html +68 -0
- data/examples/movies/MovieBrowse/MovieBrowse.rb +178 -0
- data/examples/movies/MovieBrowse/MovieBrowse.sws +127 -0
- data/examples/movies/README +1 -0
- data/examples/movies/UserBrowse/UserBrowse.html +50 -0
- data/examples/movies/UserBrowse/UserBrowse.rb +69 -0
- data/examples/movies/UserBrowse/UserBrowse.sws +49 -0
- data/examples/movies/application.yaml +11 -0
- data/examples/movies/da.rb +36 -0
- data/examples/movies/dbmovies.rb +44 -0
- data/examples/movies/frameworks/TestFramework/framework.yaml +4 -0
- data/examples/movies/frameworks/TestFramework/resources/im1.jpg +0 -0
- data/examples/movies/images/pbr1b.jpg +0 -0
- data/examples/movies/movies.rb +28 -0
- data/examples/movies/movies.sds +119 -0
- data/examples/movies/movies.sqlite +0 -0
- data/examples/movies/movies_mysql.sql +28 -0
- data/examples/movies/movies_postgres.sql +27 -0
- data/examples/movies/movies_sqlite.sql +28 -0
- data/lib/sws.rb +89 -0
- data/lib/sws/Core/components/CheckBox/CheckBox.api +5 -0
- data/lib/sws/Core/components/CheckBox/CheckBox.rb +45 -0
- data/lib/sws/Core/components/CheckBoxList/CheckBoxList.api +13 -0
- data/lib/sws/Core/components/CheckBoxList/CheckBoxList.rb +54 -0
- data/lib/sws/Core/components/Conditional/Conditional.api +3 -0
- data/lib/sws/Core/components/Conditional/Conditional.html +1 -0
- data/lib/sws/Core/components/Conditional/Conditional.rb +39 -0
- data/lib/sws/Core/components/Conditional/Conditional.sws +2 -0
- data/lib/sws/Core/components/Content/Content.rb +18 -0
- data/lib/sws/Core/components/ExceptionPage/ExceptionPage.html +13 -0
- data/lib/sws/Core/components/ExceptionPage/ExceptionPage.rb +18 -0
- data/lib/sws/Core/components/ExceptionPage/ExceptionPage.sws +16 -0
- data/lib/sws/Core/components/FileUpload/FileUpload.api +16 -0
- data/lib/sws/Core/components/FileUpload/FileUpload.rb +62 -0
- data/lib/sws/Core/components/Form/Form.api +9 -0
- data/lib/sws/Core/components/Form/Form.html +3 -0
- data/lib/sws/Core/components/Form/Form.rb +55 -0
- data/lib/sws/Core/components/Form/Form.sws +12 -0
- data/lib/sws/Core/components/GenericContainer/GenericContainer.api +10 -0
- data/lib/sws/Core/components/GenericContainer/GenericContainer.html +1 -0
- data/lib/sws/Core/components/GenericContainer/GenericContainer.rb +39 -0
- data/lib/sws/Core/components/GenericContainer/GenericContainer.sws +12 -0
- data/lib/sws/Core/components/GenericElement/GenericElement.api +10 -0
- data/lib/sws/Core/components/GenericElement/GenericElement.rb +34 -0
- data/lib/sws/Core/components/HiddenField/HiddenField.api +7 -0
- data/lib/sws/Core/components/HiddenField/HiddenField.rb +37 -0
- data/lib/sws/Core/components/Hyperlink/Hyperlink.api +13 -0
- data/lib/sws/Core/components/Hyperlink/Hyperlink.html +1 -0
- data/lib/sws/Core/components/Hyperlink/Hyperlink.rb +102 -0
- data/lib/sws/Core/components/Hyperlink/Hyperlink.sws +12 -0
- data/lib/sws/Core/components/Image/Image.api +11 -0
- data/lib/sws/Core/components/Image/Image.rb +49 -0
- data/lib/sws/Core/components/ImageButton/ImageButton.api +16 -0
- data/lib/sws/Core/components/ImageButton/ImageButton.rb +76 -0
- data/lib/sws/Core/components/Link/Link.api +11 -0
- data/lib/sws/Core/components/Link/Link.rb +39 -0
- data/lib/sws/Core/components/PasswordField/PasswordField.api +7 -0
- data/lib/sws/Core/components/PasswordField/PasswordField.rb +41 -0
- data/lib/sws/Core/components/RadioButton/RadioButton.api +7 -0
- data/lib/sws/Core/components/RadioButton/RadioButton.rb +44 -0
- data/lib/sws/Core/components/RadioButtonList/RadioButtonList.api +20 -0
- data/lib/sws/Core/components/RadioButtonList/RadioButtonList.rb +76 -0
- data/lib/sws/Core/components/Repetition/Repetition.api +10 -0
- data/lib/sws/Core/components/Repetition/Repetition.html +1 -0
- data/lib/sws/Core/components/Repetition/Repetition.rb +137 -0
- data/lib/sws/Core/components/Repetition/Repetition.sws +2 -0
- data/lib/sws/Core/components/ResetButton/ResetButton.api +5 -0
- data/lib/sws/Core/components/ResetButton/ResetButton.rb +28 -0
- data/lib/sws/Core/components/Select/Select.api +24 -0
- data/lib/sws/Core/components/Select/Select.rb +57 -0
- data/lib/sws/Core/components/String/String.api +5 -0
- data/lib/sws/Core/components/String/String.rb +28 -0
- data/lib/sws/Core/components/SubmitButton/SubmitButton.api +6 -0
- data/lib/sws/Core/components/SubmitButton/SubmitButton.rb +53 -0
- data/lib/sws/Core/components/TextArea/TextArea.api +9 -0
- data/lib/sws/Core/components/TextArea/TextArea.rb +28 -0
- data/lib/sws/Core/components/TextField/TextField.api +9 -0
- data/lib/sws/Core/components/TextField/TextField.rb +46 -0
- data/lib/sws/Core/framework.yaml +25 -0
- data/lib/sws/JSComponents/components/JSMenu/JSMenu.api +5 -0
- data/lib/sws/JSComponents/components/JSMenu/JSMenu.html +58 -0
- data/lib/sws/JSComponents/components/JSMenu/JSMenu.rb +34 -0
- data/lib/sws/JSComponents/components/JSMenu/JSMenu.sws +37 -0
- data/lib/sws/JSComponents/framework.yaml +3 -0
- data/lib/sws/adaptor.rb +334 -0
- data/lib/sws/application.rb +604 -0
- data/lib/sws/component.rb +656 -0
- data/lib/sws/cookie.rb +27 -0
- data/lib/sws/direct_action.rb +38 -0
- data/lib/sws/extensions.rb +49 -0
- data/lib/sws/parsers.rb +374 -0
- data/lib/sws/request.rb +308 -0
- data/lib/sws/response.rb +70 -0
- data/lib/sws/session.rb +195 -0
- data/lib/sws/slot.rb +198 -0
- metadata +263 -0
data/examples/README
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
This directory contains example SWS applications. To start any of them, enter the directory, run the executable Ruby file and point your browser to http://localhost:1234/
|
@@ -0,0 +1,43 @@
|
|
1
|
+
<html>
|
2
|
+
<head><title>Address card browsing</title></head>
|
3
|
+
<body>
|
4
|
+
<center><h2>User <span sws="username"></span></h2></center>
|
5
|
+
<form sws="browse_form">
|
6
|
+
<table border=1>
|
7
|
+
<tr><th>First name</th><th>Last name</th><th>Actions</th></tr>
|
8
|
+
<span sws="entries_repetition">
|
9
|
+
<tr>
|
10
|
+
<td><a sws="show_details_link"><span sws="cursor_first_name_string"></span></a></td>
|
11
|
+
<td><span sws="cursor_last_name_string"></span></td>
|
12
|
+
<td><input type="submit" sws="edit_card_button"><input type="submit" sws="delete_card_button"></td>
|
13
|
+
</tr>
|
14
|
+
</span>
|
15
|
+
<tr><td colspan=3><input type="submit" sws="add_card_button"></td></tr>
|
16
|
+
<tr><td colspan=3><input type="submit" sws="save_changes_button"></td></tr>
|
17
|
+
</table>
|
18
|
+
</form>
|
19
|
+
|
20
|
+
<div sws="show_edit_conditional">
|
21
|
+
<form sws="edit_form">
|
22
|
+
<table border=1>
|
23
|
+
<tr><th>First name</th><td><input type="text" sws="edit_first_name_textfield"></td></tr>
|
24
|
+
<tr><th>Last name</th><td><input type="text" sws="edit_last_name_textfield"></td></tr>
|
25
|
+
<tr><th>Address</th><td><input type="text" sws="edit_address_textfield"></td></tr>
|
26
|
+
<tr><th>Phone</th><td><input type="text" sws="edit_phone_textfield"></td></tr>
|
27
|
+
<tr><td colspan=2><input type="submit" sws="commit_button"></td></tr>
|
28
|
+
</table>
|
29
|
+
</form>
|
30
|
+
</div>
|
31
|
+
|
32
|
+
<div sws="show_details_conditional">
|
33
|
+
<table border=1>
|
34
|
+
<tr><th>First name</th><td><span sws="details_first_name_string"></span></td></tr>
|
35
|
+
<tr><th>Last name</th><td><span sws="details_last_name_string"></span></td></tr>
|
36
|
+
<tr><th>Address</th><td><span sws="details_address_string"></span></td></tr>
|
37
|
+
<tr><th>Phone</th><td><span sws="details_phone_string"></span></td></tr>
|
38
|
+
</table>
|
39
|
+
|
40
|
+
</div>
|
41
|
+
|
42
|
+
</body>
|
43
|
+
</html>
|
@@ -0,0 +1,65 @@
|
|
1
|
+
class CardBrowse < SWS::Component
|
2
|
+
|
3
|
+
attr_accessor :card_cursor
|
4
|
+
attr_reader :selected_card, :edited_card
|
5
|
+
|
6
|
+
def delete_card ()
|
7
|
+
|
8
|
+
session.entries.delete( @card_cursor )
|
9
|
+
@selected_card = nil
|
10
|
+
@edited_card = nil
|
11
|
+
|
12
|
+
return self
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
def add_card ()
|
18
|
+
|
19
|
+
@edited_card = AddressCard.new
|
20
|
+
session.entries << @edited_card
|
21
|
+
@selected_card = nil
|
22
|
+
|
23
|
+
return self
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
def edit_card ()
|
29
|
+
|
30
|
+
@edited_card = @card_cursor
|
31
|
+
@selected_card = nil
|
32
|
+
|
33
|
+
return self
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
|
38
|
+
def show_details ()
|
39
|
+
|
40
|
+
@selected_card = @card_cursor
|
41
|
+
@edited_card = nil
|
42
|
+
|
43
|
+
return self
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
|
48
|
+
def commit_card ()
|
49
|
+
|
50
|
+
@selected_card = nil
|
51
|
+
@edited_card = nil
|
52
|
+
|
53
|
+
return self
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
|
58
|
+
def save_changes ()
|
59
|
+
|
60
|
+
app.save_db()
|
61
|
+
return self
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
username:
|
2
|
+
_class: SWS::String
|
3
|
+
value: session.username
|
4
|
+
|
5
|
+
browse_form:
|
6
|
+
_class: SWS::Form
|
7
|
+
|
8
|
+
entries_repetition:
|
9
|
+
_class: SWS::Repetition
|
10
|
+
list: session.entries
|
11
|
+
item: card_cursor
|
12
|
+
|
13
|
+
show_details_link:
|
14
|
+
_class: SWS::Hyperlink
|
15
|
+
action: show_details
|
16
|
+
|
17
|
+
cursor_first_name_string:
|
18
|
+
_class: SWS::String
|
19
|
+
value: card_cursor.first_name
|
20
|
+
|
21
|
+
cursor_last_name_string:
|
22
|
+
_class: SWS::String
|
23
|
+
value: card_cursor.last_name
|
24
|
+
|
25
|
+
edit_card_button:
|
26
|
+
_class: SWS::SubmitButton
|
27
|
+
value: "'Edit'"
|
28
|
+
action: edit_card
|
29
|
+
|
30
|
+
delete_card_button:
|
31
|
+
_class: SWS::SubmitButton
|
32
|
+
value: "'Delete'"
|
33
|
+
action: delete_card
|
34
|
+
|
35
|
+
add_card_button:
|
36
|
+
_class: SWS::SubmitButton
|
37
|
+
value: "'Add card'"
|
38
|
+
action: add_card
|
39
|
+
|
40
|
+
save_changes_button:
|
41
|
+
_class: SWS::SubmitButton
|
42
|
+
value: "'Save changes'"
|
43
|
+
action: save_changes
|
44
|
+
|
45
|
+
show_edit_conditional:
|
46
|
+
_class: SWS::Conditional
|
47
|
+
condition: edited_card
|
48
|
+
|
49
|
+
edit_form:
|
50
|
+
_class: SWS::Form
|
51
|
+
|
52
|
+
edit_first_name_textfield:
|
53
|
+
_class: SWS::TextField
|
54
|
+
value: edited_card.first_name
|
55
|
+
|
56
|
+
edit_last_name_textfield:
|
57
|
+
_class: SWS::TextField
|
58
|
+
value: edited_card.last_name
|
59
|
+
|
60
|
+
edit_address_textfield:
|
61
|
+
_class: SWS::TextField
|
62
|
+
value: edited_card.address
|
63
|
+
|
64
|
+
edit_phone_textfield:
|
65
|
+
_class: SWS::TextField
|
66
|
+
value: edited_card.phone
|
67
|
+
|
68
|
+
commit_button:
|
69
|
+
_class: SWS::SubmitButton
|
70
|
+
value: "'Commit'"
|
71
|
+
action: commit_card
|
72
|
+
|
73
|
+
show_details_conditional:
|
74
|
+
_class: SWS::Conditional
|
75
|
+
condition: selected_card
|
76
|
+
|
77
|
+
details_first_name_string:
|
78
|
+
_class: SWS::String
|
79
|
+
value: selected_card.first_name
|
80
|
+
|
81
|
+
details_last_name_string:
|
82
|
+
_class: SWS::String
|
83
|
+
value: selected_card.last_name
|
84
|
+
|
85
|
+
details_address_string:
|
86
|
+
_class: SWS::String
|
87
|
+
value: selected_card.address
|
88
|
+
|
89
|
+
details_phone_string:
|
90
|
+
_class: SWS::String
|
91
|
+
value: selected_card.phone
|
92
|
+
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<html>
|
2
|
+
<head><title>Login page</title></head>
|
3
|
+
<body>
|
4
|
+
<center><h2><span sws="login_message"></span></h2></center>
|
5
|
+
<form sws="login_form">
|
6
|
+
<table align="center">
|
7
|
+
<tr><td><input type="text" sws="login_textfield"></td></tr>
|
8
|
+
<tr><td><input type="submit" sws="login_submit"></td></tr>
|
9
|
+
</table>
|
10
|
+
</form>
|
11
|
+
</body>
|
12
|
+
</html>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class LoginPage < SWS::Component
|
2
|
+
|
3
|
+
attr_accessor :login_name
|
4
|
+
attr_reader :login_message
|
5
|
+
|
6
|
+
def perform_login ()
|
7
|
+
|
8
|
+
unless ( @login_name )
|
9
|
+
@login_message = "Please enter a username"
|
10
|
+
return self
|
11
|
+
else
|
12
|
+
session.username = @login_name
|
13
|
+
return SWS::Component.create( "CardBrowse", @request )
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
|
@@ -0,0 +1,15 @@
|
|
1
|
+
login_form:
|
2
|
+
_class: SWS::Form
|
3
|
+
|
4
|
+
login_textfield:
|
5
|
+
_class: SWS::TextField
|
6
|
+
value: login_name
|
7
|
+
|
8
|
+
login_submit:
|
9
|
+
_class: SWS::SubmitButton
|
10
|
+
action: perform_login
|
11
|
+
value: "'Log in'"
|
12
|
+
|
13
|
+
login_message:
|
14
|
+
_class: SWS::String
|
15
|
+
value: login_message
|
@@ -0,0 +1 @@
|
|
1
|
+
This example contains application used in tutorial. It is an extremely simple addressbook.
|
@@ -0,0 +1,70 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
#begin
|
4
|
+
# require 'rubygems'
|
5
|
+
# require_gem( 'sws', ">= 0.2.1" )
|
6
|
+
#rescue LoadError
|
7
|
+
$LOAD_PATH.unshift( "../../lib" )
|
8
|
+
require 'sws'
|
9
|
+
#end
|
10
|
+
|
11
|
+
AddressCard = Struct.new( :first_name, :last_name, :phone, :address )
|
12
|
+
|
13
|
+
class Application < SWS::Application
|
14
|
+
|
15
|
+
attr_reader :db
|
16
|
+
|
17
|
+
def initialize ( *args )
|
18
|
+
|
19
|
+
super( *args )
|
20
|
+
if ( File.exist?( "db.yaml" ) )
|
21
|
+
@db = YAML.load( File.open( "db.yaml" ) )
|
22
|
+
else
|
23
|
+
@db = Hash.new
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
|
29
|
+
def save_db ()
|
30
|
+
File.open( "db.yaml","w" ) { |file| file.write( @db.to_yaml ) }
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
class Session < SWS::Session
|
37
|
+
|
38
|
+
attr_reader :username
|
39
|
+
|
40
|
+
def entries ()
|
41
|
+
|
42
|
+
if ( @entries )
|
43
|
+
return @entries
|
44
|
+
else
|
45
|
+
|
46
|
+
@entries = Application.instance.db[@username]
|
47
|
+
unless ( @entries )
|
48
|
+
@entries = Array.new
|
49
|
+
Application.instance.db[@username] = @entries
|
50
|
+
end
|
51
|
+
return @entries
|
52
|
+
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
|
58
|
+
def username= ( username )
|
59
|
+
|
60
|
+
@entries = nil
|
61
|
+
@username = username
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
|
66
|
+
end
|
67
|
+
|
68
|
+
|
69
|
+
# Main program
|
70
|
+
Application.new.run()
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<span sws="page_wrapper">
|
2
|
+
<form sws="form">
|
3
|
+
<!-- Note the "type" attributes are completely optional - we added them for the sake of clarity -->
|
4
|
+
<input type="checkbox" sws="first_checkbox">First checkbox<br>
|
5
|
+
<input type="checkbox" sws="second_checkbox">Second checkbox<br>
|
6
|
+
<input type="submit" sws="submit_button"><br>
|
7
|
+
First checkbox checked: <span sws="first_checked_string"></span><br>
|
8
|
+
Second checkbox checked: <span sws="second_checked_string"></span><br>
|
9
|
+
|
10
|
+
</form>
|
11
|
+
</span>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class CheckBoxDemo < SWS::Component
|
2
|
+
|
3
|
+
attr_accessor :first_checked, :second_checked
|
4
|
+
|
5
|
+
def initialize ( *args )
|
6
|
+
|
7
|
+
super( *args )
|
8
|
+
@first_checked = false
|
9
|
+
@second_checked = true
|
10
|
+
|
11
|
+
end
|
12
|
+
|
13
|
+
|
14
|
+
def form_submitted
|
15
|
+
# This method intentionally does nothing - we just want to have
|
16
|
+
# @first_checked and @second_checked updated
|
17
|
+
|
18
|
+
return self
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
page_wrapper:
|
2
|
+
_class: PageWrapper
|
3
|
+
|
4
|
+
form:
|
5
|
+
_class: SWS::Form
|
6
|
+
|
7
|
+
first_checkbox:
|
8
|
+
_class: SWS::CheckBox
|
9
|
+
checked: first_checked
|
10
|
+
|
11
|
+
second_checkbox:
|
12
|
+
_class: SWS::CheckBox
|
13
|
+
checked: second_checked
|
14
|
+
|
15
|
+
submit_button:
|
16
|
+
_class: SWS::SubmitButton
|
17
|
+
action: form_submitted
|
18
|
+
|
19
|
+
first_checked_string:
|
20
|
+
_class: SWS::String
|
21
|
+
value: first_checked
|
22
|
+
|
23
|
+
second_checked_string:
|
24
|
+
_class: SWS::String
|
25
|
+
value: second_checked
|
@@ -0,0 +1,21 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
#begin
|
4
|
+
# require "rubygems"
|
5
|
+
# require_gem( "sws", ">= 0.2.1" )
|
6
|
+
#rescue LoadError
|
7
|
+
$LOAD_PATH.unshift( "../../lib" )
|
8
|
+
require "sws"
|
9
|
+
#end
|
10
|
+
|
11
|
+
class Application < SWS::Application
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
class Session < SWS::Session
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
application = Application.new
|
21
|
+
application.run()
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<span sws="page_wrapper">
|
2
|
+
<!-- This will appear on the page -->
|
3
|
+
<span sws="condition_true_negate_false">
|
4
|
+
This is content of conditional with bindings: condition - true, negate - false<br>
|
5
|
+
</span>
|
6
|
+
<!-- This will NOT appear on the page -->
|
7
|
+
<span sws="condition_true_negate_true">
|
8
|
+
This is content of conditional with bindings: condition - true, negate - true<br>
|
9
|
+
</span>
|
10
|
+
<!-- This will appear on the page -->
|
11
|
+
<span sws="condition_false_negate_true">
|
12
|
+
This is content of conditional with bindings: condition - false, negate - true<br>
|
13
|
+
</span>
|
14
|
+
<!-- This will NOT appear on the page -->
|
15
|
+
<span sws="condition_false_negate_false">
|
16
|
+
This is content of conditional with bindings: condition - false, negate - false<br>
|
17
|
+
</span>
|
18
|
+
</span>
|