diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2013-03-20 21:39:30 +0100 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2013-03-20 21:39:30 +0100 |
commit | 63cef4c7d641ffddaeabcd768020674e2681ba05 (patch) | |
tree | 10b9ee50b927a7673d93db15b896a15a1012f482 /module/web/static/js/models/Package.js | |
parent | added ReadWrite lock, render file progress on dashboard (diff) | |
download | pyload-63cef4c7d641ffddaeabcd768020674e2681ba05.tar.xz |
improved ui, render waiting files
Diffstat (limited to 'module/web/static/js/models/Package.js')
-rw-r--r-- | module/web/static/js/models/Package.js | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/module/web/static/js/models/Package.js b/module/web/static/js/models/Package.js index ba024381e..0b9efca10 100644 --- a/module/web/static/js/models/Package.js +++ b/module/web/static/js/models/Package.js @@ -1,5 +1,5 @@ -define(['jquery', 'backbone', 'underscore', 'collections/FileList', 'require'], - function($, Backbone, _, FileList, require) { +define(['jquery', 'backbone', 'underscore', 'app', 'collections/FileList', 'require'], + function($, Backbone, _, App, FileList, require) { return Backbone.Model.extend({ @@ -34,18 +34,20 @@ define(['jquery', 'backbone', 'underscore', 'collections/FileList', 'require'], // Changes url + method and delegates call to super class fetch: function(options) { - options || (options = {}); - options.url = 'api/getFileTree/' + this.get('pid') + '/false'; - options.type = "post"; + options = App.apiRequest( + 'getFileTree/' + this.get('pid'), + {full: false}, + options); return Backbone.Model.prototype.fetch.call(this, options); }, // Create a pseudo package und use search to populate data search: function(qry, options) { - options || (options = {}); - options.url = 'api/findFiles/"' + qry + '"'; - options.type = "post"; + options = App.apiRequest( + 'findFiles', + {pattern: qry}, + options); return Backbone.Model.prototype.fetch.call(this, options); }, @@ -55,18 +57,24 @@ define(['jquery', 'backbone', 'underscore', 'collections/FileList', 'require'], }, destroy: function(options) { - options || (options = {}); - // TODO: as post data - options.url = 'api/deletePackages/[' + this.get('pid') + ']'; - options.type = "post"; + // TODO: Not working when using data?, array seems to break it + options = App.apiRequest( + 'deletePackages/[' + this.get('pid') + ']', + null, options); + options.method = 'post'; + + console.log(options); return Backbone.Model.prototype.destroy.call(this, options); }, restart: function(options) { - options || (options = {}); + options = App.apiRequest( + 'restartPackage', + {pid: this.get('pid')}, + options); + var self = this; - options.url = 'api/restartPackage/' + this.get('pid'); options.success = function() { self.fetch(); }; |