1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-22 03:47:09 +00:00

Merge branch '7.0'

This commit is contained in:
plt
2019-10-11 20:11:18 +08:00
5 changed files with 28 additions and 15 deletions

View File

@@ -68,7 +68,10 @@ class FileHistory extends React.Component {
if (result.total_count < 5) {
if (result.data.length) {
let commitID = result.data[result.data.length-1].commit_id;
seafileAPI.listOldFileHistoryRecords(historyRepoID, filePath, commitID).then((res) => {
let path = result.data[result.data.length-1].path;
let oldPath = result.data[result.data.length-1].old_path;
path = oldPath ? oldPath : path;
seafileAPI.listOldFileHistoryRecords(historyRepoID, path, commitID).then((res) => {
if (!res.data) {
this.setState({isLoading: false});
throw Error('There is an error in server.');

View File

@@ -16,7 +16,7 @@ import './css/shared-dir-view.css';
import './css/grid-view.css';
let loginUser = window.app.pageOptions.name;
const { token, trafficOverLimit, dirName, sharedBy, path, canDownload, mode, thumbnailSize } = window.shared.pageOptions;
const { token, trafficOverLimit, dirName, sharedBy, path, canDownload, mode, thumbnailSize, zipped } = window.shared.pageOptions;
const showDownloadIcon = !trafficOverLimit && canDownload;
@@ -93,28 +93,20 @@ class SharedDirView extends React.Component {
}
renderPath = () => {
// path: '/', or '/g/'
if (path == '/') {
return dirName;
}
let pathList = path.substr(0, path.length -1).split('/');
return (
<React.Fragment>
<a href={`?p=${encodeURIComponent('/')}&mode=${mode}`}>{dirName}</a>
<span> / </span>
{pathList.map((item, index) => {
if (index > 0 && index != pathList.length - 1) {
{zipped.map((item, index) => {
if (index != zipped.length - 1) {
return (
<React.Fragment key={index}>
<a href={`?p=${encodeURIComponent(pathList.slice(0, index+1).join('/'))}&mode=${mode}`}>{pathList[index]}</a>
<a href={`?p=${encodeURIComponent(item.path)}&mode=${mode}`}>{item.name}</a>
<span> / </span>
</React.Fragment>
);
}
})
}
)}
{pathList[pathList.length - 1]}
{zipped[zipped.length - 1].name}
</React.Fragment>
);
}