mirror of https://github.com/keeweb/keeweb.git
27 lines
697 B
JavaScript
27 lines
697 B
JavaScript
'use strict';
|
|
|
|
var Backbone = require('backbone'),
|
|
FileModel = require('../models/file-model');
|
|
|
|
var FileCollection = Backbone.Collection.extend({
|
|
model: FileModel,
|
|
|
|
hasOpenFiles: function() {
|
|
return this.some(function(file) { return file.get('open'); });
|
|
},
|
|
|
|
hasUnsavedFiles: function() {
|
|
return this.some(function(file) { return file.get('modified'); });
|
|
},
|
|
|
|
hasDirtyFiles: function() {
|
|
return this.some(function(file) { return file.get('dirty'); });
|
|
},
|
|
|
|
getByName: function(name) {
|
|
return this.find(function(file) { return file.get('name').toLowerCase() === name.toLowerCase(); });
|
|
}
|
|
});
|
|
|
|
module.exports = FileCollection;
|