1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-17 15:53:28 +00:00

repair goto repo bug

This commit is contained in:
shanshuirenjia
2018-12-11 17:52:19 +08:00
parent 8efd8a45be
commit f1eb4c625f
7 changed files with 62 additions and 25 deletions

View File

@@ -1,9 +1,10 @@
import React from 'react';
import React, { Fragment } from 'react';
import PropTypes from 'prop-types';
import { siteRoot, gettext } from '../../utils/constants';
const propTypes = {
repoName: PropTypes.string.isRequired,
pathPrefix: PropTypes.object,
currentPath: PropTypes.string.isRequired,
onPathClick: PropTypes.func.isRequired,
};
@@ -43,10 +44,16 @@ class DirPath extends React.Component {
render() {
let { currentPath, repoName } = this.props;
let pathElem = this.turnPathToLink(currentPath);
let pathPrefix = this.props.pathPrefix !== undefined ? this.props.pathPrefix : false;
return (
<div className="path-containter">
<a href={siteRoot + 'my-libs/'} className="normal">{gettext('Libraries')}</a>
<span className="path-split">/</span>
{pathPrefix ?
pathPrefix :
<Fragment>
<a href={siteRoot + 'my-libs/'} className="normal">{gettext('Libraries')}</a>
<span className="path-split">/</span>
</Fragment>
}
{currentPath === '/' ?
<span>{repoName}</span>:
<a className="path-link" data-path="/" onClick={this.onPathClick}>{repoName}</a>

View File

@@ -5,6 +5,7 @@ import DirTool from './dir-tool';
const propTypes = {
repoID: PropTypes.string.isRequired,
pathPrefix: PropTypes.object.isRequired,
repoName: PropTypes.string.isRequired,
permission: PropTypes.bool.isRequired,
currentPath: PropTypes.string.isRequired,
@@ -18,6 +19,7 @@ class CurDirPath extends React.Component {
<Fragment>
<DirPath
repoName={this.props.repoName}
pathPrefix={this.props.pathPrefix}
currentPath={this.props.currentPath}
onPathClick={this.props.onPathClick}
/>