summaryrefslogtreecommitdiffstats
path: root/module/web/static/js/models/Package.js
diff options
context:
space:
mode:
Diffstat (limited to 'module/web/static/js/models/Package.js')
-rw-r--r--module/web/static/js/models/Package.js52
1 files changed, 52 insertions, 0 deletions
diff --git a/module/web/static/js/models/Package.js b/module/web/static/js/models/Package.js
new file mode 100644
index 000000000..e5b0dc5a7
--- /dev/null
+++ b/module/web/static/js/models/Package.js
@@ -0,0 +1,52 @@
+define(['jquery', 'backbone', 'underscore'], function($, Backbone, _) {
+
+ return Backbone.Model.extend({
+
+ idAttribute: 'pid',
+
+ defaults: {
+ pid: -1,
+ name : null,
+ folder: "",
+ root: -1,
+ owner: -1,
+ site: "",
+ comment: "",
+ password: "",
+ added: -1,
+ status: -1,
+ packageorder: -1,
+ stats: null,
+ fids: null,
+ pids: null,
+ files: null, // Collection
+ packs: null // Collection
+ },
+
+ // Model Constructor
+ initialize: function() {
+
+ },
+
+ // Changes url + method and delegates call to super class
+ fetch: function(options) {
+ options || (options = {});
+ options.url = 'api/getPackageInfo/' + this.get('pid');
+ options.type = "post";
+
+ return Backbone.Model.prototype.fetch.call(options);
+
+ },
+
+ save: function(options) {
+ // TODO
+ },
+
+ // Any time a model attribute is set, this method is called
+ validate: function(attrs) {
+
+ }
+
+ });
+
+}); \ No newline at end of file