Skip to content

Commit c17879a

Browse files
author
Olivier Giulieri
committed
Cleanups.
1 parent c97e4be commit c17879a

10 files changed

Lines changed: 111 additions & 58 deletions

File tree

dist/css/demo.css

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,10 +271,16 @@ h4 {
271271
font-weight: normal;
272272
}
273273
/* demo badge view*/
274-
[data-eid="todo"] .evol-badges-body > div.panel,
275-
[data-eid="contact"] .evol-badges-body > div.panel {
274+
[data-eid="todo"] .evol-badges-body > .panel,
275+
[data-eid="contact"] .evol-badges-body > .panel {
276276
height: 160px !important;
277277
}
278+
[data-eid="winecellar"] .evol-badges-body {
279+
/*label {
280+
text-align:right;
281+
min-width: 80px;
282+
}*/
283+
}
278284
[data-eid="winecellar"] .evol-badges-body > div.panel {
279285
height: 272px !important;
280286
}

dist/evolutility.js

Lines changed: 64 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,10 @@ Evol.UI = {
459459
}else{
460460
$e.hide();
461461
}
462+
},
463+
464+
cr2br: function(v){
465+
return v.replace(/[\r\n]/g, '<br/>');
462466
}
463467

464468
};
@@ -571,6 +575,11 @@ Evol.i18n = {
571575
deleteN: 'Delete {0} {1}?', // delete 5 tasks
572576
deleted1:'{0} deleted.', // {0}=entity ,
573577

578+
notFound:'Item not found.',
579+
//this.setMessage(i18n.notFound, i18n.getLabel('notFoundMsg', this.uiModel.entity);
580+
notFoundMsg:'No {0} found.',
581+
notFoundMsgId:'No {0} found for ID="(1}".',
582+
574583
NoChange:'No Change',
575584
NoX:'No {0}',
576585
//Back2SearchResults:'Back to search results',
@@ -1599,7 +1608,7 @@ Evol.ViewMany.Badges = Evol.ViewMany.extend({
15991608
Evol.Dico.HTMLFieldLink('fg-'+f.id, f, v, icon, !link, route?route+model.id:null),
16001609
'</h4></div>');
16011610
}else{
1602-
h.push('<div><label>',f.label,':</label> ', v, '</div>');
1611+
h.push('<div><label>', f.labelbadges?f.labelbadges:f.label,':</label> ', v, '</div>');
16031612
}
16041613
});
16051614
h.push('</div>');
@@ -1997,7 +2006,7 @@ Evol.ViewOne = Backbone.View.extend({
19972006
$f.html((fv)?('<img src="'+iconsPath+fv+'" class="img-thumbnail">'):('<p>'+Evol.i18n.nopix+'</p>'));
19982007
break;
19992008
case fTypes.textml:
2000-
$f.html(fv.replace(/[\r\n]/g, '<br/>'));
2009+
$f.html(Evol.UI.cr2br(fv));
20012010
break;
20022011
default:
20032012
$f.text(Evol.Dico.HTMLField4Many(f, fv, Evol.hashLov, iconsPath) || ' ');
@@ -2896,8 +2905,11 @@ Evol.ViewOne.JSON = Evol.ViewOne.extend({
28962905
if(this.model){
28972906
var jsonStr=JSON.stringify(this.model, null, 2);
28982907
h.push(Evol.UI.input.textMJSON('',jsonStr,10));
2908+
this._renderButtons(h, 'json');
2909+
}else{
2910+
h.push(Evol.UI.HTMLMsg(Evol.i18n.nodata,'','info'));
28992911
}
2900-
this._renderButtons(h, 'json');
2912+
//this._renderButtons(h, 'json');
29012913
this.$el.html(h.join(''));
29022914
this.setData(this.model);
29032915
this.custOn=false;
@@ -3653,8 +3665,8 @@ Evol.ViewAction.Export = Backbone.View.extend({
36533665
//# field - separator
36543666
//# - csv - any separator #######
36553667
'<div data-id="csv2" class="evol-w120">',
3656-
EvoUI.fieldLabel(prefix+'FLS_evol', i18nXpt.separator),
3657-
EvoUI.input.text(prefix+'FLS_evol', ',', '0'),
3668+
EvoUI.fieldLabel('separator', i18nXpt.separator),
3669+
EvoUI.input.text('separator', ',', '0'),
36583670
'</div>', // </div>
36593671
'</div>');
36603672
_.each(['XML','HTML','SQL','JSON'], function(f){
@@ -3754,7 +3766,7 @@ Evol.ViewAction.Export = Backbone.View.extend({
37543766
case 'CSV':
37553767
case 'TAB':
37563768
case 'TXT':
3757-
var sep = Evol.UI.trim(this.$(prefix+'FLS_evol').val());
3769+
var sep = Evol.UI.trim(this.$('#separator').val());
37583770
if(format=='TAB'){
37593771
sep='&#09;';
37603772
}
@@ -3818,9 +3830,9 @@ Evol.ViewAction.Export = Backbone.View.extend({
38183830
});
38193831
break;
38203832
case 'SQL':
3821-
var optTransaction = this.$('#evoxpTRS1').prop('checked'),
3822-
optIdInsert = this.$('#evoxpTRS2').prop('checked'),
3823-
sqlTable = this.$('#evoTable').val().replace(/ /g,'_'),
3833+
var optTransaction = this.$('#transaction').prop('checked'),
3834+
optIdInsert = this.$('#insertId').prop('checked'),
3835+
sqlTable = this.$('#table').val().replace(/ /g,'_'),
38243836
sql = ['INSERT INTO ',sqlTable,' ('];
38253837

38263838
if(sqlTable===''){
@@ -3888,7 +3900,7 @@ Evol.ViewAction.Export = Backbone.View.extend({
38883900
}
38893901
break;
38903902
case 'XML':
3891-
var elemName = this.$('#evoRoot').val() || this.uiModel.entity.replace(/ /g,'_'),
3903+
var elemName = this.$('#elementName').val() || this.uiModel.entity.replace(/ /g,'_'),
38923904
fv;
38933905
h.push('<xml>\n');
38943906
_.every(data, function(m, idx){
@@ -3943,13 +3955,32 @@ Evol.ViewAction.Export = Backbone.View.extend({
39433955

39443956
_getValue: function () {
39453957
var v = {
3946-
format: EvoExport.cFormat,
3958+
//format: EvoExport.cFormat,
3959+
format: this.$('#xptevol-xpt-format').val(),
39473960
fields: this._valFields(),
39483961
options: {}
3949-
},
3950-
ps = this.$('.evol-xpt-para input'),
3951-
f = ps.eq(0);
3952-
v.options[f.attr('id')] = !_.isUndefined(f.prop('checked'));
3962+
};
3963+
3964+
var fvs=this.$('#xpt'+EvoExport.cFormat+' input');
3965+
for(var i=0,iMax=fvs.length;i<iMax;i++){
3966+
var $f=fvs.eq(i),
3967+
fv;
3968+
if($f.attr('type')=='checkbox'){
3969+
fv = $f.prop('checked');
3970+
}else if($f.is(':selected')){
3971+
fv = $f.val();
3972+
}else{
3973+
fv = $f.val();
3974+
}
3975+
v.options[$f.attr('id')] = fv;
3976+
}
3977+
if(v.format==='CSV' || v.format==='TAB'){
3978+
v.options.firstLineHeader = this.$('#xptFLH').prop('checked');
3979+
if(v.format==='TAB'){
3980+
delete v.options.separator;
3981+
}
3982+
}
3983+
39533984
return v;
39543985
},
39553986

@@ -4006,8 +4037,7 @@ var EvoExport = {
40064037
optsXML: function(entity){
40074038
return [
40084039
EvoExport.html_more2('options'),
4009-
EvoExport.optEntityName('evoRoot', i18nXpt.XMLroot, entity),
4010-
Evol.UI.fieldLabel('evoxpC2X', i18nXpt.xpColMap),
4040+
EvoExport.optEntityName('elementName', i18nXpt.XMLroot, entity),
40114041
'</div>'
40124042
].join('');
40134043
},
@@ -4019,9 +4049,9 @@ var EvoExport = {
40194049
optsSQL: function(entity){
40204050
return [
40214051
EvoExport.html_more2('options'),
4022-
EvoExport.optEntityName('evoTable', i18nXpt.SQLTable, entity),
4023-
'<div>', Evol.UI.input.checkbox('evoxpTRS2', '0'), Evol.UI.fieldLabelSpan('evoxpTRS2', i18nXpt.SQLId), '</div>',
4024-
'<div>', Evol.UI.input.checkbox('evoxpTRS1', '0'), Evol.UI.fieldLabelSpan('evoxpTRS1', i18nXpt.SQLTrans), '</div>',
4052+
EvoExport.optEntityName('table', i18nXpt.SQLTable, entity),
4053+
'<div>', Evol.UI.input.checkbox('insertId', '0'), Evol.UI.fieldLabelSpan('insertId', i18nXpt.SQLId), '</div>',
4054+
'<div>', Evol.UI.input.checkbox('transaction', '0'), Evol.UI.fieldLabelSpan('transaction', i18nXpt.SQLTrans), '</div>',
40254055
'</div>'
40264056
].join('');
40274057
},
@@ -5424,9 +5454,9 @@ Evol.ViewToolbar = Backbone.View.extend({
54245454
'save':true,
54255455
del: true,
54265456
filter: true,
5427-
'export': true,
5428-
group: false,
5429-
customize: false
5457+
'export': true
5458+
//group: false,
5459+
//customize: false
54305460
},
54315461
pageSize:20
54325462
},
@@ -5711,7 +5741,7 @@ Evol.ViewToolbar = Backbone.View.extend({
57115741
del: lis.filter('[data-id="del"]'),
57125742
save: lis.filter('[data-id="save"]'),
57135743
prevNext: this.$('.evo-toolbar [data-id="prev"],.evo-toolbar [data-id="next"]'),
5714-
customize: this.$('.evo-toolbar a[data-id="customize"]').parent(),
5744+
//customize: this.$('.evo-toolbar a[data-id="customize"]').parent(),
57155745
views: this.$('.evo-toolbar [data-id="views"]')
57165746
};
57175747
}
@@ -5728,7 +5758,7 @@ Evol.ViewToolbar = Backbone.View.extend({
57285758

57295759
if(this.$el){
57305760
var tbBs=this.getToolbarButtons();
5731-
setVisible(tbBs.customize, mode!='json');
5761+
//setVisible(tbBs.customize, mode!='json');
57325762
tbBs.prevNext.hide();
57335763
setVisible(tbBs.views, mode!=='export');
57345764
tbBs.del.hide();
@@ -5861,6 +5891,9 @@ Evol.ViewToolbar = Backbone.View.extend({
58615891
this.curView.setModel(cModel);
58625892
if(cModel){
58635893
this.setRoute(cModel?cModel.id:null, false);
5894+
}else{
5895+
Evol.UI.modal.alert(i18n.notFound, i18n.getLabel('notFoundMsg', this.uiModel.entity));
5896+
//this.setMessage(i18n.notFound, i18n.getLabel('notFoundMsg', this.uiModel.entity));
58645897
}
58655898
return this
58665899
.clearMessage();
@@ -6042,9 +6075,10 @@ Evol.ViewToolbar = Backbone.View.extend({
60426075
this.setView(actionId, true);
60436076
break;
60446077
case 'export':
6045-
alert(
6046-
'Sorry, no demo server yet...\n\n' +
6078+
Evol.UI.modal.alert(
6079+
'This feature must be implemented server side.',
60476080
JSON.stringify(this.curView.val(), null, 2)
6081+
//Evol.UI.cr2br(JSON.stringify(this.curView.val(), null, 2))
60486082
);
60496083
break;
60506084
case 'save':
@@ -6075,6 +6109,7 @@ Evol.ViewToolbar = Backbone.View.extend({
60756109
if(this.curView.setPage){
60766110
this.curView.setPage(pIdx);
60776111
}
6112+
return this;
60786113
},
60796114

60806115
status_update: function(evt, ui){
@@ -6117,10 +6152,10 @@ Evol.ViewToolbar = Backbone.View.extend({
61176152
break;
61186153
case 'del':
61196154
this.deleteItem();
6120-
break;
6155+
break;/*
61216156
case 'customize':
61226157
this.curView.customize();
6123-
break;/*
6158+
break;
61246159
case 'group':
61256160
this.showGroup();
61266161
break;*/
@@ -6339,11 +6374,6 @@ Evol.Shell = Backbone.View.extend({
63396374
ms = new Ms();
63406375
ms.fetch({
63416376
success: function(collection){
6342-
// TODO no more insertCollection
6343-
// insertCollection is for demo purpose only. it will be removed.
6344-
if(collection.length===0){
6345-
Evol.UI.insertCollection(collection, data);
6346-
}
63476377
var m = ms.models[0],
63486378
config = {
63496379
el: $v,

dist/evolutility.min.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/i18n/EN.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ Evol.i18n = {
6060
deleteN: 'Delete {0} {1}?', // delete 5 tasks
6161
deleted1:'{0} deleted.', // {0}=entity ,
6262

63+
notFound:'Item not found.',
64+
//this.setMessage(i18n.notFound, i18n.getLabel('notFoundMsg', this.uiModel.entity);
65+
notFoundMsg:'No {0} found.',
66+
notFoundMsgId:'No {0} found for ID="(1}".',
67+
6368
NoChange:'No Change',
6469
NoX:'No {0}',
6570
//Back2SearchResults:'Back to search results',

js/one-json.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,11 @@ Evol.ViewOne.JSON = Evol.ViewOne.extend({
2222
if(this.model){
2323
var jsonStr=JSON.stringify(this.model, null, 2);
2424
h.push(Evol.UI.input.textMJSON('',jsonStr,10));
25+
this._renderButtons(h, 'json');
26+
}else{
27+
h.push(Evol.UI.HTMLMsg(Evol.i18n.nodata,'','info'));
2528
}
26-
this._renderButtons(h, 'json');
29+
//this._renderButtons(h, 'json');
2730
this.$el.html(h.join(''));
2831
this.setData(this.model);
2932
this.custOn=false;

js/one.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ Evol.ViewOne = Backbone.View.extend({
195195
$f.html((fv)?('<img src="'+iconsPath+fv+'" class="img-thumbnail">'):('<p>'+Evol.i18n.nopix+'</p>'));
196196
break;
197197
case fTypes.textml:
198-
$f.html(fv.replace(/[\r\n]/g, '<br/>'));
198+
$f.html(Evol.UI.cr2br(fv));
199199
break;
200200
default:
201201
$f.text(Evol.Dico.HTMLField4Many(f, fv, Evol.hashLov, iconsPath) || ' ');

js/shell.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,6 @@ Evol.Shell = Backbone.View.extend({
139139
ms = new Ms();
140140
ms.fetch({
141141
success: function(collection){
142-
// TODO no more insertCollection
143-
// insertCollection is for demo purpose only. it will be removed.
144-
if(collection.length===0){
145-
Evol.UI.insertCollection(collection, data);
146-
}
147142
var m = ms.models[0],
148143
config = {
149144
el: $v,

js/toolbar.js

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ Evol.ViewToolbar = Backbone.View.extend({
4444
'save':true,
4545
del: true,
4646
filter: true,
47-
'export': true,
48-
group: false,
49-
customize: false
47+
'export': true
48+
//group: false,
49+
//customize: false
5050
},
5151
pageSize:20
5252
},
@@ -331,7 +331,7 @@ Evol.ViewToolbar = Backbone.View.extend({
331331
del: lis.filter('[data-id="del"]'),
332332
save: lis.filter('[data-id="save"]'),
333333
prevNext: this.$('.evo-toolbar [data-id="prev"],.evo-toolbar [data-id="next"]'),
334-
customize: this.$('.evo-toolbar a[data-id="customize"]').parent(),
334+
//customize: this.$('.evo-toolbar a[data-id="customize"]').parent(),
335335
views: this.$('.evo-toolbar [data-id="views"]')
336336
};
337337
}
@@ -348,7 +348,7 @@ Evol.ViewToolbar = Backbone.View.extend({
348348

349349
if(this.$el){
350350
var tbBs=this.getToolbarButtons();
351-
setVisible(tbBs.customize, mode!='json');
351+
//setVisible(tbBs.customize, mode!='json');
352352
tbBs.prevNext.hide();
353353
setVisible(tbBs.views, mode!=='export');
354354
tbBs.del.hide();
@@ -481,6 +481,9 @@ Evol.ViewToolbar = Backbone.View.extend({
481481
this.curView.setModel(cModel);
482482
if(cModel){
483483
this.setRoute(cModel?cModel.id:null, false);
484+
}else{
485+
Evol.UI.modal.alert(i18n.notFound, i18n.getLabel('notFoundMsg', this.uiModel.entity));
486+
//this.setMessage(i18n.notFound, i18n.getLabel('notFoundMsg', this.uiModel.entity));
484487
}
485488
return this
486489
.clearMessage();
@@ -662,9 +665,10 @@ Evol.ViewToolbar = Backbone.View.extend({
662665
this.setView(actionId, true);
663666
break;
664667
case 'export':
665-
alert(
666-
'Sorry, no demo server yet...\n\n' +
668+
Evol.UI.modal.alert(
669+
'This feature must be implemented server side.',
667670
JSON.stringify(this.curView.val(), null, 2)
671+
//Evol.UI.cr2br(JSON.stringify(this.curView.val(), null, 2))
668672
);
669673
break;
670674
case 'save':
@@ -695,6 +699,7 @@ Evol.ViewToolbar = Backbone.View.extend({
695699
if(this.curView.setPage){
696700
this.curView.setPage(pIdx);
697701
}
702+
return this;
698703
},
699704

700705
status_update: function(evt, ui){
@@ -737,10 +742,10 @@ Evol.ViewToolbar = Backbone.View.extend({
737742
break;
738743
case 'del':
739744
this.deleteItem();
740-
break;
745+
break;/*
741746
case 'customize':
742747
this.curView.customize();
743-
break;/*
748+
break;
744749
case 'group':
745750
this.showGroup();
746751
break;*/

js/ui.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,10 @@ Evol.UI = {
456456
}else{
457457
$e.hide();
458458
}
459+
},
460+
461+
cr2br: function(v){
462+
return v.replace(/[\r\n]/g, '<br/>');
459463
}
460464

461465
};

0 commit comments

Comments
 (0)