* fix: multi lines and spaces issues * fix: eslint operator-linebreak issue * fix: eslint quotes issue * fix: remaining quotes issues * fix: eslint object curly newline issue * fix: eslint object curly spacing issue * fix: eslint brace-style issues * fix: react jsx indent and props issues * fix: eslint trailing spaces issues * fix: eslint linbreak style issue * fix: eslint space unary operator issue * fix: eslint line around directives issue * fix: void and typeof space unary ops issue
15 lines
499 B
JavaScript
15 lines
499 B
JavaScript
define(['backbone', 'js/models/chapter'], function(Backbone, ChapterModel) {
|
|
var ChapterCollection = Backbone.Collection.extend({
|
|
model: ChapterModel,
|
|
comparator: 'order',
|
|
nextOrder: function() {
|
|
if (!this.length) { return 1; }
|
|
return this.last().get('order') + 1;
|
|
},
|
|
isEmpty: function() {
|
|
return this.length === 0 || this.every(function(m) { return m.isEmpty(); });
|
|
}
|
|
});
|
|
return ChapterCollection;
|
|
});
|