projects
/
civicrm-core.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix menu restore link
[civicrm-core.git]
/
js
/
model
/
crm.designer.js
diff --git
a/js/model/crm.designer.js
b/js/model/crm.designer.js
index 729778ae6a4775a68208972aaca89551eed7cb01..752cf86415c8fb75292ce486a7400b7ccc2341c7 100644
(file)
--- a/
js/model/crm.designer.js
+++ b/
js/model/crm.designer.js
@@
-1,5
+1,4
@@
-(function($) {
- var CRM = (window.CRM) ? (window.CRM) : (window.CRM = {});
+(function($, _) {
if (!CRM.Designer) CRM.Designer = {};
// TODO Optimize this class
if (!CRM.Designer) CRM.Designer = {};
// TODO Optimize this class
@@
-71,7
+70,9
@@
label: this.getLabel(),
entity_name: this.get('entityName'),
field_type: this.getFieldSchema().civiFieldType,
label: this.getLabel(),
entity_name: this.get('entityName'),
field_type: this.getFieldSchema().civiFieldType,
- field_name: this.get('fieldName')
+ // For some reason the 'formatting' field gets a random number appended in core so we mimic that here.
+ // TODO: Why?
+ field_name: this.get('fieldName') == 'formatting' ? 'formatting_' + (Math.floor(Math.random() * 8999) + 1000) : this.get('fieldName')
});
return model;
}
});
return model;
}
@@
-96,6
+97,9
@@
* @return {CRM.Designer.PaletteFieldModel}
*/
getFieldByName: function(entityName, fieldName) {
* @return {CRM.Designer.PaletteFieldModel}
*/
getFieldByName: function(entityName, fieldName) {
+ if (fieldName.indexOf('formatting') === 0) {
+ fieldName = 'formatting';
+ }
return this.find(function(paletteFieldModel) {
return ((!entityName || paletteFieldModel.get('entityName') == entityName) && paletteFieldModel.get('fieldName') == fieldName);
});
return this.find(function(paletteFieldModel) {
return ((!entityName || paletteFieldModel.get('entityName') == entityName) && paletteFieldModel.get('fieldName') == fieldName);
});
@@
-114,4
+118,4
@@
return fieldsByEntitySection;
}
});
return fieldsByEntitySection;
}
});
-})(
cj
);
+})(
CRM.$, CRM._
);