1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-13 05:39:59 +00:00

Markdown previewer location (#3833)

* Change the position in the markdown preview page

* modify func name

* optimization code
This commit is contained in:
zxj96
2019-07-10 15:53:47 +08:00
committed by Daniel Pan
parent 514302a7b2
commit d1923e4850
2 changed files with 7 additions and 8 deletions

View File

@@ -87,14 +87,7 @@ class DirTool extends React.Component {
let trashUrl = siteRoot + 'repo/' + repoID + '/trash/'; let trashUrl = siteRoot + 'repo/' + repoID + '/trash/';
let historyUrl = siteRoot + 'repo/history/' + repoID + '/'; let historyUrl = siteRoot + 'repo/history/' + repoID + '/';
if (permission) { if (permission) {
if (isFile) { // isFile if (!isFile) {
historyUrl = siteRoot + 'repo/file_revisions/' + repoID + '/?p=' + Utils.encodePath(currentPath);
return (
<ul className="path-toolbar">
<li className="toolbar-item"><a className="op-link sf2-icon-history" href={historyUrl} title={gettext('History')} aria-label={gettext('History')}></a></li>
</ul>
);
} else {
if (name) { // name not '' is not root path if (name) { // name not '' is not root path
trashUrl = siteRoot + 'repo/' + repoID + '/trash/?path=' + encodeURIComponent(currentPath); trashUrl = siteRoot + 'repo/' + repoID + '/trash/?path=' + encodeURIComponent(currentPath);
return ( return (

View File

@@ -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() { render() {
let { filePermission } = this.props; let { filePermission } = this.props;
let name = Utils.getFileName(this.props.path); let name = Utils.getFileName(this.props.path);
@@ -114,6 +119,7 @@ class ViewFileToolbar extends React.Component {
} }
<DropdownItem onClick={this.onEditFileTagToggle}>{gettext('Tags')}</DropdownItem> <DropdownItem onClick={this.onEditFileTagToggle}>{gettext('Tags')}</DropdownItem>
<DropdownItem onClick={this.onListRelatedFileToggle}>{gettext('Related Files')}</DropdownItem> <DropdownItem onClick={this.onListRelatedFileToggle}>{gettext('Related Files')}</DropdownItem>
<DropdownItem onClick={this.onHistoryClick}>{gettext('History')}</DropdownItem>
</DropdownMenu> </DropdownMenu>
</Dropdown> </Dropdown>
)} )}