summaryrefslogtreecommitdiffstats
path: root/module/web/static/js/views/fileView.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/views/fileView.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/views/fileView.js')
-rw-r--r--module/web/static/js/views/fileView.js19
1 files changed, 9 insertions, 10 deletions
diff --git a/module/web/static/js/views/fileView.js b/module/web/static/js/views/fileView.js
index a8cac9503..59a26d7c9 100644
--- a/module/web/static/js/views/fileView.js
+++ b/module/web/static/js/views/fileView.js
@@ -1,5 +1,5 @@
-define(['jquery', 'backbone', 'underscore', 'app', 'views/abstract/itemView'],
- function($, Backbone, _, App, ItemView) {
+define(['jquery', 'backbone', 'underscore', 'app', 'utils/apitypes', 'views/abstract/itemView'],
+ function($, Backbone, _, App, Api, ItemView) {
// Renders single file item
return ItemView.extend({
@@ -26,18 +26,17 @@ define(['jquery', 'backbone', 'underscore', 'app', 'views/abstract/itemView'],
var data = this.model.toJSON();
if (data.download) {
var status = data.download.status;
- // TODO: remove hardcoded states
- if (status === 1 || status === 11)
+ if (status === Api.DownloadStatus.Offline || status === Api.DownloadStatus.TempOffline)
data.offline = true;
- else if (status === 7)
- data.failed = true;
- else if (status === 2)
+ else if (status === Api.DownloadStatus.Online)
data.online = true;
- else if (status === 9)
+ else if (status === Api.DownloadStatus.Waiting)
data.waiting = true;
- else if (status === 10)
+ else if (status === Api.DownloadStatus.Downloading)
data.downloading = true;
- else if (status === 5 || status === 6)
+ else if (this.model.isFailed())
+ data.failed = true;
+ else if (this.model.isFinished())
data.finished = true;
}