cartodb-4.42/lib/assets/javascripts/builder/data/group-model.js
2024-04-06 05:25:13 +00:00

30 lines
686 B
JavaScript
Executable File

var Backbone = require('backbone');
var UsersGroup = require('./users-group-collection');
/**
* Model representing a group.
* Expected to be used in the context of a groups collection (e.g. OrganizationGroups),
* which defines its API endpoint path.
*/
module.exports = Backbone.Model.extend({
defaults: {
display_name: ''
},
initialize: function (attrs, opts) {
this.parse(attrs || {}, opts); // handle given attrs in the same way as for .fetch()
},
parse: function (attrs, opts) {
this.users = new UsersGroup(attrs.users, {
group: this,
configModel: opts.configModel,
organization: opts.organization
});
return attrs;
}
});