diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-09-20 02:19:48 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-09-20 02:19:48 +0200 |
| commit | 19adbf48642085f39b9562ea6ad1e248a546373c (patch) | |
| tree | 32129a992e8c1dcb5c9ed27482b75d8f64e9b6d2 /app/client/common | |
| parent | 59bc39099e82f4ce026e0ebd916c96bdc40fc951 (diff) | |
browser is browsing
Diffstat (limited to 'app/client/common')
| -rw-r--r-- | app/client/common/fileList.component.js | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/app/client/common/fileList.component.js b/app/client/common/fileList.component.js index b71faae..0e6b25e 100644 --- a/app/client/common/fileList.component.js +++ b/app/client/common/fileList.component.js @@ -11,18 +11,24 @@ export const FileList = props => { const { files, fields, sort, title, - linkFiles, onClick, onDelete, + linkFiles, + onClick, onClickParent, onDelete, + groupDirectories, parentDirectory, orderBy='name asc', className='', fileListClassName='filelist', rowClassName='row file' } = props const { mapFn, sortFn } = util.sort.orderByFn(orderBy) - const fileList = (files || []) + let sortedFiles = (files || []) .filter(f => !!f) .map(mapFn) .sort(sortFn) - .map(pair => { + if (groupDirectories) { + const groupedFiles = sortedFiles.reduce((a,b) => { a[b[1].dir].push(b); return a }, { true: [], false: [] }) + sortedFiles = groupedFiles.true.concat(groupedFiles.false) + } + const fileList = sortedFiles.map(pair => { return <FileRow file={pair[1]} fields={fieldSet(fields)} @@ -51,6 +57,15 @@ export const FileList = props => { } <div className={'rows ' + fileListClassName}> + {parentDirectory && + <div className={rowClassName + ' parent'}> + <div className="filename" title="Parent Directory"> + <span class='link' onClick={(e) => onClickParent && onClickParent(e)}> + <i>Parent Directory</i> + </span> + </div> + </div> + } {fileList} </div> </div> |
