-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.rb
207 lines (179 loc) · 4.22 KB
/
example.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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
rhino::application do
define :main , {
:name => "Simple Blog System",
}
enable :admin
enable :authUser
model :blog , {
attrs {
title string
content text
createDate date
owner moudle/member #userid
category category #use module category
tag moudle/rtags #auto create tags->blogs *->* field,rule,etc.
}
event {
beforeSave do
time()
end
}
}
auth :
register true
owner true
profile true
model Rhino::member
extfield {
googlemail mail, true #must
}
end
rhino::application do
{
:main => {
:name => "Simple Blog System",
:title => "My Blog",
:layer => "3L",
:theme => "bootstrap"
},
:db => {
:development => DataMapper.setup(:default, "sqlite3://" + Padrino.root('db', "t1_development.db")),
:production => DataMapper.setup(:default, "sqlite3://" + Padrino.root('db', "t1_production.db")),
:test => DataMapper.setup(:default, "sqlite3://" + Padrino.root('db', "t1_test.db"))
},
:admin => {
:allow_ip => "127.0.0.1",
:web_url => "/webAdmin",
:admin_models => 'member, blog',
:auth => load_user_name_password, # load_user_name_password(&username,&password,&salt)
# or
#:auth => {
# :name => 'admin',
# :password => 'admin'
# :salt => ''
#}
},
:auth => {
:root => {
:name => 'admin',
:password => 'admin'
},
},
:model => {
}
}
end
#system admin manage
rhion::admin do
end
def auth
#system root Manager init and not include db.
set :root, {
:name => "admin",
:passwd => "admin"
}
#member own allow system init
#ex model
authUser {
register true
owner true
profile true
model Rhino::member
extfield {
googlemail mail, true #must
}
}
setting {
}
end
rule {
}
def module
end
def event
end
def plugin
{
:modle => [
:category => 'moudle/rcategory' #category id category->category_id 1->1 field,rule,etc.
]
}
end
def page
url 'index' do
end
url 'admin' do
end
blog {
action ['list', 'list_category', 'update', 'delete', 'view']
}
album {
action ['list', 'list_category', 'update', 'delete', 'view']
}
tag {
action moudle/rtags # auto find relation model list view & cduv
}
category {
action moudle/category
}
end
modle {
member do
{
model Rhion/member # add all Rhion redefined member fields
friend moudle/friend # add friend ids
}
category do
{
model plugin/category
}
blog do
attrs {
title string
content text
createDate date
owner moudle/member #userid
category category #use module category
tag moudle/rtags #auto create tags->blogs *->* field,rule,etc.
}
event {
beforeSave do
time()
end
}
setting {
:listNum => [
:label => '', :selectFields => '10,20,30,#'
]
:showOwn => [
:label => 'Show Type',
[
[:label => 'show by all', :allow => {true}, :action => '/blog.list~/'],
[:label => 'show by own', :deny => {session.userid != own.userid}, :action => 'blog.*'],
[:label => 'show by firends', :allow => {session.userid in own.firends }, :action => 'blog.list, blog.view']
]
]
}
}
end
album do
attrs {
title string
createDate date
owner moudle/user #userid
category plugin/category #use module category
pictureUrl moudle/uploadfile #uploadfile
}
event {
beforeSave do
time()
end
afterSave {}
beforeInsert {}
beforeDelete {}
}
setting {
:albumWidth => [:label => 'album Width', :default => 200]
}
end
}