* All apps/customfields:

Fix customfields options with multiple negated fields and single custom field
Specify css class on customfield's row with named as field's id, in order to be able to customize its style
This commit is contained in:
Hadi Nategh
2015-04-01 12:29:20 +00:00
parent 8af7a8a6b8
commit 02e525b95f
3 changed files with 31 additions and 20 deletions

View File

@ -53,7 +53,7 @@ var et2_customfields_list = et2_valueWidget.extend([et2_IDetachedDOM, et2_IInput
}
},
legacyOptions: ["type_filter","private"], // Field restriction & private done server-side
legacyOptions: ["type_filter","private", "fields"], // Field restriction & private done server-side
prefix: '#',
@ -189,7 +189,8 @@ var et2_customfields_list = et2_valueWidget.extend([et2_IDetachedDOM, et2_IInput
{
var row = jQuery(document.createElement("tr"))
.appendTo(this.tbody);
.appendTo(this.tbody)
.addClass(this.id+'_'+id);
var cf = jQuery(document.createElement("td"))
.appendTo(row);
if(!field.type) field.type = 'text";'
@ -286,15 +287,22 @@ var et2_customfields_list = et2_valueWidget.extend([et2_IDetachedDOM, et2_IInput
// Set the value for this element
var contentMgr = this.getArrayMgr("content");
if (contentMgr != null) {
var val = contentMgr.getEntry(this.id);
var val = contentMgr.getEntry(this.id);
_attrs["value"] = {};
if (val !== null)
{
// Only set the values that match desired custom fields
for(var key in val)
if(this.id.indexOf(this.prefix) === 0 && data.fields[this.id.replace(this.prefix,'')] === true)
{
if(key.indexOf(this.prefix) == 0) {
_attrs["value"][key] = val[key];
_attrs['value'][this.id] = val;
}
else
{
// Only set the values that match desired custom fields
for(var key in val)
{
if(key.indexOf(this.prefix) == 0) {
_attrs["value"][key] = val[key];
}
}
}
//_attrs["value"] = val;