|
4 | 4 | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
5 | 5 | <meta name="viewport" content="width=device-width,initial-scale=1"> |
6 | 6 |
|
| 7 | + <meta name="keywords" content="open source metadata UI SPA Backbone View Model Bootstrap" /> |
| 8 | + <meta name="description" content="Evolutility :: Demo Single Page App" /></head> |
| 9 | + |
7 | 10 | <link href="../dist/css/vendors.min.css" rel="stylesheet" /> |
8 | 11 | <link href="../dist/css/demo.css" rel="stylesheet" /> |
9 | 12 | <link href="../dist/css/evolutility.css" rel="stylesheet" /> |
10 | 13 |
|
| 14 | + <script src="demo-ui.min.js" type="text/javascript"></script> |
11 | 15 | <script src="../dist/vendors.min.js" type="text/javascript"></script> |
12 | 16 | <script src="../dist/evolutility.js" type="text/javascript"></script> |
13 | 17 |
|
14 | | - <script src="../js/demo.js" type="text/javascript"></script> |
15 | | - <script src="demo-ui.min.js" type="text/javascript"></script> |
16 | | - |
17 | | - <title>demos</title> |
| 18 | + <title id="headTitle">Evolutility.js Demo</title> |
18 | 19 | </head> |
19 | 20 |
|
20 | 21 | <body> |
|
27 | 28 | <li><a href="https://github.com/evoluteur/evolutility" target="_new">GitHub</a></li> |
28 | 29 | </ul> |
29 | 30 | <ul class="evo-head-links2"> |
30 | | - <li><a href="todo.html">todo</a></li> |
31 | | - <li><a href="contact.html">addressbook</a></li> |
32 | | - <li><a href="winecellar.html">wine cellar</a></li> |
33 | | - <li><a href="test.html">test</a></li> |
| 31 | + <li><a href="#todo/badges" data-id="todo">todo</a></li> |
| 32 | + <li><a href="#contact" data-id="contact">addressbook</a></li> |
| 33 | + <li><a href="#winecellar" data-id="winecellar">wine cellar</a></li> |
34 | 34 | </ul> |
35 | 35 | <div class="clearfix"></div> |
36 | 36 | </div> |
37 | 37 |
|
38 | 38 | <div class="evo-title2"> |
39 | | - <h1 id="title">Demos</h1> |
| 39 | + <h1 id="title">Demo</h1> |
40 | 40 | </div> |
41 | 41 |
|
42 | | -<div class="evo-content"> |
| 42 | +<div class="evo-content2"> |
| 43 | + |
| 44 | + <div id="evol" class=""> |
43 | 45 |
|
44 | | -<p>These sample applications are not anything you haven't seen before. |
45 | | - The interesting thing is that these different apps are in fact the same code with different UI-models |
46 | | - and it did not require any hand coded Javascript or CSS to build them. |
47 | | - </p> |
| 46 | + <p><br/>These sample applications are not anything you haven't seen before. |
| 47 | + The interesting thing is that these different apps are in fact the same code with different UI-models |
| 48 | + and it did not require any hand coded Javascript or CSS to build them. |
| 49 | + </p> |
48 | 50 |
|
49 | | -<ul class=""> |
50 | | - <li><a href="todo.html"><img src="pix/todo.gif" class="evo-icon-16">To Do</a></li> |
51 | | - <li><a href="contact.html"><img src="pix/contact.gif" class="evo-icon-16">AddressBook</a></li> |
52 | | - <li><a href="winecellar.html"><img src="pix/wine.gif" class="evo-icon-16">Wine cellar</a></li> |
53 | | -</ul> |
| 51 | + <ul class=""> |
| 52 | + <li><a href="#todo/badges" data-id="todo"><img src="pix/todo.gif" class="evo-icon-16">To Do</a></li> |
| 53 | + <li><a href="#contact/list" data-id="contact"><img src="pix/contact.gif" class="evo-icon-16">AddressBook</a></li> |
| 54 | + <li><a href="#winecellar/list" data-id="wine"><img src="pix/wine.gif" class="evo-icon-16">Wine cellar</a></li> |
| 55 | + </ul> |
54 | 56 |
|
55 | | - <p>For each Backbone model, a single UI-model defines all views. |
56 | | - <br/>See the UI model for the sample apps: <a href="javascript:showUIdef2(todo_ui)">To Do</a>, |
57 | | - <a href="javascript:showUIdef2(contacts_ui)">Addressbook</a>, |
58 | | - <a href="javascript:showUIdef2(winecellar_ui)">Wine Cellar</a>. |
59 | | - <small id="hide_def" style="display:none;"><a href="javascript:showUIdef2no(winecellar_ui)">[Hide]</a></small></p> |
60 | | - </p> |
61 | | - <div style="display:none;" id="uimodel"></div> |
| 57 | + <p>For each Backbone model, a single UI-model defines all views. |
| 58 | + See the UI model for the sample apps: <a href="javascript:showUIdef2(todo_ui)">To Do</a>, |
| 59 | + <a href="javascript:showUIdef2(contacts_ui)">Addressbook</a>, |
| 60 | + <a href="javascript:showUIdef2(winecellar_ui)">Wine Cellar</a>. |
| 61 | + <small id="hide_def" style="display:none;"><a href="javascript:showUIdef2no(winecellar_ui)">[Hide]</a></small></p> |
| 62 | + </p> |
| 63 | + <div style="display:none;" id="uimodel"></div> |
62 | 64 |
|
63 | | - <p>These examples can also all run as a <a href="SinglePageApp.html">Single Page App</a> with routing.</p> |
| 65 | + <p>The data for these demos is stored in your browser local storage |
| 66 | + (using <a href="https://github.com/jeromegn/Backbone.localStorage" target="bbls">Backbone.localStorage</a>).</p> |
64 | 67 |
|
65 | | -<p>The data for these demos is stored in your browser local storage |
66 | | - (using <a href="https://github.com/jeromegn/Backbone.localStorage" target"bbls">Backbone.localStorage</a>).</p> |
| 68 | + <p>Evolutility.js is still a work in progress. Only Chrome is fully supported for now.</p> |
67 | 69 |
|
68 | | -<p>Evolutility.js is not finished yet. Only Chrome is fully supported for now.</p> |
69 | 70 |
|
70 | | -<p><br/>evolutility.js at <a href="https://github.com/evoluteur/evolutility" target="download">GitHub</a></p> |
| 71 | + </div> |
| 72 | + |
| 73 | + |
| 74 | + <div class="clearfix"></div> |
71 | 75 |
|
72 | 76 | </div> |
| 77 | + |
| 78 | +<script> |
| 79 | + |
| 80 | + $(document).ready(function(){ |
| 81 | + // - create sample data if none is there |
| 82 | + createSampleDataIfEmpty(todo_ui, todo_data); |
| 83 | + createSampleDataIfEmpty(contacts_ui, contacts_data); |
| 84 | + createSampleDataIfEmpty(winecellar_ui, winecellar_data); |
| 85 | + |
| 86 | + // - run shell which set demo |
| 87 | + new Evol.Shell({ |
| 88 | + el:$('#evol'), |
| 89 | + uiModelsObj: { |
| 90 | + todo: todo_ui, |
| 91 | + contact: contacts_ui, |
| 92 | + winecellar: winecellar_ui//, test_ui |
| 93 | + } |
| 94 | + }).render(); |
| 95 | + }); |
| 96 | + |
| 97 | + function showUIdef2(uiModel){ |
| 98 | + var $ui=$('#uimodel'); |
| 99 | + $ui.html(Evol.UI.input.textMJSON('uimodel2', uiModel, 10)) |
| 100 | + .slideDown(); |
| 101 | + $('#hide_def').show(); |
| 102 | + } |
| 103 | + |
| 104 | + function showUIdef2no(){ |
| 105 | + $('#uimodel').slideUp(); |
| 106 | + $('#hide_def').hide(); |
| 107 | + } |
| 108 | + |
| 109 | + function createSampleDataIfEmpty(uiModel, data){ |
| 110 | + var lc = new Backbone.LocalStorage('evol-'+uiModel.id), |
| 111 | + M = Backbone.Model.extend({ |
| 112 | + localStorage: lc |
| 113 | + }), |
| 114 | + Ms = Backbone.Collection.extend({ |
| 115 | + model: M, |
| 116 | + localStorage: lc |
| 117 | + }), |
| 118 | + ms = new Ms(); |
| 119 | + ms.fetch({ |
| 120 | + success: function(collection){ |
| 121 | + // TODO remove sample data |
| 122 | + if(collection.length===0){ |
| 123 | + Evol.UI.insertCollection(collection, data); |
| 124 | + } |
| 125 | + } |
| 126 | + }); |
| 127 | + } |
| 128 | + |
| 129 | +</script> |
73 | 130 | <div class="footer">© 2014 Olivier Giulieri</div> |
74 | 131 | </body> |
75 | 132 |
|
|
0 commit comments