mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2026-04-26 23:06:43 -04:00
File Browser
New: File Browser to navigate to folders when choosing paths
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'jquery',
|
||||
'backbone',
|
||||
'Shared/FileBrowser/FileBrowserModel'
|
||||
], function ($, Backbone, FileBrowserModel) {
|
||||
|
||||
return Backbone.Collection.extend({
|
||||
model: FileBrowserModel,
|
||||
url : window.NzbDrone.ApiRoot + '/filesystem',
|
||||
|
||||
parse: function(response) {
|
||||
var contents = [];
|
||||
|
||||
if (response.parent || response.parent === '') {
|
||||
|
||||
var type = 'parent';
|
||||
var name = '...';
|
||||
|
||||
if (response.parent === '') {
|
||||
type = 'computer';
|
||||
name = 'My Computer';
|
||||
}
|
||||
|
||||
contents.push({
|
||||
type : type,
|
||||
name : name,
|
||||
path : response.parent
|
||||
});
|
||||
}
|
||||
|
||||
$.merge(contents, response.directories);
|
||||
$.merge(contents, response.files);
|
||||
|
||||
return contents;
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user