@@ -192,7 +192,7 @@ return Backbone.View.extend({
192192 $f . html ( uiInput . colorBox ( f . id , fv , fv ) ) ;
193193 break ;
194194 case fts . json :
195- $f . val ( Evol . Format . jsonString ( fv , true ) ) ;
195+ $f . val ( Evol . Format . jsonString ( fv , false ) ) ;
196196 break ;
197197 default :
198198 $f . text ( eDico . fieldHTML_RO ( f , _ . isUndefined ( fv ) ?'' :fv , Evol . hashLov , iconsPath ) + ' ' ) ;
@@ -726,11 +726,15 @@ return Backbone.View.extend({
726726 fv = ( mode !== 'new' ) ? this . model . get ( f . id ) : f . defaultValue || '' ;
727727 }
728728 if ( f . type === fts . formula ) {
729- h . push ( Evol . Dico . HTMLFieldLabel ( f , mode || 'edit' ) +
730- dom . input . formula ( this . fieldViewId ( f . id ) , f , this . model ) ) ;
731- } else if ( f . type === fts . json && mode === 'browse' ) {
732- h . push ( Evol . Dico . HTMLFieldLabel ( f , mode ) +
733- dom . input . textM ( this . fieldViewId ( f . id ) , Evol . Format . jsonString ( fv , false ) , f . maxLen , f . height , true ) ) ;
729+ if ( ! skipLabel ) {
730+ h . push ( Evol . Dico . HTMLFieldLabel ( f , mode || 'edit' ) ) ;
731+ }
732+ h . push ( dom . input . formula ( this . fieldViewId ( f . id ) , f , this . model ) ) ;
733+ } else if ( f . type === fts . json && ( mode === 'browse' || f . readOnly ) ) {
734+ if ( ! skipLabel ) {
735+ h . push ( Evol . Dico . HTMLFieldLabel ( f , mode ) ) ;
736+ }
737+ h . push ( dom . input . textM ( this . fieldViewId ( f . id ) , Evol . Format . jsonString ( fv , false ) , f . maxLen , f . height , true ) ) ;
734738 } else {
735739 h . push ( eDico . fieldHTML ( f , this . fieldViewId ( f . id ) , fv , mode , iconsPath , skipLabel ) ) ;
736740 }
@@ -752,7 +756,11 @@ return Backbone.View.extend({
752756 setTitle : function ( title ) {
753757 var bdg = this . uiModel . fnBadge ;
754758 if ( bdg ) {
755- bdg = bdg ( this . model ) ;
759+ if ( _ . isString ( bdg ) ) {
760+ bdg = this . model . escape ( bdg ) || '' ;
761+ } else {
762+ bdg = bdg ( this . model ) ;
763+ }
756764 }
757765 return eDico . setViewTitle ( this , title , bdg ) ;
758766 } ,
@@ -776,7 +784,7 @@ return Backbone.View.extend({
776784 scInvalid = 0 ;
777785 _ . each ( scData , function ( rowData , idx ) {
778786 _ . each ( sc . elements , function ( f ) {
779- if ( that . validateField ( f , rowData [ f . id ] . substring ( 0 , 10 ) ) ) {
787+ if ( that . validateField ( f , f . type === 'date' ? rowData [ f . id ] . substring ( 0 , 10 ) : rowData [ f . id ] ) ) {
780788 trs . eq ( idx ) . find ( '#' + f . id ) . parent ( ) . addClass ( 'has-error' ) ;
781789 scInvalid ++ ;
782790 }
0 commit comments