From ceb59ee0739546368135b0d86a69b17c92bfbccf Mon Sep 17 00:00:00 2001 From: RaNaN Date: Thu, 20 Dec 2012 15:33:01 +0100 Subject: added models and collections for progress --- module/web/static/js/collections/ProgressList.js | 17 ++++++++++++ module/web/static/js/models/Progress.js | 35 ++++++++++++++++++++++++ module/web/static/js/models/ServerStatus.js | 20 ++++++++++++++ 3 files changed, 72 insertions(+) create mode 100644 module/web/static/js/collections/ProgressList.js create mode 100644 module/web/static/js/models/Progress.js create mode 100644 module/web/static/js/models/ServerStatus.js (limited to 'module/web') diff --git a/module/web/static/js/collections/ProgressList.js b/module/web/static/js/collections/ProgressList.js new file mode 100644 index 000000000..1706d5f16 --- /dev/null +++ b/module/web/static/js/collections/ProgressList.js @@ -0,0 +1,17 @@ +define(['jquery', 'backbone', 'underscore', 'models/Progress'], function($, Backbone, _, Progress) { + + return Backbone.Collection.extend({ + + model: Progress, + + comparator: function(progress) { + return progress.get('eta'); + }, + + initialize: function() { + + } + + }); + +}); \ No newline at end of file diff --git a/module/web/static/js/models/Progress.js b/module/web/static/js/models/Progress.js new file mode 100644 index 000000000..ebbe34862 --- /dev/null +++ b/module/web/static/js/models/Progress.js @@ -0,0 +1,35 @@ +define(['jquery', 'backbone', 'underscore'], function($, Backbone, _) { + + return Backbone.Model.extend({ + +// TODO +// idAttribute: 'fid', + + defaults: { + plugin: null, + name: null, + statusmsg: -1, + eta: -1, + done: -1, + total: -1, + download: null + }, + + + // Model Constructor + initialize: function() { + + }, + + // Any time a model attribute is set, this method is called + validate: function(attrs) { + + }, + + isDownload : function() { + return this.has('download') + } + + }); + +}); \ No newline at end of file diff --git a/module/web/static/js/models/ServerStatus.js b/module/web/static/js/models/ServerStatus.js new file mode 100644 index 000000000..f89282d8d --- /dev/null +++ b/module/web/static/js/models/ServerStatus.js @@ -0,0 +1,20 @@ +define(['jquery', 'backbone', 'underscore'], function($, Backbone, _) { + + return Backbone.Model.extend({ + + defaults: { + queuedDownloads: -1, + totalDownloads: -1, + speed: -1, + pause: false, + download: false, + reconnect: false, + }, + + // Model Constructor + initialize: function() { + + } + + }); +}); \ No newline at end of file -- cgit v1.2.3