merge button for editorial workflow

This commit is contained in:
Cássio Zen
2016-09-14 18:25:45 -03:00
parent 91846cdbc5
commit 71b5b0bde9
9 changed files with 121 additions and 40 deletions

View File

@ -3,6 +3,7 @@ import { connect } from 'react-redux';
import { loadConfig } from '../actions/config';
import { loginUser } from '../actions/auth';
import { currentBackend } from '../backends/backend';
import { Loader } from '../components/UI';
import { SHOW_COLLECTION, CREATE_COLLECTION, HELP } from '../actions/findbar';
import FindBar from './FindBar';
import styles from './App.css';
@ -26,7 +27,7 @@ class App extends React.Component {
configLoading() {
return <div>
<h1>Loading configuration...</h1>
<Loader active>Loading configuration...</Loader>
</div>;
}

View File

@ -1,7 +1,7 @@
import React, { PropTypes } from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { OrderedMap } from 'immutable';
import { loadUnpublishedEntries, updateUnpublishedEntryStatus } from '../../actions/editorialWorkflow';
import { loadUnpublishedEntries, updateUnpublishedEntryStatus, publishUnpublishedEntry } from '../../actions/editorialWorkflow';
import { selectUnpublishedEntries } from '../../reducers';
import { EDITORIAL_WORKFLOW, status } from '../../constants/publishModes';
import UnpublishedListing from '../../components/UnpublishedListing';
@ -19,17 +19,17 @@ export default function CollectionPageHOC(CollectionPage) {
super.componentDidMount();
}
handleChangeStatus(collection, slug, oldStatus, newStatus) {
this.props.updateUnpublishedEntryStatus(collection, slug, oldStatus, newStatus);
}
render() {
const { isEditorialWorkflow, unpublishedEntries } = this.props;
const { isEditorialWorkflow, unpublishedEntries, updateUnpublishedEntryStatus, publishUnpublishedEntry } = this.props;
if (!isEditorialWorkflow) return super.render();
return (
<div className={styles.alignable}>
<UnpublishedListing entries={unpublishedEntries} handleChangeStatus={this.handleChangeStatus.bind(this)} />
<UnpublishedListing
entries={unpublishedEntries}
handleChangeStatus={updateUnpublishedEntryStatus}
handlePublish={publishUnpublishedEntry}
/>
{super.render()}
</div>
);
@ -60,5 +60,8 @@ export default function CollectionPageHOC(CollectionPage) {
return returnObj;
}
return connect(mapStateToProps, { updateUnpublishedEntryStatus })(CollectionPageHOC);
return connect(mapStateToProps, {
updateUnpublishedEntryStatus,
publishUnpublishedEntry
})(CollectionPageHOC);
}