Skip to content

Instantly share code, notes, and snippets.

@artknight
Created April 3, 2013 20:59
Show Gist options
  • Save artknight/5305238 to your computer and use it in GitHub Desktop.
Save artknight/5305238 to your computer and use it in GitHub Desktop.
addFieldsToPrepopList: function(){
var mendatoryFields = this.editor.getAssetTabItem().getMainFields().append(this.editor.getAssetTabItem().getLocationFields());
//filter optional fields to match the cookie
var optionalFields = [];
var optionalFieldsCookie = this.getOptionalFieldsCookieValues() || [];
for (var i=0,field; field=this.editor.getAssetTabItem().getCustomFields()[i]; i++){
if (optionalFieldsCookie.contains(field.getDWRField().getCode())){
optionalFields.include(field);
}
}
//combine all fields to be pre-populated
var allFieldsToKeep = mendatoryFields.append(optionalFields);
for (var i=0,field; field=allFieldsToKeep[i]; i++){
console.log(field.getDWRField().getCode());
this.addFieldToPrepopList(field);
}
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment