BLD-1110: Create, edit, delete groups.

This commit is contained in:
polesye
2014-07-01 17:41:36 +03:00
parent 602be5e97f
commit fda3f5ac04
24 changed files with 828 additions and 182 deletions

View File

@@ -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 }