1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-07-13 15:05:30 +00:00

Merge pull request #3750 from haiwen/7.0-client-url-redirect

redirect client's view lib url to lib page's url
This commit is contained in:
杨顺强 2019-06-28 11:41:58 +08:00 committed by GitHub
commit dd47bf8e40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 1 deletions

View File

@ -75,7 +75,20 @@ class App extends Component {
}
}
navigateClientUrlToLib = () =>{
if(window.location.hash && window.location.hash.indexOf('common/lib') != -1){
let splitUrlArray = window.location.hash.split('/');
let repoID = splitUrlArray[splitUrlArray.length - 2];
let url = siteRoot + 'library/' + repoID + '/';
navigate(url, {repalce: true});
}
}
componentDidMount() {
// url from client e.g. http://127.0.0.1:8000/#common/lib/34e7fb92-e91d-499d-bcde-c30ea8af9828/
// navigate to library page http://127.0.0.1:8000/library/34e7fb92-e91d-499d-bcde-c30ea8af9828/
this.navigateClientUrlToLib();
// e.g. from http://127.0.0.1:8000/drafts/reviews/
// get reviews
// TODO: need refactor later

View File

@ -86,7 +86,7 @@ class DirPath extends React.Component {
<span className="path-split">/</span>
</Fragment>
)}
{currentPath === '/' ?
{(currentPath === '/' || currentPath === '') ?
<span>{repoName}</span>:
<a className="path-link" data-path="/" onClick={this.onPathClick}>{repoName}</a>
}

View File

@ -223,6 +223,7 @@ urlpatterns = [
url(r'^my-libs/$', react_fake_view, name="my_libs"),
url(r'^groups/$', react_fake_view, name="groups"),
url(r'^group/(?P<group_id>\d+)/$', react_fake_view, name="group"),
url(r'^library/(?P<repo_id>[-0-9a-f]{36})/$', react_fake_view, name="library_view"),
url(r'^library/(?P<repo_id>[-0-9a-f]{36})/(?P<repo_name>[^/]+)/(?P<path>.*)$', react_fake_view, name="lib_view"),
url(r'^my-libs/deleted/$', react_fake_view, name="my_libs_deleted"),
url(r'^org/$', react_fake_view, name="org"),