Initial commit
This commit is contained in:
29
lib/assets/javascripts/builder/data/group-model.js
Executable file
29
lib/assets/javascripts/builder/data/group-model.js
Executable file
@@ -0,0 +1,29 @@
|
||||
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;
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user