Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb2e35e0

Browse files
author
minjk-bl
committed
Add parent folder to FileNavigation component
1 parent6251919 commitb2e35e0

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

‎js/com/component/FileNavigation.js‎

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ define([
8484
this.currentFileList=[];
8585

8686
this.pathState={
87+
parentPath:'',
8788
currentPath:'',
8889
baseFolder:'',// root folder name
8990
relativeDir:'',// root folder name
@@ -257,9 +258,24 @@ define([
257258
letfileList=this.currentFileList;
258259
// clear body
259260
$(this.wrapSelector('.fileNavigationPage-body')).html('');
261+
260262
// render file items
261263
letdirArr=[];
262264
letfileArr=[];
265+
266+
// render upper folder
267+
if(that.pathState.parentPath!=''){
268+
letupperFolderTag=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+
263279
fileList&&fileList.forEach((file,idx)=>{
264280
if(idx==0)return;
265281
letfileTag=that.renderFileItem(file);
@@ -400,15 +416,15 @@ define([
400416
letselectedExt=$(that.wrapSelector('#vp_fileNavigationExt')).val();
401417
letfileExtIdx=fileName.lastIndexOf('.');
402418
// if no extension, add it
403-
if(fileExtIdx<0||fileName.substring(fileExtIdx+1)!=selectedExt){
419+
if(selectedExt!=''&&(fileExtIdx<0||fileName.substring(fileExtIdx+1)!=selectedExt)){
404420
fileName+='.'+selectedExt;
405421
}
406422
// no path, set it
407423
if(filePath==''){
408424
filePath='./'+fileName;
409425
}
410426
fileExtIdx=filePath.lastIndexOf('.');
411-
if(fileExtIdx<0||filePath.substring(fileExtIdx+1)!=selectedExt){
427+
if(selectedExt!=''&&(fileExtIdx<0||filePath.substring(fileExtIdx+1)!=selectedExt)){
412428
filePath+='.'+selectedExt;
413429
}
414430

@@ -569,8 +585,15 @@ define([
569585
});
570586
}
571587

588+
vpLog.display(VP_LOG_TYPE.DEVELOP,'FileNavigation - getFileList: ',filtered_varList);
572589

573590
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+
}
574597
that.pathState.relativeDir=currentRelativePathStr;
575598
that.pathState.currentPath=currentDirStr;
576599
that.currentFileList=filtered_varList;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp