cartodb-4.42/lib/assets/javascripts/builder/data/organization-assets-collection.js

32 lines
787 B
JavaScript
Raw Normal View History

2024-04-06 13:25:13 +08:00
var Backbone = require('backbone');
var AssetModel = require('./asset-model');
var checkAndBuildOpts = require('builder/helpers/required-opts');
var REQUIRED_OPTS = [
'configModel',
'orgId'
];
module.exports = Backbone.Collection.extend({
model: AssetModel,
url: function (method) {
var baseUrl = this._configModel.get('base_url');
var version = this._configModel.urlVersion('organization-assets', method);
return baseUrl + '/api/' + version + '/organization/' + this._orgId + '/assets';
},
initialize: function (models, opts) {
checkAndBuildOpts(opts, REQUIRED_OPTS, this);
},
deselectAll: function (m) {
this.each(function (mdl) {
if (mdl !== m && mdl.get('state') === 'selected') {
mdl.set('state', '');
}
});
}
});