1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-15 06:44:16 +00:00

change filePath after draft is published

This commit is contained in:
Michael An
2019-06-24 17:12:29 +08:00
parent 741e2586cb
commit 3e21330b5f
2 changed files with 20 additions and 6 deletions

View File

@@ -108,6 +108,9 @@
word-wrap: break-word; word-wrap: break-word;
word-break: normal; word-break: normal;
} }
.dirent-table-container td a:hover {
text-decoration: underline;
}
.review-side-panel-item { .review-side-panel-item {
border-bottom: 1px solid #e6e6dd; border-bottom: 1px solid #e6e6dd;
padding: 1em 0; padding: 1em 0;

View File

@@ -5,7 +5,7 @@ import { Button } from 'reactstrap';
/* eslint-disable */ /* eslint-disable */
import Prism from 'prismjs'; import Prism from 'prismjs';
/* eslint-enable */ /* eslint-enable */
import { siteRoot, gettext, draftOriginFilePath, draftFilePath, author, authorAvatar, originFileExists, draftFileExists, draftID, draftFileName, draftRepoID, draftStatus, draftPublishVersion, originFileVersion, filePermission } from './utils/constants'; import { siteRoot, gettext, draftOriginFilePath, draftFilePath, author, authorAvatar, originFileExists, draftFileExists, draftID, draftFileName, draftRepoID, draftStatus, draftPublishVersion, originFileVersion, filePermission, serviceURL } from './utils/constants';
import { seafileAPI } from './utils/seafile-api'; import { seafileAPI } from './utils/seafile-api';
import axios from 'axios'; import axios from 'axios';
import DiffViewer from '@seafile/seafile-editor/dist/viewer/diff-viewer'; import DiffViewer from '@seafile/seafile-editor/dist/viewer/diff-viewer';
@@ -56,7 +56,7 @@ class Draft extends React.Component {
reviewers: [], reviewers: [],
inResizing: false, inResizing: false,
rightPartWidth: 30, rightPartWidth: 30,
draftStatus: window.draft.config.draftStatus, draftStatus: draftStatus,
}; };
this.quote = ''; this.quote = '';
this.newIndex = null; this.newIndex = null;
@@ -731,7 +731,7 @@ class Draft extends React.Component {
} }
render() { render() {
const { draftInfo, reviewers, originRepoName } = this.state; const { draftInfo, reviewers, originRepoName, draftStatus } = this.state;
const onResizeMove = this.state.inResizing ? this.onResizeMouseMove : null; const onResizeMove = this.state.inResizing ? this.onResizeMouseMove : null;
const draftLink = siteRoot + 'lib/' + draftRepoID + '/file' + draftFilePath + '?mode=edit'; const draftLink = siteRoot + 'lib/' + draftRepoID + '/file' + draftFilePath + '?mode=edit';
const showPublishedButton = this.state.draftStatus == 'published'; const showPublishedButton = this.state.draftStatus == 'published';
@@ -807,7 +807,7 @@ class Draft extends React.Component {
changedNumber={this.state.changedNodes.length} changedNumber={this.state.changedNodes.length}
scrollToChangedNode={this.scrollToChangedNode}/> scrollToChangedNode={this.scrollToChangedNode}/>
} }
<SidePanelOrigin originRepoName={originRepoName} draftInfo={draftInfo}/> <SidePanelOrigin originRepoName={originRepoName} draftInfo={draftInfo} draftStatus={draftStatus}/>
</div> </div>
</TabPane> </TabPane>
<TabPane tabId="comments" className="comments"> <TabPane tabId="comments" className="comments">
@@ -917,6 +917,8 @@ class SidePanelOrigin extends React.Component {
} }
render() { render() {
const { draftStatus, originRepoName } = this.props;
const filePath = serviceURL + '/lib/' + draftRepoID + '/file' + draftOriginFilePath;
return ( return (
<div className="dirent-table-container"> <div className="dirent-table-container">
<table className="table-thead-hidden"> <table className="table-thead-hidden">
@@ -924,7 +926,15 @@ class SidePanelOrigin extends React.Component {
<tr><th width="25%"></th><th width="75%"></th></tr> <tr><th width="25%"></th><th width="75%"></th></tr>
</thead> </thead>
<tbody> <tbody>
<tr><th>{gettext('Location')}</th><td>{this.props.originRepoName}{draftFilePath}</td></tr> <tr>
<th className="align-text-top">{gettext('Location')}</th>
<td>
{draftStatus === 'open' ?
<span>{originRepoName}{draftFilePath}</span> :
<a href={filePath} className="text-dark">{filePath}</a>
}
</td>
</tr>
</tbody> </tbody>
</table> </table>
</div> </div>
@@ -933,7 +943,8 @@ class SidePanelOrigin extends React.Component {
} }
const SidePanelOriginPropTypes = { const SidePanelOriginPropTypes = {
originRepoName: PropTypes.string.isRequired originRepoName: PropTypes.string.isRequired,
draftStatus: PropTypes.string.isRequired,
}; };
SidePanelOrigin.propTypes = SidePanelOriginPropTypes; SidePanelOrigin.propTypes = SidePanelOriginPropTypes;