Resolved a typo in the backform.pgadmin.js, while extending the

Backform.Control.prototype.render(..) function.
This commit is contained in:
Ashesh Vashi 2016-01-04 19:27:51 +05:30
parent ec7e98e6a7
commit cd40a07ac3

View File

@ -161,41 +161,40 @@
* values properly. * values properly.
*/ */
Backform.Control.prototype.render = function() { Backform.Control.prototype.render = function() {
render: function() { var field = _.defaults(this.field.toJSON(), this.defaults),
var field = _.defaults(this.field.toJSON(), this.defaults), attributes = this.model.toJSON(),
attributes = this.model.toJSON(), attrArr = field.name.split('.'),
attrArr = field.name.split('.'), name = attrArr.shift(),
name = attrArr.shift(), path = attrArr.join('.'),
path = attrArr.join('.'), rawValue = this.keyPathAccessor(attributes[name], path),
rawValue = this.keyPathAccessor(attributes[name], path), data = _.extend(field, {
data = _.extend(field, { rawValue: rawValue,
rawValue: rawValue, value: this.formatter.fromRaw(rawValue, this.model),
value: this.formatter.fromRaw(rawValue, this.model), attributes: attributes,
attributes: attributes, formatter: this.formatter
formatter: this.formatter }),
}), evalF = function(f, d, m) {
evalF = function(f, d, m) { return (_.isFunction(f) ? !!f.apply(d, [m]) : !!f);
return (_.isFunction(f) ? !!f.apply(d, [m]) : !!f); };
};
// Evaluate the disabled, visible, and required option // Evaluate the disabled, visible, and required option
_.extend(data, { _.extend(data, {
disabled: evalF(data.disabled, data, this.model), disabled: evalF(data.disabled, data, this.model),
visible: evalF(data.visible, data, this.model), visible: evalF(data.visible, data, this.model),
required: evalF(data.required, data, this.model) required: evalF(data.required, data, this.model)
}); });
// Clean up first // Clean up first
this.$el.removeClass(Backform.hiddenClassname); this.$el.removeClass(Backform.hiddenClassname);
if (!data.visible) if (!data.visible)
this.$el.addClass(Backform.hiddenClassname); this.$el.addClass(Backform.hiddenClassname);
this.$el.html(this.template(data)).addClass(field.name); this.$el.html(this.template(data)).addClass(field.name);
this.updateInvalid(); this.updateInvalid();
return this; return this;
}; };
/* /*
* Overriding the render function of the select control to allow us to use * Overriding the render function of the select control to allow us to use