BLD-1110: Create, edit, delete groups.
This commit is contained in:
@@ -1,13 +1,15 @@
|
||||
define([
|
||||
'backbone', 'gettext', 'backbone.associations'
|
||||
], function(Backbone, gettext) {
|
||||
'backbone', 'underscore', 'underscore.string', 'gettext',
|
||||
'backbone.associations'
|
||||
], function(Backbone, _, str, gettext) {
|
||||
'use strict';
|
||||
var Group = Backbone.AssociatedModel.extend({
|
||||
defaults: function() {
|
||||
return {
|
||||
name: '',
|
||||
version: null
|
||||
};
|
||||
version: null,
|
||||
order: null
|
||||
};
|
||||
},
|
||||
|
||||
isEmpty: function() {
|
||||
@@ -16,13 +18,14 @@ define([
|
||||
|
||||
toJSON: function() {
|
||||
return {
|
||||
id: this.get('id'),
|
||||
name: this.get('name'),
|
||||
version: this.get('version')
|
||||
};
|
||||
},
|
||||
|
||||
validate: function(attrs) {
|
||||
if (!attrs.name) {
|
||||
if (!str.trim(attrs.name)) {
|
||||
return {
|
||||
message: gettext('Group name is required'),
|
||||
attributes: { name: true }
|
||||
|
||||
Reference in New Issue
Block a user