Sha256: 1b272e53622d02c7ac0ca2330b5e0c5a88769735e7342e33bc000f7c6f086bf7
Contents?: true
Size: 1.3 KB
Versions: 79
Compression:
Stored size: 1.3 KB
Contents
pageflow.filesCountWatcher = { watchFileCollection: function(name, collection) { this.watchedFileCollectionNames = this.watchedFileCollectionNames || []; this.watchedFileCollectionNames.push(name); this.listenTo(collection, 'change:state', function(model) { this.updateFilesCounts(name, collection); }); this.listenTo(collection, 'add', function() { this.updateFilesCounts(name, collection); }); this.listenTo(collection, 'remove', function() { this.updateFilesCounts(name, collection); }); this.updateFilesCounts(name, collection); }, updateFilesCounts: function(name, collection) { this.updateFilesCount('uploading', name, collection, function(file) { return file.isUploading(); }); this.updateFilesCount('confirmable', name, collection, function(file) { return file.isConfirmable(); }); this.updateFilesCount('pending', name, collection, function(file) { return file.isPending(); }); }, updateFilesCount: function(trait, name, collection, filter) { this.set(trait + '_' + name + '_count', collection.filter(filter).length); this.set(trait + '_files_count', _.reduce(this.watchedFileCollectionNames, function(sum, name) { return sum + this.get(trait + '_' + name + '_count'); }, 0, this)); } };
Version data entries
79 entries across 79 versions & 1 rubygems