@@ -84,6 +84,7 @@ define([
84
84
this . currentFileList = [ ] ;
85
85
86
86
this . pathState = {
87
+ parentPath : '' ,
87
88
currentPath : '' ,
88
89
baseFolder : '' , // root folder name
89
90
relativeDir : '' , // root folder name
@@ -257,9 +258,24 @@ define([
257
258
let fileList = this . currentFileList ;
258
259
// clear body
259
260
$ ( this . wrapSelector ( '.fileNavigationPage-body' ) ) . html ( '' ) ;
261
+
260
262
// render file items
261
263
let dirArr = [ ] ;
262
264
let fileArr = [ ] ;
265
+
266
+ // render upper folder
267
+ if ( that . pathState . parentPath != '' ) {
268
+ let upperFolderTag = that . renderFileItem ( {
269
+ name : '..' ,
270
+ type : 'dir' ,
271
+ path : that . pathState . parentPath ,
272
+ size : '' ,
273
+ atime : '' ,
274
+ mtime : ''
275
+ } ) ;
276
+ dirArr . push ( upperFolderTag ) ;
277
+ }
278
+
263
279
fileList && fileList . forEach ( ( file , idx ) => {
264
280
if ( idx == 0 ) return ;
265
281
let fileTag = that . renderFileItem ( file ) ;
@@ -400,15 +416,15 @@ define([
400
416
let selectedExt = $ ( that . wrapSelector ( '#vp_fileNavigationExt' ) ) . val ( ) ;
401
417
let fileExtIdx = fileName . lastIndexOf ( '.' ) ;
402
418
// if no extension, add it
403
- if ( fileExtIdx < 0 || fileName . substring ( fileExtIdx + 1 ) != selectedExt ) {
419
+ if ( selectedExt != '' && ( fileExtIdx < 0 || fileName . substring ( fileExtIdx + 1 ) != selectedExt ) ) {
404
420
fileName += '.' + selectedExt ;
405
421
}
406
422
// no path, set it
407
423
if ( filePath == '' ) {
408
424
filePath = './' + fileName ;
409
425
}
410
426
fileExtIdx = filePath . lastIndexOf ( '.' ) ;
411
- if ( fileExtIdx < 0 || filePath . substring ( fileExtIdx + 1 ) != selectedExt ) {
427
+ if ( selectedExt != '' && ( fileExtIdx < 0 || filePath . substring ( fileExtIdx + 1 ) != selectedExt ) ) {
412
428
filePath += '.' + selectedExt ;
413
429
}
414
430
@@ -569,8 +585,15 @@ define([
569
585
} ) ;
570
586
}
571
587
588
+ vpLog . display ( VP_LOG_TYPE . DEVELOP , 'FileNavigation - getFileList: ' , filtered_varList ) ;
572
589
573
590
var { currentDirStr, currentRelativePathStr } = that . splitPathStrAndSetStack ( dirObj , filtered_varList ) ;
591
+ if ( filtered_varList [ 0 ] . current === filtered_varList [ 0 ] . parent ) {
592
+ // no parent
593
+ that . pathState . parentPath = '' ;
594
+ } else {
595
+ that . pathState . parentPath = filtered_varList [ 0 ] . parent ; // parent path
596
+ }
574
597
that . pathState . relativeDir = currentRelativePathStr ;
575
598
that . pathState . currentPath = currentDirStr ;
576
599
that . currentFileList = filtered_varList ;
0 commit comments