-
Notifications
You must be signed in to change notification settings - Fork 0
/
example3.rb
105 lines (86 loc) · 1.48 KB
/
example3.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
my_system = Rhino::Application.new
my_system::config {
db = []
}
my_system::config.add do
set :name, 'My System'
end
my_system::auth do
enable :cookie, true
set :user, {
:ext_fields => ['int:age:scope(1..2)']
}
end
my_system::event do
end
my_system::data do
set :blogs, {
:model => 'blog',
:fields => 'title,content',
:condition => ''
}
set :all_blogs, {
:model => 'blog'
# default is all fields
}
end
my_system::modle do
set :blog, {
:table_name => 'blog',
:fields => [
# id etc. auto
'string:title:50:not_empty',
'text:content:not_empty',
# update and create timestamp auto
]
}
end
my_system::widget do
df :login do
# default find template string , file -> 'wg_#{widget_name}'
:template_file => 'wg_login'
# wg_login.rb
#
#
end
df :nav_blog do
end
df :form_blog do
end
df :list_blog do
:data => 'blogs'
:buildin_template => 'table',
:pager => true
end
end
my_system::widget.add do
df :about_me do
'' '
i am RhinoWeb.
' ''
end
end
my_system::page do
df :login, {
:layout => '1L',
:wg_1L => [:login]
}
df :blog, {
:auth => true,
#:rule = ''
:layout => '3W',
:wg_3W => [:nav_blog, list_blog, nil]
}
end
my_system::page.add do
:about_me = {
:layout = '2L',
:wg_2L = ['nav', 'about_me']
}
end
#...
my_system.run!
#or
my_system.update!
#or
my_sytem.generate!