cartodb-4.42/lib/assets/javascripts/builder/components/modals/add-analysis/analysis-option-models/merge-analysis-option-model.js
2024-04-06 05:25:13 +00:00

25 lines
572 B
JavaScript
Executable File

var _ = require('underscore');
var AnalysisOptionModel = require('./analysis-option-model');
/**
* Custom model for merge type, to set correct primary source
*/
module.exports = AnalysisOptionModel.extend({
/**
* @override {AnalysisOptionModel.getNodeAttrs}
*/
getFormAttrs: function (layerDefModel) {
var attrs = AnalysisOptionModel.prototype.getFormAttrs.apply(this, arguments);
delete attrs.source;
_.extend(attrs, {
primary_source_name: 'left_source',
left_source: layerDefModel.get('source')
});
return attrs;
}
});