editor workflow ui adjustments

This commit is contained in:
Cássio Zen
2016-09-09 17:15:58 -03:00
parent b6874152d9
commit c84d538eb6
6 changed files with 107 additions and 64 deletions

View File

@ -1,12 +1,11 @@
import React, { PropTypes } from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { Map } from 'immutable';
import { OrderedMap } from 'immutable';
import { init, loadUnpublishedEntries } from '../actions/editorialWorkflow';
import { selectUnpublishedEntries } from '../reducers';
import { EDITORIAL_WORKFLOW, status } from '../constants/publishModes';
import UnpublishedListing from '../components/UnpublishedListing';
import { connect } from 'react-redux';
import _ from 'lodash';
export default function EditorialWorkflow(WrappedComponent) {
class EditorialWorkflow extends WrappedComponent {
@ -45,11 +44,15 @@ export default function EditorialWorkflow(WrappedComponent) {
const returnObj = { isEditorialWorkflow };
if (isEditorialWorkflow) {
returnObj.unpublishedEntries = _.reduce(status, (acc, currStatus) => {
/*
* Generates an ordered Map of the available status as keys.
* Each key containing a List of available unpubhlished entries
* Eg.: OrderedMap{'draft':List(), 'pending_review':List(), 'pending_publish':List()}
*/
returnObj.unpublishedEntries = status.reduce((acc, currStatus) => {
return acc.set(currStatus, selectUnpublishedEntries(state, currStatus));
}, Map());
}, OrderedMap());
}
return returnObj;
}