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