Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_initViews: function () {
if (this._widgetFormView) {
this._widgetFormView.remove();
}
this._widgetFormView = new Backbone.Form({
model: this._widgetFormModel
});
this._widgetFormView.bind('change', function () {
var errors = this.commit();
console.log('errors', errors);
});
this.$('.js-content').html(this._widgetFormView.render().$el);
return this;
},
onRender: function() {
var that = this,
model = this.model;
this.form = new Backbone.Form({
model: this.model
}).render();
this.$el.find('.delete').on('click', function() {
that.delete();
});
this.$el.find('.form').prepend(this.form.el);
this.gridUrl = this.collection.url.split('/')[this.collection.url.split('/').length - 1];
},
serializeData: function () {
_initViews: function () {
this._aggrFormModel = new StyleShapeFormModel(
this._styleModel.get('aggregation'),
{
queryGeometryModel: this._queryGeometryModel,
querySchemaModel: this._querySchemaModel,
styleModel: this._styleModel,
configModel: this._configModel,
userModel: this._userModel,
modals: this._modals
}
);
this._aggrFormView = new Backbone.Form({
model: this._aggrFormModel
});
this._aggrFormView.bind('change', function () {
this.commit();
});
this.$('.js-aggregationForm').append(this._aggrFormView.render().el);
},
_genLabelsFormView: function () {
this._labelsFormView = new Backbone.Form({
className: 'Editor-formInner--nested',
model: this._labelsFormModel
});
this._labelsFormView.bind('change', function () {
this.commit();
});
this.$el.append(this._labelsFormView.render().el);
},
render: function () {
this._formView = new Backbone.Form({
model: this._formModel
});
this._formView.bind('change', function () {
this.commit();
});
this.$el.html(this._formView.render().el);
return this;
},
validators: ['required', {
type: 'interval',
min: min,
max: max
}]
};
};
this.model.schema = {
fromHour: generateNumberType(0, 23),
fromMin: generateNumberType(0, 59),
toHour: generateNumberType(0, 23),
toMin: generateNumberType(0, 59)
};
this._datesForm = new Backbone.Form({
model: this.model,
template: datePickerTemplate
});
this._datesForm.bind('change', function () {
this.commit();
});
this.$('.js-timers').append(this._datesForm.render().el);
},
_initViews: function () {
var model = this._widgetFormModel;
var fields = model.getFields();
this._widgetFormView = new Backbone.Form({
template: template,
templateData: {
dataFields: fields.data,
styleFields: fields.style
},
model: model
});
this._widgetFormView.bind('change', function () {
this.commit();
});
this.$el.append(this._widgetFormView.render().$el);
return this;
},
if (this._formView) {
this._formView.remove();
}
this._formModel = new InfowindowFormModel({
width: this._layerInfowindowModel.get('width'),
headerColor: {
color: {
fixed: '#CCC'
}
}
}, {
layerInfowindowModel: this._layerInfowindowModel
});
this._formView = new Backbone.Form({
model: this._formModel
});
this._formView.bind('change', function () {
this.commit();
});
this.$('.js-form').append(this._formView.render().$el);
},
_generateForms: function () {
var self = this;
if (this._formView) {
this._formView.remove();
}
this._formView = new Backbone.Form({
model: this.model
});
this._formView.bind('change', function () {
var validate = this.validate();
self.model.trigger('validate', !!validate);
if (!validate) {
this.commit();
}
});
this.$('.js-form').append(this._formView.render().$el);
},
render: function () {
this.clearSubViews();
this.$el.empty();
this._formView = new Backbone.Form({
model: this._formModel,
trackingClass: 'track-' + this._formModel.get('type') + '-analysis',
template: this._formModel.getTemplate(),
templateData: this._formModel.getTemplateData()
});
this._formView.bind('change', this._onChangeAnalysisFormView, this);
this.$el.append(this._formView.render().el);
return this;
},