@@ -151,7 +151,7 @@ Evol.ViewOne = Backbone.View.extend({
151151 } ) ;
152152 }
153153 if ( skipReadOnlyFields ) {
154- _ . each ( this . getFields ( ) , function ( f ) {
154+ _ . each ( fs , function ( f ) {
155155 if ( f . readonly ) {
156156 delete vs [ f . id ] ;
157157 }
@@ -162,16 +162,15 @@ Evol.ViewOne = Backbone.View.extend({
162162
163163 setData : function ( model , isModel ) {
164164 if ( ! _ . isUndefined ( model ) && model !== null ) {
165- var fs = this . getFields ( ) ,
166- that = this ,
165+ var that = this ,
167166 fTypes = Evol . Dico . fieldTypes ,
168167 $f , fv ,
169168 prefix = '#' + this . prefix + '-' ,
170169 subCollecs = this . getSubCollecs ( ) ,
171170 iconsPath = this . options . iconsPath || '' ,
172171 newPix ;
173172
174- _ . each ( fs , function ( f ) {
173+ _ . each ( this . getFields ( ) , function ( f ) {
175174 $f = that . $ ( prefix + f . id ) ;
176175 if ( isModel ) {
177176 if ( f . value ) {
@@ -183,28 +182,19 @@ Evol.ViewOne = Backbone.View.extend({
183182 fv = model [ f . attribute || f . id ] ;
184183 }
185184 if ( f . readonly ) {
186- if ( f . type === fTypes . pix ) {
187- newPix = ( fv ) ?( '<img src="' + iconsPath + fv + '" class="img-thumbnail">' ) :( '<p class="">' + Evol . i18n . nopix + '</p>' ) ;
188- $f . val ( fv )
189- . prev ( ) . remove ( ) ;
190- $f . before ( newPix ) ;
191- } else {
192- switch ( f . type ) {
193- case fTypes . lov :
194- case fTypes . bool :
195- case fTypes . email :
196- case fTypes . url :
197- $f . html ( Evol . Dico . HTMLField4Many ( f , fv , Evol . hashLov , iconsPath ) ) ;
198- break ;
199- case fTypes . pix :
200- $f . html ( ( fv ) ?( '<img src="' + iconsPath + fv + '" class="img-thumbnail">' ) :( '<p>' + Evol . i18n . nopix + '</p>' ) ) ;
201- break ;
202- case fTypes . textml :
203- $f . html ( Evol . UI . cr2br ( fv ) ) ;
204- break ;
205- default :
206- $f . text ( Evol . Dico . HTMLField4Many ( f , fv , Evol . hashLov , iconsPath ) || ' ' ) ;
207- }
185+ switch ( f . type ) {
186+ case fTypes . pix :
187+ newPix = ( fv ) ?( '<img src="' + iconsPath + fv + '" class="img-thumbnail">' ) :( '<p class="">' + Evol . i18n . nopix + '</p>' ) ;
188+ $f . val ( fv )
189+ . prev ( ) . remove ( ) ;
190+ $f . before ( newPix ) ;
191+ //$f.html((fv)?('<img src="'+iconsPath+fv+'" class="img-thumbnail">'):('<p>'+Evol.i18n.nopix+'</p>'));
192+ break ;
193+ case fTypes . textml :
194+ $f . html ( Evol . UI . cr2br ( fv ) ) ;
195+ break ;
196+ default :
197+ $f . text ( Evol . Dico . HTMLField4Many ( f , _ . isUndefined ( fv ) ?'' :fv , Evol . hashLov , iconsPath ) + ' ' ) ;
208198 }
209199 } else {
210200 switch ( f . type ) {
@@ -262,16 +252,15 @@ Evol.ViewOne = Backbone.View.extend({
262252 } ,
263253
264254 clear : function ( ) {
265- var ft = Evol . Dico . fieldTypes ,
266- fs = this . getFields ( ) ,
267- that = this ,
255+ var that = this ,
256+ ft = Evol . Dico . fieldTypes ,
268257 $f ,
269258 prefix = '#' + that . prefix + '-' ,
270259 subCollecs = this . getSubCollecs ( ) ,
271260 defaultVal ;
272261
273262 this . clearMessages ( ) ;
274- _ . each ( fs , function ( f ) {
263+ _ . each ( this . getFields ( ) , function ( f ) {
275264 $f = that . $ ( prefix + f . id ) ;
276265 defaultVal = f . defaultvalue || '' ;
277266 switch ( f . type ) {
@@ -425,7 +414,7 @@ Evol.ViewOne = Backbone.View.extend({
425414 iTab = - 1 ,
426415 iPanel = - 1 ,
427416 elems = this . uiModel . elements ,
428- iMax = elems . length ;
417+ iMax1 = elems . length - 1 ;
429418
430419 h . push ( '<div class="evo-one-' , mode , '">' ) ;
431420 _ . each ( elems , function ( p , idx ) {
@@ -442,7 +431,7 @@ Evol.ViewOne = Backbone.View.extend({
442431 iTab ++ ;
443432 h . push ( '<div id="evol-tab-' , idx , '" class="tab-pane' , ( idx === 1 ? ' active">' : '">' ) ) ;
444433 that . renderTab ( h , p , mode ) ;
445- if ( iTab == iMax - 1 ) {
434+ if ( iTab == iMax1 ) {
446435 h . push ( '</div>' ) ;
447436 }
448437 } else {
0 commit comments