+ ${schemaHelpEl}
+ `);
if (this.$parent !== undefined) {
// add listeners for other form elements
$('[data-mapping]', this.$parent).each($.proxy(function(index, el) {
- var formEl = $(el);
- var type = formEl.data('type');
- var mapping = formEl.data('mapping');
+ const formEl = $(el);
+ const type = formEl.data('type');
+ const mapping = formEl.data('mapping');
+
// check the mapping to make sure it's an attribute
// TODO if the data-type is hidden then the attribute should not be modifiable in this widget
if (mapping.indexOf('custom.') === -1 && mapping.indexOf('prop.') === -1) {
- var changeEl;
+ let changeEl;
if (type === 'radio') {
changeEl = $('input', formEl);
} else if (type === 'textbox' || type === 'select') {
@@ -48,7 +47,7 @@ function AttributeWidget(config) {
}
if (changeEl !== undefined) {
changeEl.change($.proxy(function(mapping, e) {
- var dataObj = {};
+ const dataObj = {};
dataObj[mapping] = $(e.target).val();
this.setData(dataObj);
}, this, mapping));
@@ -71,13 +70,13 @@ AttributeWidget.prototype = {
this.isDirty = false;
if (this.showSchemaHelp && tag !== undefined) {
- var helpText = this.w.schemaManager.getDocumentationForTag(tag);
- if (helpText != '') {
- $('.schemaHelp', this.$el).html('
'+tag+' Documentation
'+helpText+'
');
+ let helpText = this.w.schemaManager.getDocumentationForTag(tag);
+ if (helpText !== '') {
+ $('.schemaHelp', this.$el).html(`
${tag} Documentation
${helpText}
`);
}
}
- atts.sort(function(a, b) {
+ atts.sort((a, b) => {
if (a.name > b.name) {
return 1;
} else if (a.name < b.name) {
@@ -86,57 +85,67 @@ AttributeWidget.prototype = {
return 0;
});
- var disallowedAttributes = Mapper.reservedAttributes;
+ const disallowedAttributes = Mapper.reservedAttributes;
// build atts
- var attsString = '';
- var attributeSelector = '';
- var att, currAttString;
- var isRequired = false;
- for (var i = 0; i < atts.length; i++) {
+ let attsString = '';
+ let attributeSelector = '';
+ let att;
+ let currAttString;
+ let isRequired = false;
+
+ for (let i = 0; i < atts.length; i++) {
att = atts[i];
currAttString = '';
isRequired = att.required;
if (disallowedAttributes[att.name] !== true) {
- var displayName = att.name;
+ let displayName = att.name;
if (att.fullName !== '') {
- displayName += ' ('+att.fullName+')';
+ displayName += ` (${att.fullName})`;
+ // displayName += ' ('+att.fullName+')';
}
+
att.defaultValue = '';
- var display = 'block';
- var requiredClass = isRequired ? ' required' : '';
+ let display = 'block';
+ const requiredClass = isRequired ? ' required' : '';
+
if (initialVals[att.name] && initialVals[att.name] !== undefined) {
display = 'block';
- attributeSelector += '