mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-17 15:53:28 +00:00
My librarys (#2584)
This commit is contained in:
@@ -45,7 +45,7 @@ class DirPath extends React.Component {
|
||||
let pathElem = this.turnPathToLink(currentPath);
|
||||
return (
|
||||
<div className="path-containter">
|
||||
<a href={siteRoot + '#common/'} className="normal">{gettext('Libraries')}</a>
|
||||
<a href={siteRoot + 'my-libs/'} className="normal">{gettext('Libraries')}</a>
|
||||
<span className="path-split">/</span>
|
||||
{currentPath === '/' ?
|
||||
<span>{repoName}</span>:
|
||||
|
@@ -12,6 +12,7 @@ import Repo from '../../models/repo';
|
||||
|
||||
const propTypes = {
|
||||
onMenuClick: PropTypes.func.isRequired,
|
||||
updateCurrentTab: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
class DirView extends React.Component {
|
||||
@@ -44,8 +45,6 @@ class DirView extends React.Component {
|
||||
|
||||
componentDidMount() {
|
||||
let repoID = this.props.repoID;
|
||||
let index = location.href.indexOf(repoID) + repoID.length;
|
||||
let path = decodeURIComponent(location.href.slice(index));
|
||||
seafileAPI.getRepoInfo(repoID).then(res => {
|
||||
let repo = new Repo(res.data);
|
||||
this.setState({
|
||||
@@ -54,9 +53,15 @@ class DirView extends React.Component {
|
||||
permission: repo.permission === 'rw',
|
||||
currentRepo: repo,
|
||||
});
|
||||
this.updateDirentList(path);
|
||||
|
||||
let repoName = encodeURIComponent(repo.repo_name);
|
||||
let index = location.href.indexOf(repoName) + repoName.length;
|
||||
let path = decodeURIComponent(location.href.slice(index));
|
||||
this.setState({path: path});
|
||||
this.updateDirentList(path);
|
||||
});
|
||||
|
||||
this.props.updateCurrentTab('my-libs'); // just for refersh brower;
|
||||
}
|
||||
|
||||
updateDirentList = (filePath) => {
|
||||
@@ -82,7 +87,7 @@ class DirView extends React.Component {
|
||||
this.updateDirentList(direntPath);
|
||||
this.setState({path: direntPath});
|
||||
|
||||
let fileUrl = siteRoot + 'librarys/' + this.state.repoID + direntPath;
|
||||
let fileUrl = siteRoot + 'library/' + this.state.repoID + '/' + this.state.repoName + direntPath;
|
||||
window.history.pushState({url: fileUrl, path: direntPath}, direntPath, fileUrl);
|
||||
} else {
|
||||
const w=window.open('about:blank');
|
||||
@@ -302,7 +307,7 @@ class DirView extends React.Component {
|
||||
this.updateDirentList(path);
|
||||
this.setState({path: path});
|
||||
|
||||
let fileUrl = siteRoot + 'librarys/' + this.state.repoID + path;
|
||||
let fileUrl = siteRoot + 'library/' + this.state.repoID + '/' + this.state.repoName + path;
|
||||
window.history.pushState({url: fileUrl, path: path}, path, fileUrl);
|
||||
}
|
||||
|
||||
|
@@ -123,10 +123,10 @@ class MainSideNav extends React.Component {
|
||||
<h3 className="sf-heading">Files</h3>
|
||||
<ul className="side-tabnav-tabs">
|
||||
<li className={`tab ${this.props.currentTab === 'my-libs' ? 'tab-cur' : ''}`}>
|
||||
<a href={ siteRoot + '#my-libs' } className="ellipsis" title={gettext('My Libraries')} onClick={() => this.tabItemClick('my-libs')}>
|
||||
<Link to={ siteRoot + 'my-libs/' } className="ellipsis" title={gettext('My Libraries')} onClick={() => this.tabItemClick('my-libs')}>
|
||||
<span className="sf2-icon-user" aria-hidden="true"></span>
|
||||
{gettext('My Libraries')}
|
||||
</a>
|
||||
</Link>
|
||||
</li>
|
||||
<li className={`tab ${this.props.currentTab === 'shared-libs' ? 'tab-cur' : ''}`}>
|
||||
<Link to={siteRoot + 'shared-libs/'} className="ellipsis" title={gettext('Shared with me')} onClick={() => this.tabItemClick('shared-libs')}>
|
||||
|
Reference in New Issue
Block a user