Select folder, show root
This commit is contained in:
@@ -62,13 +62,15 @@ class FileBrowser(Plugin):
|
|||||||
|
|
||||||
def view(self):
|
def view(self):
|
||||||
|
|
||||||
|
path = getParam('path', '/')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
dirs = self.getDirectories(path = getParam('path', '/'), show_hidden = getParam('show_hidden', True))
|
dirs = self.getDirectories(path = path, show_hidden = getParam('show_hidden', True))
|
||||||
except:
|
except:
|
||||||
dirs = []
|
dirs = []
|
||||||
|
|
||||||
return jsonified({
|
return jsonified({
|
||||||
'is_root': getParam('path', '/') == '/',
|
'is_root': path == '/' or not path,
|
||||||
'empty': len(dirs) == 0,
|
'empty': len(dirs) == 0,
|
||||||
'dirs': dirs,
|
'dirs': dirs,
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -702,7 +702,7 @@ Option.Directory = new Class({
|
|||||||
var v = self.input.get('text');
|
var v = self.input.get('text');
|
||||||
var previous_dir = self.getParentDir();
|
var previous_dir = self.getParentDir();
|
||||||
|
|
||||||
if(previous_dir != v && previous_dir.length > 1){
|
if(previous_dir != v && previous_dir.length >= 1 && !json.is_root){
|
||||||
self.back_button.set('data-value', previous_dir)
|
self.back_button.set('data-value', previous_dir)
|
||||||
self.back_button.set('html', '« '+self.getCurrentDirname(previous_dir))
|
self.back_button.set('html', '« '+self.getCurrentDirname(previous_dir))
|
||||||
self.back_button.show()
|
self.back_button.show()
|
||||||
|
|||||||
Reference in New Issue
Block a user