summaryrefslogtreecommitdiffstats
path: root/module/web/static/js/models/File.js
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2013-03-04 13:03:25 +0100
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2013-03-04 13:03:25 +0100
commitef0a09ceb334f1d1f05ad790e570ef0cdaaa3c52 (patch)
treee2f7b1e1f16298d35b18d705bb2c1d7b406d846b /module/web/static/js/models/File.js
parentmore responsive file listing, scales for smaller screen sizes (diff)
downloadpyload-ef0a09ceb334f1d1f05ad790e570ef0cdaaa3c52.tar.xz
functions to render file status, only simple coloring for now
Diffstat (limited to 'module/web/static/js/models/File.js')
-rw-r--r--module/web/static/js/models/File.js18
1 files changed, 17 insertions, 1 deletions
diff --git a/module/web/static/js/models/File.js b/module/web/static/js/models/File.js
index e965df9df..42275a452 100644
--- a/module/web/static/js/models/File.js
+++ b/module/web/static/js/models/File.js
@@ -1,4 +1,8 @@
-define(['jquery', 'backbone', 'underscore'], function($, Backbone, _) {
+define(['jquery', 'backbone', 'underscore', 'utils/apitypes'], function($, Backbone, _, Api) {
+
+ var Finished = [Api.DownloadStatus.Finished, Api.DownloadStatus.Skipped];
+ var Failed = [Api.DownloadStatus.Failed, Api.DownloadStatus.Aborted, Api.DownloadStatus.TempOffline, Api.DownloadStatus.Offline];
+ // Unfinished - Other
return Backbone.Model.extend({
@@ -45,6 +49,18 @@ define(['jquery', 'backbone', 'underscore'], function($, Backbone, _) {
isDownload : function() {
return this.has('download');
+ },
+
+ isFinished: function() {
+ return _.indexOf(Finished, this.get('download').status) > -1;
+ },
+
+ isUnfinished: function() {
+ return _.indexOf(Finished, this.get('download').status) === -1 && _.indexOf(Failed, this.get('download').status) === -1;
+ },
+
+ isFailed: function() {
+ return _.indexOf(Failed, this.get('download').status) > -1;
}
});