- {this.props.pathPrefix ?
- this.props.pathPrefix :
-
- {gettext('Libraries')}
+ {this.props.pathPrefix && this.props.pathPrefix.map((item, index) => {
+ return (
+
+ this.onTabNavClick(item.name, item.id)}>{gettext(item.showName)}
/
-
+
+ );
+ })}
+ {this.props.pathPrefix && this.props.pathPrefix.length === 0 && (
+
+ this.onTabNavClick.bind(this, 'my-libs')}>{gettext('Libraries')}
+ /
+
+ )
}
+ {!this.props.pathPrefix && (
+
+ this.onTabNavClick.bind(this, 'my-libs')}>{gettext('Libraries')}
+ /
+
+ )}
{currentPath === '/' ?
{repoName}:
{repoName}
diff --git a/frontend/src/components/cur-dir-path/index.js b/frontend/src/components/cur-dir-path/index.js
index fbacc1e922..a048622aa1 100644
--- a/frontend/src/components/cur-dir-path/index.js
+++ b/frontend/src/components/cur-dir-path/index.js
@@ -5,11 +5,12 @@ 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,
onPathClick: PropTypes.func.isRequired,
+ onTabNavClick: PropTypes.func,
+ pathPrefix: PropTypes.array,
};
class CurDirPath extends React.Component {
@@ -22,6 +23,7 @@ class CurDirPath extends React.Component {
pathPrefix={this.props.pathPrefix}
currentPath={this.props.currentPath}
onPathClick={this.props.onPathClick}
+ onTabNavClick={this.props.onTabNavClick}
/>
diff --git a/frontend/src/components/dir-view/dir-view.js b/frontend/src/components/dir-view/dir-view.js
index 62154e28f9..68d351798e 100644
--- a/frontend/src/components/dir-view/dir-view.js
+++ b/frontend/src/components/dir-view/dir-view.js
@@ -11,7 +11,8 @@ import FileTag from '../../models/file-tag';
import Repo from '../../models/repo';
const propTypes = {
- pathPrefix: PropTypes.object.isRequired,
+ pathPrefix: PropTypes.array.isRequired,
+ onTabNavClick: PropTypes.func.isRequired,
onMenuClick: PropTypes.func.isRequired,
};
@@ -456,6 +457,7 @@ class DirView extends React.Component {
onFileTagChanged={this.onFileTagChanged}
onMenuClick={this.onMenuClick}
onPathClick={this.onPathClick}
+ onTabNavClick={this.props.onTabNavClick}
updateDirent={this.updateDirent}
switchViewMode={this.switchViewMode}
onSearchedClick={this.onSearchedClick}
diff --git a/frontend/src/pages/groups/group-view.js b/frontend/src/pages/groups/group-view.js
index f152815d07..e5b786f221 100644
--- a/frontend/src/pages/groups/group-view.js
+++ b/frontend/src/pages/groups/group-view.js
@@ -180,6 +180,10 @@ class GroupView extends React.Component {
});
}
+ onTabNavClick = (tabName) => {
+ this.props.onTabNavClick(tabName);
+ }
+
render() {
let { errMessage, emptyTip, currentGroup } = this.state;
let isShowSettingIcon = !(currentGroup && currentGroup.parent_group_id !== 0 && currentGroup.admins.indexOf(username) === -1);
@@ -203,7 +207,7 @@ class GroupView extends React.Component {
{currentGroup && (
- {gettext("Groups")}
+ this.onTabNavClick('groups')}>{gettext("Groups")}
/
{currentGroup.name}
{currentGroup.parent_group_id !== 0 && (