From d1923e48500d24cc43d74c877dd50d6e91ba5229 Mon Sep 17 00:00:00 2001 From: zxj96 <35951769+zxj96@users.noreply.github.com> Date: Wed, 10 Jul 2019 15:53:47 +0800 Subject: [PATCH] Markdown previewer location (#3833) * Change the position in the markdown preview page * modify func name * optimization code --- frontend/src/components/cur-dir-path/dir-tool.js | 9 +-------- frontend/src/components/toolbar/view-file-toolbar.js | 6 ++++++ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/frontend/src/components/cur-dir-path/dir-tool.js b/frontend/src/components/cur-dir-path/dir-tool.js index 03a918d409..0f2385297f 100644 --- a/frontend/src/components/cur-dir-path/dir-tool.js +++ b/frontend/src/components/cur-dir-path/dir-tool.js @@ -87,14 +87,7 @@ class DirTool extends React.Component { let trashUrl = siteRoot + 'repo/' + repoID + '/trash/'; let historyUrl = siteRoot + 'repo/history/' + repoID + '/'; if (permission) { - if (isFile) { // isFile - historyUrl = siteRoot + 'repo/file_revisions/' + repoID + '/?p=' + Utils.encodePath(currentPath); - return ( - - ); - } else { + if (!isFile) { if (name) { // name not '' is not root path trashUrl = siteRoot + 'repo/' + repoID + '/trash/?path=' + encodeURIComponent(currentPath); return ( diff --git a/frontend/src/components/toolbar/view-file-toolbar.js b/frontend/src/components/toolbar/view-file-toolbar.js index 588d135b44..9c397bfe5e 100644 --- a/frontend/src/components/toolbar/view-file-toolbar.js +++ b/frontend/src/components/toolbar/view-file-toolbar.js @@ -85,6 +85,11 @@ class ViewFileToolbar extends React.Component { }); } + onHistoryClick = () => { + let historyUrl = siteRoot + 'repo/file_revisions/' + this.props.repoID + '/?p=' + Utils.encodePath(this.props.path); + location.href = historyUrl; + } + render() { let { filePermission } = this.props; let name = Utils.getFileName(this.props.path); @@ -114,6 +119,7 @@ class ViewFileToolbar extends React.Component { } {gettext('Tags')} {gettext('Related Files')} + {gettext('History')} )}