@@ -578,7 +578,7 @@ Evol.i18n = {
578578 var ns = label . split ( '.' ) ;
579579 l = this [ ns [ 0 ] ] [ ns [ 1 ] ] ;
580580 } else {
581- l = label ;
581+ l = this [ label ] ;
582582 }
583583 if ( string1 ) {
584584 l = l . replace ( '{0}' , string1 ) ;
@@ -594,11 +594,11 @@ Evol.i18n = {
594594 Edit :'Edit' ,
595595 // Login:'Login',
596596 New :'New' ,
597- NewItem :'New {0}' , //'New Item',
597+ NewEntity :'New {0}' , //'New Item',
598598 NewUpload :'New Upload' ,
599599 //Search:'Search',
600600 //AdvSearch:'Advanced Search',
601- NewSearch :'New Search' ,
601+ // NewSearch:'New Search',
602602 Selections :'Selections' ,
603603 Selection :'Selection' ,
604604 Export :'Export' ,
@@ -615,6 +615,13 @@ Evol.i18n = {
615615 nochart :'No charts available.' ,
616616 badchart :'The data structure doesn\'t allow for auto-generated charts.' ,
617617
618+ // --- buttons ---
619+ Save :'Save' ,
620+ SaveAdd :'Save and Add Another' ,
621+ Cancel :'Cancel' ,
622+ NoChange :'No Change' ,
623+ NoX :'No {0}' ,
624+
618625 // --- status ---
619626 status :{
620627 added :'New {0} "{1}" added.' ,
@@ -646,7 +653,8 @@ Evol.i18n = {
646653
647654 // --- export ---
648655 export :{
649- ExportEntity : 'Export this {0}' , // {0}=entity
656+ ExportEntity : 'Export {0}' , // {0}=entity
657+ ExportEntities : 'Export {0}' , // {0}=entities
650658 ExportHeader : 'Header' ,
651659 ExportSeparator : 'Separator' ,
652660 ExportFirstLine :'First line for field names' ,
@@ -667,13 +675,6 @@ Evol.i18n = {
667675 DownloadEntity :'Download {0}'
668676 } ,
669677
670- // --- buttons ---
671- Save :'Save' ,
672- SaveAdd :'Save and Add Another' ,
673- Cancel :'Cancel' ,
674- NoChange :'No Change' ,
675- NoX :'No {0}' ,
676-
677678 // --- filters ---
678679 filters :{
679680 sEqual :'equals' ,
@@ -890,7 +891,7 @@ Evol.ViewMany = Backbone.View.extend({
890891 options : {
891892 style : 'panel-info' ,
892893 pageSize : 20 ,
893- title : '#title' , // TODO FIX
894+ titleSelector : '#title' ,
894895 selectable : true
895896 } ,
896897
@@ -903,7 +904,7 @@ Evol.ViewMany = Backbone.View.extend({
903904
904905 initialize : function ( opts ) {
905906 var that = this ;
906- _ . extend ( this . options , opts ) ;
907+ this . options = _ . extend ( this . options , opts ) ;
907908 this . _filter = [ ] ;
908909 if ( this . collection ) {
909910 this . collection . on ( 'change' , function ( model ) {
@@ -959,6 +960,7 @@ Evol.ViewMany = Backbone.View.extend({
959960 case 0 :
960961 want = ! fv ;
961962 break ;
963+
962964 }
963965 }
964966 return want ;
@@ -1011,7 +1013,11 @@ Evol.ViewMany = Backbone.View.extend({
10111013 //},
10121014
10131015 _updateTitle : function ( ) {
1014- //$(this.options.title).html(this.model.get('title'));
1016+ $ ( this . options . titleSelector ) . html ( this . getTitle ( ) ) ;
1017+ } ,
1018+
1019+ getTitle : function ( ) {
1020+ return Evol . UI . capFirstLetter ( this . options . uiModel . entities ) ;
10151021 } ,
10161022
10171023 getFields : function ( ) {
@@ -1149,6 +1155,7 @@ Evol.ViewMany = Backbone.View.extend({
11491155 var $e = $ ( evt . currentTarget ) ,
11501156 id = $e . data ( 'id' ) ,
11511157 eType = $e . data ( 'type' ) ;
1158+
11521159 Evol . Dico . showDesigner ( id , eType , $e ) ;
11531160 this . $el . trigger ( eType + '.customize' , { id : id , type :eType } ) ;
11541161 }
@@ -1521,7 +1528,7 @@ Evol.ViewOne = Backbone.View.extend({
15211528 } ) ;
15221529 } ,
15231530
1524- getSummary : function ( ) {
1531+ getTitle : function ( ) {
15251532 if ( this . model ) {
15261533 var lf = this . options . uiModel . leadfield ;
15271534 return _ . isFunction ( lf ) ?lf ( this . model ) :this . model . get ( lf ) ;
@@ -1929,7 +1936,7 @@ Evol.ViewOne = Backbone.View.extend({
19291936 if ( title ) {
19301937 t = title ;
19311938 } else if ( lf !== undefined && lf !== '' ) {
1932- t = this . getSummary ( ) ;
1939+ t = this . getTitle ( ) ;
19331940 } else {
19341941 t = Evol . UI . capFirstLetter ( opts . uiModel . entities ) ;
19351942 }
@@ -2277,6 +2284,7 @@ Evol.ViewToolbar = Backbone.View.extend({
22772284 defaultView : 'list' ,
22782285 style : 'panel-info' ,
22792286 display : 'tooltip' , // tooltip, text, icon, none
2287+ titleSelector : '#title' ,
22802288 buttons : {
22812289 // --- views for one ---
22822290 edit : true ,
@@ -2469,7 +2477,8 @@ Evol.ViewToolbar = Backbone.View.extend({
24692477 model : this . model ,
24702478 collection : this . collection ,
24712479 uiModel : opts . uiModel ,
2472- style : opts . style
2480+ style : opts . style ,
2481+ titleSelector : opts . titleSelector
24732482 } ;
24742483 this . $ ( '[data-id="new"]' ) . show ( ) ;
24752484 this . $ ( '[data-id="views"] > li' ) . removeClass ( 'evo-sel' ) // TODO optimize
@@ -2499,9 +2508,15 @@ Evol.ViewToolbar = Backbone.View.extend({
24992508 this . curView = vw ;
25002509 this . curViewName = viewName ;
25012510 this . viewsHash [ viewName ] = vw ;
2511+ if ( this . curView . _updateTitle ) {
2512+ this . curView . _updateTitle ( ) ; // TODO fix: make public?
2513+ } else {
2514+ //TODO better way
2515+ $ ( this . options . titleSelector ) . html ( this . curView . getTitle ( ) ) ;
2516+ }
25022517 }
25032518 }
2504- this . setButtons ( viewName ) ;
2519+ this . setMode ( viewName ) ;
25052520 return this ;
25062521 } ,
25072522
@@ -2519,7 +2534,7 @@ Evol.ViewToolbar = Backbone.View.extend({
25192534 return this . _toolbarButtons ;
25202535 } ,
25212536
2522- setButtons : function ( mode ) {
2537+ setMode : function ( mode ) {
25232538 function oneMany ( showOne , showMany ) {
25242539 Evol . UI . setVisible ( tbBs . ones , showOne ) ;
25252540 Evol . UI . setVisible ( tbBs . manys , showMany ) ;
@@ -2628,7 +2643,7 @@ Evol.ViewToolbar = Backbone.View.extend({
26282643 } else {
26292644 that . model = m ;
26302645 that . _isNew = false ;
2631- that . setButtons ( 'edit' ) ;
2646+ that . setMode ( 'edit' ) ;
26322647 vw . setModel ( m ) ;
26332648 }
26342649 vw . _updateTitle ( ) ;
@@ -2642,7 +2657,7 @@ Evol.ViewToolbar = Backbone.View.extend({
26422657 collec . create ( this . getData ( ) , {
26432658 success : function ( m ) {
26442659 fnSuccess ( m ) ;
2645- that . setMessage ( 'Record saved.' , Evol . i18n . getLabel ( 'status.added' , entityName , vw . getSummary ( ) ) , 'success' ) ;
2660+ that . setMessage ( 'Record saved.' , Evol . i18n . getLabel ( 'status.added' , entityName , vw . getTitle ( ) ) , 'success' ) ;
26462661 } ,
26472662 error :function ( err ) {
26482663 alert ( 'error' ) ;
@@ -2657,7 +2672,7 @@ Evol.ViewToolbar = Backbone.View.extend({
26572672 this . model . save ( '' , '' , {
26582673 success : function ( m ) {
26592674 fnSuccess ( m ) ;
2660- that . setMessage ( 'Record saved.' , Evol . i18n . getLabel ( 'status.updated' , entityName , vw . getSummary ( ) ) , 'success' ) ;
2675+ that . setMessage ( 'Record saved.' , Evol . i18n . getLabel ( 'status.updated' , entityName , vw . getTitle ( ) ) , 'success' ) ;
26612676 } ,
26622677 error :function ( err ) {
26632678 alert ( 'error' ) ;
@@ -2677,12 +2692,12 @@ Evol.ViewToolbar = Backbone.View.extend({
26772692 newItem : function ( ) {
26782693 var vw = this . curView ;
26792694 return vw . clear ( )
2680- . _updateTitle ( Evol . i18n . getLabel ( 'NewItem ' , this . options . uiModel . entity , vw . getSummary ( ) ) ) ;
2695+ . _updateTitle ( Evol . i18n . getLabel ( 'NewEntity ' , this . options . uiModel . entity , vw . getTitle ( ) ) ) ;
26812696 } ,
26822697
26832698 deleteItem : function ( ) {
26842699 var entityName = this . options . uiModel . entity ,
2685- entityValue = this . curView . getSummary ( ) ,
2700+ entityValue = this . curView . getTitle ( ) ,
26862701 delModel = this . curView . model ;
26872702 // TODO good looking msgbox
26882703 if ( delModel && confirm ( Evol . i18n . getLabel ( 'DeleteEntity' , entityName , entityValue ) ) ) {
@@ -2827,11 +2842,11 @@ Evol.ViewExport = Backbone.View.extend({
28272842 toolbar : true ,
28282843 model : null ,
28292844 uiModel : null ,
2845+ many : true ,
28302846 style : 'normal' ,
28312847 prefix : 'tbr'
28322848 } ,
28332849
2834- many : true ,
28352850 viewName : "export" ,
28362851
28372852 initialize : function ( opts ) {
@@ -2973,6 +2988,14 @@ Evol.ViewExport = Backbone.View.extend({
29732988 return this . fields ;
29742989 } ,
29752990
2991+ getTitle : function ( ) {
2992+ if ( this . options . many ) {
2993+ return Evol . i18n . getLabel ( 'export.ExportEntities' , this . options . uiModel . entities ) ;
2994+ } else {
2995+ return Evol . i18n . getLabel ( 'export.ExportEntity' , this . options . uiModel . entity ) ;
2996+ }
2997+ } ,
2998+
29762999 _preview : function ( format ) {
29773000 var h = [ ] ;
29783001 if ( this . model && this . model . collection ) {
0 commit comments