1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-08-30 13:23:14 +00:00

modify pushlished draft jump (#3240)

This commit is contained in:
ilearnit 2019-04-11 18:04:23 +08:00 committed by Daniel Pan
parent d055eb7a4f
commit 1534d1e737

View File

@ -55,6 +55,7 @@ class Draft extends React.Component {
reviewers: [], reviewers: [],
inResizing: false, inResizing: false,
rightPartWidth: 30, rightPartWidth: 30,
freezePublish: false
}; };
this.quote = ''; this.quote = '';
this.newIndex = null; this.newIndex = null;
@ -414,8 +415,9 @@ class Draft extends React.Component {
onPublishDraft = () => { onPublishDraft = () => {
seafileAPI.publishDraft(draftID).then(res => { seafileAPI.publishDraft(draftID).then(res => {
const OriginFileLink = siteRoot + 'lib/' + draftRepoID + '/file' + Utils.encodePath(res.data.published_file_path); this.setState({
window.location.href = OriginFileLink; freezePublish: !this.state.freezePublish
})
}); });
} }
@ -760,6 +762,8 @@ class Draft extends React.Component {
render() { render() {
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 freezePublish = (this.state.freezePublish || draftStatus === 'published') ? true : false;
const canPublish = !this.state.freezePublish && draftFileExists;
return( return(
<div className="wrapper"> <div className="wrapper">
<div id="header" className="header review"> <div id="header" className="header review">
@ -778,7 +782,7 @@ class Draft extends React.Component {
</div> </div>
<div className="button-group"> <div className="button-group">
{this.renderDiffButton()} {this.renderDiffButton()}
{draftFileExists && {canPublish &&
<button <button
className='btn btn-success file-operation-btn' className='btn btn-success file-operation-btn'
title={gettext('Publish draft')} title={gettext('Publish draft')}
@ -787,7 +791,7 @@ class Draft extends React.Component {
{gettext('Publish')} {gettext('Publish')}
</button> </button>
} }
{draftStatus == 'published' && {freezePublish &&
<button <button
className='btn btn-success file-operation-btn' className='btn btn-success file-operation-btn'
title={gettext('Published')} title={gettext('Published')}