public/js/models/Snippet.js
// Show or hide fields based on their 'has_*' counterparts
Show or hide fields based on their 'has_*' counterparts
Show or hide fields based on their ' has_ * ' counterparts
function updateUI(){
				Ext.each(toggleFields, function(fieldName){
					form.findField(fieldName).setVisible(rec.data['has_' + fieldName] == '1');
				});
				[''].concat(LANGUAGES).forEach(function(lang) {
					var key = 'ImagePreview_image_id' + (lang ? '_' + lang : '');
					if (formPanel[key]) {
						formPanel[key].setVisible(rec.data.has_image == 1);
					}
				});
				if (typeof rec.data.variables !== 'undefined' && form.findField('variables')) {
					form.findField('variables').setVisible(rec.data.variables && rec.data.variables.length);
				}
			}
function updateUI ( ) { Ext . each ( toggleFields , function ( fieldName ) { form . findField ( fieldName ) . setVisible ( rec . data [ 'has_' + fieldName ] == '1' ) ; } ) ; [ '' ] . concat ( LANGUAGES ) . forEach ( function ( lang ) { var key = 'ImagePreview_image_id' + ( lang ? '_' + lang : '' ) ; if ( formPanel [ key ] ) { formPanel [ key ] . setVisible ( rec . data . has_image == 1 ) ; } } ) ; if ( typeof rec . data . variables !== 'undefined' && form . findField ( 'variables' ) ) { form . findField ( 'variables' ) . setVisible ( rec . data . variables && rec . data . variables . length ) ; } }
Show or hide fields based on their 'has_*' counterparts
Show or hide fields based on their ' has_ * ' counterparts
//var el = form.findField(fieldName).getEl().up('div.x-form-item'); //el.setVisibilityMode(Ext.Element.DISPLAY).setVisible(rec.data['has_' + fieldName] == '1'); // because imagePreview_image_id is not a formField but a button, we cannot find it with form.findField():