Skip to content

Commit

Permalink
Revised filetree presentation. Closes #49
Browse files Browse the repository at this point in the history
  • Loading branch information
zebulasampedro committed Jun 22, 2016
1 parent 5ac4606 commit cb6b7b8
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
12 changes: 9 additions & 3 deletions sandstone/apps/filebrowser/posixfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,19 @@ def list_root_paths(**kwargs):

@staticmethod
def get_dir_contents(dirpath):
contents = []
files = []
dirs = []
for i in os.listdir(dirpath):
filepath = os.path.join(dirpath,i)
is_dir = os.path.isdir(filepath)
if is_dir:
filepath = filepath + '/'
contents.append( ( i,filepath,is_dir ) )
return contents
dirs.append(( i,filepath,True ))
else:
files.append( ( i,filepath,False ) )
dirs.sort(key=lambda tup: tup[1])
files.sort(key=lambda tup: tup[1])
return dirs + files

@staticmethod
def get_dir_folders(dirpath):
Expand All @@ -115,6 +120,7 @@ def get_dir_folders(dirpath):
else:
continue
contents.append( ( i,filepath,is_dir ) )
contents.sort(key=lambda tup: tup[1])
return contents

@staticmethod
Expand Down
11 changes: 6 additions & 5 deletions sandstone/apps/filebrowser/tests/python/test_posixfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,16 +221,17 @@ def test_get_dir_contents(self):
contents = PosixFS.get_dir_contents(self.test_dir)
exp_contents = [
(
'testfile.txt',
fp,
False
), (
'testDir',
dp+'/',
True
),
(
'testfile.txt',
fp,
False
)
]
self.assertItemsEqual(contents,exp_contents)
self.assertListEqual(contents,exp_contents)

def test_get_dir_folders(self):
dp = os.path.join(self.test_dir,'testDir')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,9 @@ angular.module('sandstone.filetreedirective', [])
return node.type !== 'dir';
},
injectClasses: {
iExpanded: "filetree-icon fa fa-folder-open",
iCollapsed: "filetree-icon fa fa-folder",
iLeaf: "filetree-icon fa fa-file",
iExpanded: "filetree-icon fa fa-caret-down",
iCollapsed: "filetree-icon fa fa-caret-right",
iLeaf: "filetree-icon fa"
}
};
self.describeSelection = function (node, selected) {
Expand Down

0 comments on commit cb6b7b8

Please sign in to comment.