Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
initialize: function(opts) {
this.parent_fsm = opts.fsm;
this.node = opts.node;
this.model = new Backbone.Model(this.node);
this.model.set("creation_url", null);
// Since template uses states, rerender on new state
this.fsm.onChange(this.render);
this.fsm.onChange(function (state) {
console.log("RESERVATION went into state", state);
});
},
initialize: function (opts) {
checkAndBuildOpts(opts, REQUIRED_OPTS, this);
this._imageEnabled = opts.imageEnabled;
this._hideTabs = opts.hideTabs;
this.listenTo(this.model, 'change:attribute', this._fetchColumns);
this._viewModel = new Backbone.Model({
step: 0,
status: 'idle'
});
this.listenTo(this._viewModel, 'change:status', this.render);
// If it comes from a quantification change
if (this.model.hasChanged('quantification') && this.model.get('quantification') === 'category') {
this._fetchColumns();
}
},
var map = {
'trade-area': ['source'],
'estimated-population': ['source'],
'sql-function': ['source', 'target']
};
return map[analysisType];
},
getParamNamesForAnalysisType: function (analysisType) {
var map = {
'trade-area': ['kind', 'time'],
'estimated-population': ['columnName']
};
return map[analysisType];
}
};
this.vis = new Backbone.Model();
this.analysisCollection = new Backbone.Collection();
this.analysisFactory = new AnalysisFactory({
camshaftReference: this.fakeCamshaftReference,
analysisCollection: this.analysisCollection,
vis: this.vis
});
});
beforeEach(function () {
this.container = $("<div id="map">").css('height', '1000px');
$('body').append(this.container);
var map = new Map(null, { layersFactory: {} });
this.mapView = new LeafletMapView({
el: $('#map'),
mapModel: map,
engine: new Backbone.Model(),
layerViewFactory: jasmine.createSpyObj('layerViewFactory', ['createLayerView']),
layerGroupModel: new Backbone.Model()
});
this.mapView.render();
this.layerView = new Backbone.View();
this.tooltipModel = new TooltipModel({
template: '{{#fields}}{{{ value }}},{{/fields}}'
});
this.tooltipView = new TooltipView({
model: this.tooltipModel,
layerView: this.layerView,
mapView: this.mapView
});
});
</div>
beforeEach(function () {
this.container = $("<div id="map">").css('height', '1000px');
$('body').append(this.container);
var map = new Map(null, { layersFactory: {} });
this.mapView = new LeafletMapView({
el: $('#map'),
mapModel: map,
engine: new Backbone.Model(),
layerViewFactory: jasmine.createSpyObj('layerViewFactory', ['createLayerView']),
layerGroupModel: new Backbone.Model()
});
this.mapView.render();
this.layerView = new Backbone.View();
this.tooltipModel = new TooltipModel({
template: '{{#fields}}{{{ value }}},{{/fields}}'
});
this.tooltipView = new TooltipView({
model: this.tooltipModel,
layerView: this.layerView,
mapView: this.mapView
});
});
</div>
_.each(this.model.get('configs'),function(value, name){
var configObj = _.findWhere(this.rangerServiceDefModel.get('configs'),{'name' : name });
if(!_.isUndefined(configObj) && configObj.type == 'bool'){
this.model.set(name, this.getStringFromBoolean(configObj, value))
} else {
this.model.set(name, value)
if(_.isUndefined(configObj)){
this.extraConfigColl.add(new Backbone.Model({'name' : name, 'value' : value}))
}
}
},this);
}
_initModels: function () {
this._infoboxModel = new InfoboxModel({
state: this._isLayerHidden()
? 'layer-hidden'
: ''
});
this._layerDefinitionModel.canBeGeoreferenced()
.then(function (canBeGeoreferenced) {
if (!this._isLayerHidden() && canBeGeoreferenced) {
this._infoboxModel.set('state', 'georeference');
}
}.bind(this));
this._overlayModel = new Backbone.Model({
visible: this._isLayerHidden()
});
this._applyButtonStatusModel = new Backbone.Model({
loading: false
});
this._togglerModel = new Backbone.Model({
labels: [_t('editor.data.data-toggle.values'), _t('editor.data.data-toggle.cartocss')],
active: this._editorModel.isEditing(),
disabled: this._editorModel.isDisabled(),
tooltip: _t('editor.data.data-toggle.tooltip')
});
},
beforeEach(function () {
model = new Backbone.Model({
axesOptions: servicesController.serviceAxes.axes
});
collection = new ServicesCollection([{
title: 'Prescriptions: prepayment certificates issued',
department: {
title: 'Department of Health',
abbr: 'DH'
},
agency: {
title: 'NHS Business Services Authority',
abbr: 'NHSBSA'
},
completion_rate: 0.4,
number_of_transactions: 2000,
digital_takeup: 0
initialize: function (opts) {
checkAndBuildOpts(opts, REQUIRED_OPTS, this);
this._clearSQLModel = new Backbone.Model({
visible: false
});
this._sqlModel = this._layerDefinitionModel.sqlModel;
this._SQL = new cdb.SQL({
user: this._configModel.get('user_name'),
sql_api_template: this._configModel.get('sql_api_template'),
api_key: this._configModel.get('api_key')
});
this._codemirrorModel = new Backbone.Model({
content: this._querySchemaModel.get('query'),
readonly: false
});
SQLNotifications.track(this);
},
var createFakeDataviewLayer = function (attrs) {
return new Backbone.Model(attrs);
};