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;
|
|
|
|
this.encrypted = data.encrypted;
|
|
|
|
this.is_repo_owner = data.is_repo_owner;
|
|
|
|
this.is_virtual = data.is_virtual;
|
|
|
|
|
|
|
|
this.dirent_more = data.dirent_more;
|
|
|
|
this.more_start = data.more_start;
|
|
|
|
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;
|
|
|
|
|
|
|
|
});
|