Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
onVisibilityChange: function(newVisibility) {
// reset visibility will also reset the lists to empty
this.setState({
visibility: newVisibility,
imageUsers: new Backbone.Collection(),
activeAccessList: new Backbone.Collection()
});
},
initialize: function(options) {
this.layer_plugins = options.layer_plugins || {};
this.set('baseLayers', new Backbone.Collection());
this.set('overlays', new Backbone.Collection());
var process_layercfg = function(coll, layercfg) {
var layer_plugin = this.layer_plugins[layercfg.type];
if (!layer_plugin) {
return;
}
coll.add(new layer_plugin.model(layercfg));
};
// read defaults from appconfig
_.each(appconfig.baseLayers, _.bind(process_layercfg, this, this.get('baseLayers')));
_.each(appconfig.overlays, _.bind(process_layercfg, this, this.get('overlays')));
}
});
initialize: function() {
this.router = this.options.router;
this.localStorage = this.options.localStorage;
// TODO: Get categories using an API.
this.collection = new Backbone.Collection();
this.template = cdb.templates.getTemplate('new_dashboard/views/categories');
this._initBinds();
},
it('should remove item when removed', function () {
var map = jasmine.createSpyObj('map', ['getViewBounds', 'off']);
map.getViewBounds.and.returnValue([[0, 0], [0, 0]]);
var vis = jasmine.createSpyObj('vis', ['reload']);
var layer = new Backbone.Model();
var dataviewModel = new DataviewModel({source: {id: 'a0'}}, {
map: map,
vis: vis,
analysisCollection: new Backbone.Collection(),
layer: layer
});
this.collection.add(dataviewModel);
expect(this.collection.length).toEqual(1);
this.collection.first().remove();
expect(this.collection.length).toEqual(0);
});
});
beforeEach(function () {
bobunView.collection = new Backbone.Collection([{foo: 'bar'}]);
bobunView.model = new Backbone.Model({foo: 'bar'});
});
__createSelectedCollections() {
const selectedCollection = (this.selectedCollection = new Backbone.Collection());
this.selectedCollection.model = Backbone.Model.extend({
initialize() {
this.selectableCollection = selectedCollection;
_.extend(this, new SelectableBehavior.Selectable(this));
}
});
_.extend(this.selectedCollection, new SelectableBehavior.SingleSelect(this.selectedCollection));
if (this.isButtonLimitMode) {
this.selectedButtonCollection = new Backbone.Collection();
this.selectedPanelCollection = new Backbone.Collection();
}
},
var Backbone = require('backbone');
var fixture = require('./fixture');
var collection = new Backbone.Collection(fixture);
var id = collection.length;
module.exports = function(api) {
api.route('/api/colors')
.get(function(req, res) {
res.json(collection);
})
.post(function(req, res) {
var model = new Backbone.Model(req.body);
model.set('id', ++id);
collection.add(model);
res.json(model);
});
api.route('/api/colors/:id')
getDefaultProps: function() {
return {
licenses: new Backbone.Collection(),
activeLicenses: new Backbone.Collection(),
scripts: new Backbone.Collection(),
activeScripts: new Backbone.Collection()
};
},
onRender: function ()
{
const navLinks = new Backbone.Collection(null, {sorted: false});
this.menuSidenav.show(new MenuSidenavView({collection: navLinks}));
this.header.show(new HeaderView({collection: navLinks}));
}
});
setupSortFieldDropdown() {
this.settingsSortField.show(
new SortItemCollectionView({
collection: new Backbone.Collection(this.model.get('sorts')),
showBestTextOption: true,
})
)
},
setupSrcDropdown() {