2015-01-20 10:25:10 +00:00
|
|
|
define([
|
|
|
|
'underscore',
|
|
|
|
'backbone',
|
2015-02-03 05:47:22 +00:00
|
|
|
'common',
|
2015-01-20 10:25:10 +00:00
|
|
|
'app/models/dirent'
|
2015-02-03 05:47:22 +00:00
|
|
|
], function(_, Backbone, Common, Dirent) {
|
2015-01-20 10:25:10 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
var DirentCollection = Backbone.Collection.extend({
|
|
|
|
model: Dirent,
|
|
|
|
|
2015-02-03 05:47:22 +00:00
|
|
|
url: function () {
|
|
|
|
return Common.getUrl({name: 'list_lib_dir', repo_id: this.repo_id});
|
|
|
|
},
|
|
|
|
|
2015-01-25 10:47:42 +00:00
|
|
|
initialize: function() {
|
2015-01-20 10:25:10 +00:00
|
|
|
|
2015-01-25 10:47:42 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
parse: function (data) {
|
2015-04-20 06:31:22 +00:00
|
|
|
this.repo_name = data.repo_name;
|
|
|
|
this.user_perm = data.user_perm;
|
2016-09-19 10:24:28 +00:00
|
|
|
this.no_quota = data.no_quota;
|
2015-04-20 06:31:22 +00:00
|
|
|
this.encrypted = data.encrypted;
|
2018-08-10 08:45:20 +00:00
|
|
|
this.repo_owner = data.repo_owner;
|
2015-04-20 06:31:22 +00:00
|
|
|
this.is_repo_owner = data.is_repo_owner;
|
|
|
|
this.is_virtual = data.is_virtual;
|
2016-10-18 05:34:36 +00:00
|
|
|
this.has_been_shared_out = data.has_been_shared_out;
|
2015-04-20 06:31:22 +00:00
|
|
|
this.dirent_more = data.dirent_more;
|
|
|
|
this.more_start = data.more_start;
|
2017-08-30 09:59:14 +00:00
|
|
|
this.is_admin = data.is_admin;
|
2015-04-20 06:31:22 +00:00
|
|
|
return data.dirent_list; // return the array
|
2015-01-25 10:47:42 +00:00
|
|
|
},
|
|
|
|
|
2015-02-06 09:32:02 +00:00
|
|
|
// category: 'my-libs', 'shared-libs'
|
|
|
|
setPath: function(category, repo_id, path) {
|
|
|
|
this.category = category;
|
|
|
|
this.repo_id = repo_id;
|
|
|
|
this.path = path;
|
2015-02-03 05:47:22 +00:00
|
|
|
}
|
2015-01-20 10:25:10 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
return DirentCollection;
|
|
|
|
|
|
|
|
});
|