cartodb/lib/assets/javascripts/builder/data/group-model.js

30 lines
686 B
JavaScript
Raw Normal View History

2020-06-15 10:58:47 +08:00
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;
}
});