-
Notifications
You must be signed in to change notification settings - Fork 0
/
app_template.yaml
269 lines (261 loc) · 6.22 KB
/
app_template.yaml
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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
config:
application_name: Rhino
db:
dev:
adapter: sqlite3
database: default
dbname: default
production:
adapter: mysql
database:
dbname: blog
auth:
type: session
#plugin: auth_user
data_model: user
data_field: [name,password]
data:
# model
model:
Product:
type: entity
table: products
force: true
primary_key:
pid:
type: integer
generator: AUTO
fields:
name:
type: string
label: 产品名
limit: 120
default: "un known"
has_many:
bugs:
target_entity: Bug
belong_to:
owner:
target_entity: User
Bug:
type: entity
table: bugs
force: true
primary_key:
id:
type: integer
generator: AUTO
fields:
description:
type: text
label: 解释
status:
type: string
#values: [reported,fixing,fixed]
label: 状态
belong_to:
reporter:
target_entity: User
engineer:
target_entity: User
products:
target_entity: Product
User:
type: entity
table: users
force: true
primary_key:
id:
type: integer
generator: AUTO
fields:
name:
type: string
label: 姓名
email:
type: string
label: Email
password:
type: string #Add sha1 password
label: 密码
has_many:
reportedBugs:
target_entity: Bug
mapped_by: reporter
assignedBugs:
target_entity: Bug
mapped_by: engineer
collection:
bugList:
model: Bug
select: [products.name, created, status]
condition: status in ("reported","fixing")
bugShow:
model: Bug
select: [products.name, created, status, reporter.name, engineer.name]
condition: id = route_param.id
productList:
model: Product
select: [name, created, status]
productShow:
model: Product
select: [name, created, status, bugs.*]
condition: id = route_param.id
# Items
items:
navbar:
Home: {label: "Home", view: index}
Product: {label: "Product", view: product, visible: true}
User:
label: "Product"
view: user
condition: session['user']['name'] == 'admin'
product:
new: {label: "New Product", view: product_new, visible: true}
list: {label: "Product", view: product, visible: true}
bug:
new: {label: "New Bug", view: bug_new, visible: true}
list: {label: "Bug", view: bug, visible: true}
event:
error:
BugShow:
template: error
message: Load Bug Error
ProductShow:
template: error
message: Load Product Error
theme:
layout:
header:
widget:
id: bootstrap.navbar #template: navbar
header: config.application_name
nav_left: data.items.navbar
nav_right:
Login:
label: "Login"
view: index
visible: |
session['userid'] == nil
Setting:
label: "Setting"
view: setting
visible: |
session['userid'] != nil
Logout:
label: "Logout"
event: action.logout
visible: >
session['userid'] != nil
container:
row:
footer:
template: view/footer.erb
items: {copyright: config.application_name, home_url: config.application_url}
widget:
bugList:
id: bootstrap.listTable
data: data.collection.bugList
fields:
products.name: link_to(self.product.name, 'id=' + self.product.id)
created: self.created
status: self.status
bugShow:
id: bootstrap.showTable
data: data.collection.bugShow route_param.id
productList:
id: bootstrap.listTable
data: data.collection.productList
fields:
products.name: link_to(self.product.name, view.product_show(id => self.product.id))
created: self.created
status: self.status
_buttons:
- link_to("delete", event.product_delete(id => self.product.id))
- link_to("update", view.product_update(id => self.product.id))
productShow:
id: bootstrap.showTable
data: data.collection.productShow route_param.id
view:
index:
auth: disable
layout: bootstrap
html:
container:
row.col-md-12:
widget: bugList
product:
auth: enable
layout: bootstrap
javascript:
css:
html:
container:
row:
col-md-9:
widget: productList
col-md-3:
widget: bootstrap.nav-stacked
data: data.items.product
product_show:
route_param:
id: '%d'
auth: enable
layout: bootstrap
javascript:
css:
html:
container:
row:
col-md-9:
widget: productShow id
col-md-3:
widget: bootstrap.nav-stacked
data: data.items.product
error:
event: action.errorProductShow
user:
auth: enable
layout: bootstrap
javascript:
css:
html:
container:
row:
col-md-9:
widget: bootstrap.table
data: data.items.product
col-md-3:
widget: bootstrap.nav-stacked
data: data.items.product
bug:
auth: enable
layout: bootstrap
javascript:
css:
html:
container:
row:
col-md-9:
widget: bootstrap.table
data: data.items.bug
col-md-3:
widget: bootstrap.nav-stacked
data: data.items.bug
bug_show:
route_param:
id: '%d'
auth: enable
layout: bootstrap
javascript:
css:
html:
container:
row:
col-md-9:
widget: bugShow id
col-md-3:
widget: bootstrap.nav-stacked
data: data.items.bug
error:
event: action.errorBugShow