Skip to content

Commit b46283b

Browse files
committed
App - changed App option "uiModelsObj" to "uiModels".
1 parent a422c95 commit b46283b

9 files changed

Lines changed: 43 additions & 30 deletions

File tree

demo/index.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,12 @@ <h1 id="title">Demos</h1>
103103
// - run App
104104
new Evol.App({
105105
el:$('#evol'),
106-
uiModelsObj: {
107-
todo: uiModels.todo,
108-
contact: uiModels.contact,
109-
winecellar: uiModels.winecellar,
110-
comics: uiModels.comics
111-
},
106+
uiModels: [
107+
uiModels.todo,
108+
uiModels.contact,
109+
uiModels.winecellar,
110+
uiModels.comics
111+
],
112112
style: 'panel-info',
113113
pageSize: 20
114114
}).render();

demo/test.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,7 @@ <h4><a href="#test/list" data-id="test"><img src="pix/color_wheel.png" class="ev
6060
// - run App
6161
new Evol.App({
6262
el:$('#evol'),
63-
uiModelsObj: {
64-
test: uiModels.test
65-
}
63+
uiModels: [uiModels.test]
6664
}).render();
6765
});
6866

dico/index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ <h1 id="title">Dico</h1>
7070
myapp=JSON.parse(localStorage.getItem('evodico-myapp'));
7171
new Evol.App({
7272
el:$e,
73-
uiModelsObj: {
74-
entity: uiModels.entity,
75-
field: uiModels.field
76-
},
73+
uiModels: [
74+
uiModels.entity,
75+
uiModels.field
76+
],
7777
style:'panel-primary'
7878
}).render();
7979

dist/css/demo.css

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,11 +259,10 @@ img.pixEvoPos {
259259
margin-right: 4px;
260260
}
261261
code {
262-
margin: 5px 0;
262+
display: block;
263263
padding: 10px;
264264
overflow: auto;
265265
font-size: 85%;
266-
line-height: 1.45;
267266
background-color: #f7f7f7;
268267
border-radius: 3px;
269268
}

dist/evolutility.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5213,7 +5213,7 @@ Evol.viewClasses = {
52135213
};
52145214

52155215
// toolbar widget which also acts as a controller for all views "one" and "many" as well as actions
5216-
Evol.ViewToolbar = function() {
5216+
Evol.Toolbar = function() {
52175217

52185218
var eUI = Evol.UI,
52195219
i18n = Evol.i18n;
@@ -6217,7 +6217,7 @@ Evol.App = Backbone.View.extend({
62176217
},
62186218

62196219
options: {
6220-
//uiModelsObj: {},
6220+
//uiModels: {},
62216221
elements:{
62226222
nav: '.evo-head-links',
62236223
nav2: '.evo-head-links2',
@@ -6231,7 +6231,11 @@ Evol.App = Backbone.View.extend({
62316231

62326232
initialize: function (opts) {
62336233
_.extend(this, this.options, opts);
6234-
this.uiModels = _.flatten(this.uiModelsObj);
6234+
var uims = {};
6235+
_.forEach(this.uiModels, function(uim, idx){
6236+
uims[uim.id||'uim'+idx] = uim;
6237+
});
6238+
this.uiModelsObj = uims;
62356239
this._tbs={};
62366240
this._ents={};
62376241
var es = this.elements;
@@ -6250,7 +6254,7 @@ Evol.App = Backbone.View.extend({
62506254

62516255
setupRouter: function(){
62526256
var that=this,
6253-
EvolRouter=Backbone.Router.extend ({
6257+
EvolRouter = Backbone.Router.extend ({
62546258
routes: {
62556259
'' : 'nav',
62566260
//':entity/:view/:id': 'nav',
@@ -6388,7 +6392,7 @@ Evol.App = Backbone.View.extend({
63886392
if(that.useRouter){
63896393
config.router = that.router;
63906394
}
6391-
var tb = new Evol.ViewToolbar(config).render();//.setTitle();
6395+
var tb = new Evol.Toolbar(config).render();//.setTitle();
63926396
if(options && tb.cardinality==='1'){
63936397
tb.setModelById(options);
63946398
}

dist/evolutility.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

doc/controller.html

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,24 @@ <h2>App</h2>
6262
For each entity it creates a toolbar which manages the views for that entity.
6363
</p>
6464

65-
<p>
66-
<code>new Evol.App(myConfig);</code>
67-
</p>
65+
<p><pre>
66+
<code>new Evol.App({
67+
el:$('#evol'),
68+
uiModels: [
69+
uiModels.todo,
70+
uiModels.contact,
71+
uiModels.winecellar,
72+
uiModels.comics
73+
]
74+
});</code>
75+
</pre></p>
6876

6977

7078
<section>
7179
<h3>Options</h3>
7280

73-
<p>uiModelsObj: {},
81+
<p>el: DOM element to hold the views.,
82+
<p>uiModels: Array of UI-models,
7483
<p>elements:{
7584
nav: '.evo-head-links',
7685
nav2: '.evo-head-links2',

js/dico/app.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Evol.App = Backbone.View.extend({
1616
},
1717

1818
options: {
19-
//uiModelsObj: {},
19+
//uiModels: [],
2020
elements:{
2121
nav: '.evo-head-links',
2222
nav2: '.evo-head-links2',
@@ -30,7 +30,11 @@ Evol.App = Backbone.View.extend({
3030

3131
initialize: function (opts) {
3232
_.extend(this, this.options, opts);
33-
this.uiModels = _.flatten(this.uiModelsObj);
33+
var uims = {};
34+
_.forEach(this.uiModels, function(uim, idx){
35+
uims[uim.id||'uim'+idx] = uim;
36+
});
37+
this.uiModelsObj = uims;
3438
this._tbs={};
3539
this._ents={};
3640
var es = this.elements;
@@ -49,7 +53,7 @@ Evol.App = Backbone.View.extend({
4953

5054
setupRouter: function(){
5155
var that=this,
52-
EvolRouter=Backbone.Router.extend ({
56+
EvolRouter = Backbone.Router.extend ({
5357
routes: {
5458
'' : 'nav',
5559
//':entity/:view/:id': 'nav',

less/doc.less

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,10 @@ img.pixEvoPos{
7171
}
7272

7373
code{
74-
margin: 5px 0;
74+
display: block;
7575
padding: 10px;
7676
overflow: auto;
7777
font-size: 85%;
78-
line-height: 1.45;
7978
background-color: #f7f7f7;
8079
border-radius: 3px;
8180
}

0 commit comments

Comments
 (0)