-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.html
335 lines (320 loc) · 10.4 KB
/
demo.html
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
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<title>BackboneUI</title>
<style>
body {
font-size: 16px;
line-height: 24px;
background: #FEF3CA;
color: #022;
height: 100%;
font-family: "Palatino Linotype", "Book Antiqua", Palatino, FreeSerif, serif;
}
div.container {
width: 720px;
margin: 50px 0 50px 50px;
}
p, li {
margin: 16px 0 16px 0;
width: 550px;
}
p.break {
margin-top: 35px;
}
ol {
padding-left: 24px;
}
ol li {
font-weight: bold;
margin-left: 0;
}
a, a:visited {
padding: 0 2px;
text-decoration: none;
background: #f0c095;
color: #252519;
}
a:active, a:hover {
color: #FFF;
background: #C25D00;
}
h1, h2, h3, h4, h5, h6 {
margin-top: 40px;
}
b.header {
font-size: 18px;
}
span.alias {
font-size: 14px;
font-style: italic;
margin-left: 20px;
}
table {
margin: 16px 0;
padding: 0;
}
tr, td, th {
margin: 0;
padding: 0;
text-align: left;
}
th {
padding: 24px 0 0;
}
tr:first-child th {
padding-top: 0;
}
td {
padding: 6px 15px 6px 0;
}
td.definition {
line-height: 18px;
font-size: 14px;
}
table.downloads td {
padding-left: 18px;
}
.demo-hint {
font-size: 13px;
margin: 0 0 12px 12px;
font-weight: normal;
}
#VS code, #VS pre, #VS tt {
font-family: Monaco, Consolas, "Lucida Console", monospace;
font-size: 12px;
line-height: 18px;
color: #444;
background: none;
}
#VS code {
margin-left: 8px;
padding: 0 0 0 12px;
font-weight: normal;
}
#VS pre {
font-size: 12px;
padding: 2px 0 2px 0;
border-left: 6px solid #829C37;
margin: 12px 0;
}
#search_query {
margin: 18px 0;
opacity: 0;
}
#search_query .raquo {
font-size: 18px;
line-height: 12px;
font-weight: bold;
margin-right: 4px;
}
#search_query2 {
margin: 18px 0;
opacity: 0;
}
#search_query2 .raquo {
font-size: 18px;
line-height: 12px;
font-weight: bold;
margin-right: 4px;
}
.main {
background: yellow;
}
</style>
<link rel="stylesheet" href="lib/css/ui.css" type="text/css" media="screen" charset="utf-8">
<link rel="stylesheet" href="lib/css/slick.grid.css" type="text/css" media="screen" charset="utf-8">
<link rel="stylesheet" href="lib/css/jquery.qtip.min.css" type="text/css" media="screen" charset="utf-8">
<script src="vendor/jquery-1.7.js" type="text/javascript" charset="utf-8"></script>
<!-- <script src="vendor/backported/jquery-1.4.4.js" type="text/javascript" charset="utf-8"></script> -->
<script src="vendor/jquery.ui.core.js" type="text/javascript" charset="utf-8"></script>
<script src="vendor/jquery.ui.widget.js" type="text/javascript" charset="utf-8"></script>
<script src="vendor/jquery.ui.position.js" type="text/javascript" charset="utf-8"></script>
<script src="vendor/jquery.ui.autocomplete.js" type="text/javascript" charset="utf-8"></script>
<script src="vendor/jquery-ui-1.8.16.custom.min.js" type="text/javascript" charset="UTF-8"></script>
<script src="vendor/underscore.js" type="text/javascript" charset="utf-8"></script>
<script src="vendor/backbone.js" type="text/javascript" charset="utf-8"></script>
<script src="vendor/date.js" type="text/javascript" charset="utf-8"></script>
<script src="vendor/slickgrid/jquery.event.drag-2.0.min.js" type="text/javascript" charset="utf-8"></script>
<script src="vendor/slickgrid/slick.grid.js" type="text/javascript" charset="utf-8"></script>
<script src="vendor/slickgrid/slick.model.js" type="text/javascript" charset="utf-8"></script>
<script src="vendor/slickgrid/slick.rowselectionmodel.js" type="text/javascript" charset="utf-8"></script>
<script src="vendor/jquery.qtip.min.js" type="text/javascript" charset="utf-8"></script>
<script src="lib/js/templates/templates.js" type="text/javascript" charset="utf-8"></script>
<script src="lib/js/ui.js" type="text/javascript" charset="utf-8"></script>
<script src="lib/js/utils/binding.js" type="text/javascript" charset="utf-8"></script>
<script src="lib/js/utils/locale.js" type="text/javascript" charset="utf-8"></script>
<script src="lib/js/views/view.js" type="text/javascript" charset="utf-8"></script>
<script src="lib/js/mixins/loading_mask.js" type="text/javascript" charset="utf-8"></script>
<script src="lib/js/views/scroll_view.js" type="text/javascript" charset="utf-8"></script>
<script src="lib/js/views/list_view.js" type="text/javascript" charset="utf-8"></script>
<script src="lib/js/views/container_view.js" type="text/javascript" charset="utf-8"></script>
<script src="lib/js/views/split_view.js" type="text/javascript" charset="utf-8"></script>
<script src="lib/js/views/workspace_view.js" type="text/javascript" charset="utf-8"></script>
<script src="lib/js/views/slick_grid_view.js" type="text/javascript" charset="utf-8"></script>
<script src="lib/js/views/segmented_view.js" type="text/javascript" charset="utf-8"></script>
<script src="lib/js/views/tab_view.js" type="text/javascript" charset="utf-8"></script>
<script src="lib/js/views/button_view.js" type="text/javascript" charset="utf-8"></script>
<script src="lib/js/views/link_view.js" type="text/javascript" charset="utf-8"></script>
<script src="lib/js/views/model_errors_view.js" type="text/javascript" charset="utf-8"></script>
<script src="lib/js/views/field_view.js" type="text/javascript" charset="utf-8"></script>
<script src="lib/js/views/fieldset_view.js" type="text/javascript" charset="utf-8"></script>
<script src="lib/js/views/fields/text_field_view.js" type="text/javascript" charset="utf-8"></script>
<script src="lib/js/views/fields/textarea_field_view.js" type="text/javascript" charset="utf-8"></script>
<script src="lib/js/views/fields/date_field_view.js" type="text/javascript" charset="utf-8"></script>
<script src="lib/js/views/fields/checkbox_field_view.js" type="text/javascript" charset="utf-8"></script>
<script src="lib/js/views/fields/select_field_view.js" type="text/javascript" charset="utf-8"></script>
<script src="lib/js/views/fields/radiobox_field_view.js" type="text/javascript" charset="utf-8"></script>
<script src="lib/js/views/dialog_view.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="container" id="UI">
<h1><a href="demo.html">BackboneUI</a></h1>
<h2 id="demo">A View with attribute Binding <span class="demo-hint"><i>All changes to the bound model attributes are automatically propagated to the view</i></span></h2>
<div id="view-container" style="height: 150px;"></div>
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
var model = new Backbone.Model({
visible : true,
elements : ["Adam", "Bob", "Charlie", "David", "Evan"]
});
var view = new UI.View({
fitLayout : true,
className : 'main',
container : $('#view-container'),
visibleBinding : new UI.Binding({
model : model,
key : "elements",
transform : function(val) {
return (val.length % 2 == 1)
}
}),
innerHTMLBinding : new UI.Binding({
model : model,
key : "elements"
}),
htmlRenderer : function(values) {
return "<h4>The Gang of " + values.length + "</h4><p>" + values.join(", ") + "</p>";
}
})
view.render();
/*
setInterval(function() {
var elements = model.get('elements');
if(elements.length < 7)
elements.push('Peter');
model.unset('elements', {
silent : true
});
model.set({
elements : elements
});
}, 3000);*/
});
</script>
<h2>ScrollView with ListView</h2>
<div id="scroll-view-container" style="height: 150px;"></div>
<script>
$(document).ready(function() {
var listView = new UI.ListView({
items : ["Adam", "Bob", "Charlie", "David", "Erwin", "Frida", "Guy"],
itemToView : function(item) {
return new UI.View({
height : 30,
className : item,
innerHTML : item
})
},
container : $('#scroll-view-container'),
});
/*
var view = new UI.ScrollView({
fitLayout : true,
className : 'main',
container : $('#scroll-view-container'),
contentView : listView
})*/
listView.render();
/*
setInterval(function() {
if(listView.getSize() < 10) {
listView.renderItem("Peter");
}
}, 2000) */
});
</script>
<h2>SplitView with a ScrollView and a SlickGridView (SlickGrid) <span class="demo-hint"><i>For more config options look at SlickGrid page</i></span></h2>
<div id="split-view-container" style="height: 400px;"></div>
<script>
$(document).ready(function() {
var listView = new UI.ListView({
items : ["Adam", "Bob", "Charlie", "David", "Erwin", "Frida", "Guy"],
itemToView : function(item) {
return new UI.View({
height : 30,
className : item,
innerHTML : item
})
}
});
var scrollView = new UI.ScrollView({
className : 'main',
contentView : listView,
callbacks : {
'scrollBottom' : function() {
alert("Reached Bottom");
},
'scrollTop' : function() {
alert("Reached Top");
}
}
})
var tableView = new UI.SlickGridView({
container : $('#split-view-container').resizable(),
columns : [{
id : 'id',
field : 'id',
name : 'id',
width : 50
}, {
id : 'firstname',
field : 'firstname',
name : 'Firstname',
sortable : true,
width : 150
}, {
id : 'lastname',
field : 'lastname',
name : 'Lastname',
sortable : true,
width : 150
}],
items : [{
id : 1,
firstname : 'Bob',
lastname : 'Dylan'
}, {
id : 2,
firstname : 'Charlie',
lastname : 'Sheen'
}, {
id : 3,
firstname : 'David',
lastname : 'Duchovny'
}]
});
var view = new UI.SplitView({
fitLayout : true,
container : $('#split-view-container').resizable(),
leftView : scrollView,
rightView : tableView,
resizable : true
})
view.render();
});
</script>
</div>
</body>
</html>