forked from evoluteur/evolutility-ui-jquery
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathviews.html
More file actions
548 lines (413 loc) · 19.4 KB
/
Copy pathviews.html
File metadata and controls
548 lines (413 loc) · 19.4 KB
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
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link href="../dist/css/dependencies.min.css" rel="stylesheet" />
<link href="../dist/css/demo.css" rel="stylesheet" />
<link href="../dist/css/evolutility.css" rel="stylesheet" />
<link rel="icon" type="image/png" href="../favicon.png">
<script src="../dist/dependencies.min.js" type="text/javascript"></script>
<script src="doc.js" type="text/javascript"></script>
<title>Views :: Evolutility</title>
</head>
<body>
<div class="evo-header">
<div class="evo-logo"><a href="../index.html"><span>evol</span>utility<span>.js</span></a></div>
<ul class="evo-head-links">
<li><a href="../demo/index.html">demos</a></li>
<li><a href="../doc/index.html" class="sel">doc</a></li>
<li class="evo-link2">
<ul class="evo-head-links2">
<li><a class="sel" href="views.html">views</a>
<ul>
<li><a href="#one">one</a></li>
<li><a href="#many">many</a></li>
<li><a href="#action">action</a></li>
</ul>
</li>
<li><a href="ui-model.html">ui-model</a></li>
<li><a href="controller.html">controller</a></li>
</ul>
</li>
<li class="spaced"><a href="https://github.com/evoluteur/evolutility" target="_new">GitHub</a></li>
</ul>
<div class="clearfix"></div>
</div>
<div class="evo-title2">
<h1>Views</h1>
<div class="list-views" style="left:120px;">
<div><div class="docViewType"><a href="#one"><strong>One</strong></a> model :</div>
<a href="#one-browse"><i class="glyphicon glyphicon-eye-open"></i>Browse</a>
<a href="#one-edit"><i class="glyphicon glyphicon-edit"></i>Edit</a>
<a href="#one-mini"><i class="glyphicon glyphicon-th-large"></i>Mini</a>
<a href="#one-json"><i class="glyphicon glyphicon-barcode"></i>JSON</a>
- <a href="#one-api">API</a>
</div>
<div><div class="docViewType"><a href="#many"><strong>Many</strong></a> models :</div>
<a href="#many-list"><i class="glyphicon glyphicon-th-list"></i>List</a>
<a href="#many-cards"><i class="glyphicon glyphicon-th-large"></i>Cards</a>
<a href="#many-bubbles"><i class="glyphicon glyphicon-adjust"></i>Bubbles</a>
<a href="#many-charts"><i class="glyphicon glyphicon-stats"></i>Charts</a>
- <a href="#many-api">API</a>
</div>
<div><div class="docViewType"><a href="#action"><strong>Actions</strong></a> :</div>
<a href="#action-filter"><i class="glyphicon glyphicon-filter"></i>Filter</a>
<a href="#action-export"><i class="glyphicon glyphicon-cloud-download"></i>Export</a>
</div>
</div>
</div>
<div class="evo-content2">
<p>Evolutility provides a set of Backbone views
for manipulating (viewing, editing, filtering, exporting...) Backbone models and collections.
These views are not defined in templates and custom code
but configured by a <a href="ui-model.html">ui-model</a>.</p>
<p>Evolutility views are of 3 different types:
<ul class="evo-links-views links-bih">
<li>Views for <strong>one</strong> model: <a href="#one">Evol.ViewOne</a>
<br/>
<a href="#one-browse"><i class="glyphicon glyphicon-eye-open"></i>Browse</a>
<a href="#one-edit"><i class="glyphicon glyphicon-edit"></i>Edit</a>
<a href="#one-mini"><i class="glyphicon glyphicon-th-large"></i>Mini (quick-edit)</a>
<a href="#one-json"><i class="glyphicon glyphicon-barcode"></i>JSON</a>
</li>
<p><a href="#validation">Validation</a><a href="#layout">Layout</a></p>
<li>Views for a collection of <strong>many</strong> models: <a href="#many">Evol.ViewMany</a>
<br/>
<a href="#many-list"><i class="glyphicon glyphicon-th-list"></i>List</a>
<a href="#many-cards"><i class="glyphicon glyphicon-th-large"></i>Cards</a>
<a href="#many-bubbles"><i class="glyphicon glyphicon-adjust"></i>Bubbles</a>
<a href="#many-charts"><i class="glyphicon glyphicon-stats"></i>Charts</a>
</li>
<li>Views for <strong>actions</strong> on a collection or a model: <a href="#action">Evol.ViewAction</a>
<br/>
<a href="#action-filter"><i class="glyphicon glyphicon-filter"></i>Filter</a>
<a href="#action-export"><i class="glyphicon glyphicon-cloud-download"></i>Export</a>
</li>
</ul>
</p>
<div class="v-sep"></div>
<div class="evol-doc-views">
<a name="one" class="evo-anchor"> </a>
<section id="views-one">
<h2>Evol.ViewOne</h2>
<p>Evol.ViewOne provide a set of Backbone Views for to browse, add and edit <strong>one</strong> model.</p>
<p>Views:
<span class="evo-links-views">
<a href="#one-browse"><i class="glyphicon glyphicon-eye-open"></i>Browse</a>,
<a href="#one-edit"><i class="glyphicon glyphicon-edit"></i>Edit</a>,
<a href="#one-mini"><i class="glyphicon glyphicon-th-large"></i>Mini</a> (quick-edit),
<a href="#one-json"><i class="glyphicon glyphicon-barcode"></i>JSON</a>.
</span>
</p>
<p>API: <a href="#one-api-options">Options</a> - <a href="#one-api-methods">Methods</a> - <a href="#one-api-events">Events</a>
</p>
<p>More: <a href="#one-api-options">Validation</a> - <a href="#one-api-methods">Layout</a>
</p>
<a name="one-browse" class="evo-anchor"> </a>
<div id="doc-browse">
<h3><i class="glyphicon glyphicon-eye-open"></i> Browse <span class="view-fullname">Evol.ViewOne.Browse</span></h3>
<p>Shows all fields for browsing the record in read-only mode. Fields are grouped in panels and tabs.</p>
<div class="evol-doc-views">
<img class="pixEvoView shadow" src="screenshots/one-browse.gif"/> <br/>
</div>
<pre><code>var vw = new Evol.ViewOne.Browse({
el: $('#evol'),
uiModel: myUIModel,
model: myModel
});</code></pre>
<p><br>API: <a href="#one-api-options">Options</a> - <a href="#one-api-methods">Methods</a> - <a href="#one-api-events">Events</a></p>
</div>
<a name="one-edit" class="evo-anchor"> </a>
<div id="doc-edit">
<h3><i class="glyphicon glyphicon-edit"></i> Edit <span class="view-fullname">Evol.ViewOne.Edit</span></h3>
<p>This view shows all fields for edition to create or update models.
It automatically performs validation based on the UI-model and supports
the Master-Details pattern (nested collections).
Fields are grouped in panels and tabs.
</p>
<div class="evol-doc-views">
<img class="pixEvoView shadow" src="screenshots/one-edit.gif"/> <br/>
</div>
<pre><code>var vw = new Evol.ViewOne.Edit({
el: $('#evol'),
uiModel: myUIModel,
model: myModel
});</code></pre>
<p><br>API: <a href="#one-api-options">Options</a> - <a href="#one-api-methods">Methods</a> - <a href="#one-api-events">Events</a></p>
</div>
<a name="one-mini" class="evo-anchor"> </a>
<div id="doc-mini">
<h3><i class="glyphicon glyphicon-th-large"></i> Mini (quick-edit) <span class="view-fullname">Evol.ViewOne.Mini</span></h3>
<p>Only shows important fields (required or showing as a column in grids). Fields are grouped in a single panel.</p>
<div class="evol-doc-views">
<img class="pixEvoView shadow" src="screenshots/one-mini.gif"/> <br/>
</div>
<pre><code>var vw = new Evol.ViewOne.Mini({
el: $('#evol'),
uiModel: myUIModel,
model: myModel
});</code></pre>
<p><br>API: <a href="#one-api-options">Options</a> - <a href="#one-api-methods">Methods</a> - <a href="#one-api-events">Events</a></p>
</div>
<a name="one-json" class="evo-anchor"> </a>
<div id="doc-json">
<h3><i class="glyphicon glyphicon-barcode"></i> JSON <span class="view-fullname">Evol.ViewOne.JSON</span></h3>
<p>JSON representation of the data.</p>
<div class="evol-doc-views">
<img class="pixEvoView shadow" src="screenshots/one-json.gif"/> <br/>
</div>
<pre><code>var vw = new Evol.ViewOne.JSON({
el: $('#evol'),
uiModel: myUIModel,
model: myModel
});</code></pre>
<p><br>API: <a href="#one-api-options">Options</a> - <a href="#one-api-methods">Methods</a> - <a href="#one-api-events">Events</a></p>
<a name="validation" class="evo-anchor"> </a>
<section>
<h2>Validation</h2>
<p>Validation is determined by the field properties.</p>
<ul>
<li><span class="xmlAttr">type</span> - Field must be of the specified type (Text, Integer, Decimal, Date...).</li>
<li><span class="xmlAttr">required</span> - Field must have a value.</li>
<li><span class="xmlAttr">max</span> - Maximum value allowed.</li>
<li><span class="xmlAttr">min</span> - Minimum value allowed.</li>
<li><span class="xmlAttr">maxLength</span> - Maximum length.</li>
<li><span class="xmlAttr">minLength</span> - Minimum length.</li>
<li><span class="xmlAttr">regExp</span> - Regular expression to verify.</li>
<li><span class="xmlAttr">fnValidate</span> - Custom validation function.</li>
</ul>
<p>Validation happens when the user clicks the "Save" button. Invalid fields are flagged and a summary of all fields which didn't pass the validation is displayed.</p>
</section>
<a name="layout" class="evo-anchor"> </a>
<section class="evol-doc-layout">
<h2>Layout</h2>
<p>Layouts are used for the views "Browse" and "Edit". Evolutility follows the "flow positioning" method. Elements position is entirely determined by their order in the ui-model, which
does not require any description of the positioning, absolute or relative, of
the user interface on the screen. The ordering of the information and the
internal description of each element (such as field type, width, and height) implies
the coordonates of every element on each screen.</p>
<p>You can organize fields in panels (sections) on the page.
Panels are placed sequentially, left to right, until a width of 100% is
reached. Once the maximum width is reached, the next panel will appear below
the previous group of panels.</p>
<p>In the following screenshot the form is organized into 4 panels for "Identity"
(width=60%), "Contact Info" (width=40%), "Address" (width=60%), and
"Misc." (width=40%). Each of these panels contains one or several fields.</p>
<TABLE cellSpacing="0" cellPadding="0" border="0" >
<TR>
<TD vAlign="top">
<p><img src="screenshots/position-panels.gif" class="pixEvoPos shadow">
</p>
</TD>
<td> </td>
<TD vAlign="top"><br>
<P>Identity: width=60%<br/>
"Contact Info": width=40%<br/>
Address: width=60%<br/>
"Misc.": width=40%</p>
</TD>
</TR>
</TABLE>
<p>Inside each panel, fields are placed using the same rule: placed sequentially,
left to right, until a width of 100% is reached.</p>
<TABLE cellSpacing="0" cellPadding="0" border="0" >
<TR>
<TD vAlign="top">
<p><img src="screenshots/position-100.gif" class="pixEvoPos shadow"><br/>
</p>
</TD>
<td> </td>
<TD vAlign="top"><br>
<P>Lastname: width=100%<br/>
Firstname: width=100%<br/>
email: width=100%</p>
</TD>
</TR>
<TR>
<TD vAlign="top">
<p><img src="screenshots/position-50.gif" class="pixEvoPos shadow">
</p>
</TD>
<td> </td>
<TD vAlign="top"><br>
<P>Lastname: width=50%<br/>
Firstname: width=50%<br/>
email: width=100%</p>
</TD>
</TR>
</TABLE>
<p>The previous 2 screenshots demonstrate how elements are re-positioned simply by
changing their width.
</p>
<p>The "flow positioning" method is also quite flexible as it allows different numbers of fields on different rows which is quite
useful for cases like an address.</p>
<TABLE cellSpacing="0" cellPadding="0" border="0" >
<TR>
<TD vAlign="top"><img src="screenshots/position-address.gif" class="pixEvoPos shadow">
</TD>
<td> </td>
<TD vAlign="top"><br>
<P >Address: width=100%<br/>
Address 2: width=100%<br/>
City: width=62%<br/>
State: width=15%<br/>
Zip: width=23%<br/>
<br/>
</p>
</TD>
</TR>
</TABLE>
<h4>View layout customization with CSS</h4>
<p>It is possible to enhance or adapt layout by adding CSS classes. </p>
<p>For example, here is a CSS to change the background of all cards in the Cards views for all apps.
<pre><code>.evol-cards-body > .panel {
background-color: blue;
}
</code></pre>
</p>
<p>It can also by applied to a specific object as follow:
<pre><code>[data-eid="contact"] .evol-cards-body > .panel {
background-color: green !important;
}
</code></pre>
</p>
<p>For the demo, in Cards view, cards height is defined in CSS for each entity.</p>
</section>
</div>
<div id="vw-one"></div>
</section>
<a name="many" class="evo-anchor"> </a>
<section id="views-many">
<h2>Evol.ViewMany</h2>
<p>Views for a collection of <strong>many</strong> models:
<span class="evo-links-views">
<a href="#many-list"><i class="glyphicon glyphicon-th-list"></i>List</a>,
<a href="#many-cards"><i class="glyphicon glyphicon-th-large"></i>Cards</a>,
<a href="#many-bubbles"><i class="glyphicon glyphicon-adjust"></i>Bubbles</a>,
<a href="#many-charts"><i class="glyphicon glyphicon-stats"></i>Charts</a>.</li>
</span>
</p>
<div>
API: <a href="#many-api-options">Options</a> - <a href="#many-api-methods">Methods</a> - <a href="#many-api-events">Events</a>
</div>
<a name="many-list" class="evo-anchor"> </a>
<div id="doc-list">
<h3><i class="glyphicon glyphicon-th-list"></i> List <span class="view-fullname">Evol.ViewMany.List</span></h3>
<p>Gives a tabular view of a collection with paging.</p>
<div class="evol-doc-views">
<img class="pixEvoView shadow" src="screenshots/many-list.gif"/><br/>
</div>
<pre><code>var vw = new Evol.ViewMany.List({
el: $('#evol'),
uiModel: myUIModel,
collection: myCollection
});</code></pre>
<div><br>
API: <a href="#many-api-options">Options</a> - <a href="#many-api-methods">Methods</a> - <a href="#many-api-events">Events</a>
</div>
</div>
<a name="many-cards" class="evo-anchor"> </a>
<div id="doc-cards">
<h3><i class="glyphicon glyphicon-th-large"></i> Cards <span class="view-fullname">Evol.ViewMany.Cards</span></h3>
<p>Shows records side by side as cards.</p>
<div class="evol-doc-views">
<img class="pixEvoView shadow" src="screenshots/many-cards.gif"/><br/>
</div>
<pre><code>var vw = new Evol.ViewMany.Cards({
el: $('#evol'),
uiModel: myUIModel,
collection: myCollection
});</code></pre>
<div><br>
API: <a href="#many-api-options">Options</a> - <a href="#many-api-methods">Methods</a> - <a href="#many-api-events">Events</a>
</div>
</div>
<a name="many-bubbles" class="evo-anchor"> </a>
<div id="doc-bubbles">
<h3><i class="glyphicon glyphicon-adjust"></i> Bubbles <span class="view-fullname">Evol.ViewMany.Bubbles</span></h3>
<p>The "Bubbles" view displays the data as bubbles with controls to group them and set their color and size (this view uses D3.js).
A tooltip with the Card view of the item show on mouse over.</p>
<div class="evol-doc-views">
<img class="pixEvoView shadow" src="screenshots/many-bubbles.gif"/><br/>
</div>
<pre><code>var vw = new Evol.ViewMany.Bubbles({
el: $('#evol'),
uiModel: myUIModel,
collection: myCollection
});</code></pre>
<div><br>
API: <a href="#many-api-options">Options</a> - <a href="#many-api-methods">Methods</a> - <a href="#many-api-events">Events</a>
</div>
</div>
<a name="many-charts" class="evo-anchor"> </a>
<div id="doc-charts">
<h3><i class="glyphicon glyphicon-stats"></i> Charts <span class="view-fullname">Evol.ViewMany.Charts</span></h3>
<p>Displays charts about the collection. Draws a pie chart or bar chart for each field of type list, boolean, integer and decimal.</p>
<div class="evol-doc-views">
<img class="pixEvoView shadow" src="screenshots/many-charts.gif"/><br/>
</div>
<pre><code>var vw = new Evol.ViewMany.Charts({
el: $('#evol'),
uiModel: myUIModel,
collection: myCollection
});</code></pre>
<div><br>
API: <a href="#many-api-options">Options</a> - <a href="#many-api-methods">Methods</a> - <a href="#many-api-events">Events</a>
</div>
</div>
<div id="vw-many"></div>
</section>
<a name="action" class="evo-anchor"> </a>
<section id="views-action">
<h2>Evol.ViewAction</h2>
<p>Backbone Views for actions on a collection or a model.</p>
<p class="evo-links-views">
<a href="#action-filter"><i class="glyphicon glyphicon-filter"></i>Filter</a>,
<a href="#action-export"><i class="glyphicon glyphicon-cloud-download"></i>Export</a>.
</p>
<a name="action-filter" class="evo-anchor"> </a>
<div id="doc-filter">
<h3><i class="glyphicon glyphicon-filter"></i> Filter <span class="view-fullname">Evol.ViewAction.Filter</span></h3>
<p>View used to build a structured query to filter a collection.</p>
<div class="evol-doc-views">
<img class="pixEvoView shadow" src="screenshots/action-filter.gif"/><br/>
</div>
<p>Filter example: "phone number start by 415" or "for
categories Finances and Business"... </p>
<pre><code>var vw = new Evol.ViewAction.Filter({
el: $('#evol'),
uiModel: myUIModel
});</code></pre>
<div id="vw-filter"></div>
</div>
<a name="action-export" class="evo-anchor"> </a>
<div id="doc-export">
<h3><i class="glyphicon glyphicon-cloud-download"></i> Export <span class="view-fullname">Evol.ViewAction.Export</span></h3>
<p>View to define export options and preview the collection export in different data formats (CSV, TAB, HTML, XML,
SQL and JSON).
</p>
<div class="evol-doc-views">
<img class="pixEvoView shadow" src="screenshots/action-export.gif"/><br/>
</div>
<pre><code>var vw = new Evol.ViewAction.Export({
el: $('#evol'),
uiModel: myUIModel,
colllection: myCollection
});</code></pre>
<div id="vw-export"></div>
</div>
</section>
<p><br><br>More Views will be added in the future (thinking of Summary, Import, Mass update, Group, Dashboard, Report, Print, PDF,
Auto-documentation and specs...).</p>
</div>
<div class="footer">© 2015 Olivier Giulieri</div>
</div>
<script>
$(document).ready(function(){
enhanceViewDefinitions();
});
</script>
</body>
</html>