UI updates (#151)
* infer card title * Infer entry body & image * infer image * Better terminology: EntryListing accept a single Collection * remove log * Refactored Collections VO into selectors * use selectors when showning card * fixed size cards * Added 'bio' and 'biography' to collection description inference synonyms * Removed unused card file * throw error instance * bugfix for file based collections * lint * moved components with css to own folder * Search Bugfix: More than one collection might be returned * Changed sidebar implementation. Closes #104 & #152 * Show spinning loading for unpublished entries * Refactored Sidebar into a separate container * Make preview widgets more robust
This commit is contained in:
@ -11,8 +11,9 @@ import {
|
||||
} from '../actions/entries';
|
||||
import { cancelEdit } from '../actions/editor';
|
||||
import { addMedia, removeMedia } from '../actions/media';
|
||||
import { openSidebar } from '../actions/globalUI';
|
||||
import { selectEntry, getMedia } from '../reducers';
|
||||
import Collection from '../valueObjects/Collection';
|
||||
import { selectFields } from '../reducers/collections';
|
||||
import EntryEditor from '../components/EntryEditor/EntryEditor';
|
||||
import entryPageHOC from './editorialWorkflow/EntryPageHOC';
|
||||
import { Loader } from '../components/UI';
|
||||
@ -32,6 +33,7 @@ class EntryPage extends React.Component {
|
||||
persistEntry: PropTypes.func.isRequired,
|
||||
removeMedia: PropTypes.func.isRequired,
|
||||
cancelEdit: PropTypes.func.isRequired,
|
||||
openSidebar: PropTypes.func.isRequired,
|
||||
fields: ImmutablePropTypes.list.isRequired,
|
||||
slug: PropTypes.string,
|
||||
newEntry: PropTypes.bool.isRequired,
|
||||
@ -39,6 +41,7 @@ class EntryPage extends React.Component {
|
||||
|
||||
componentDidMount() {
|
||||
const { entry, newEntry, collection, slug, loadEntry } = this.props;
|
||||
this.props.openSidebar();
|
||||
if (newEntry) {
|
||||
createEmptyDraft(collection);
|
||||
} else {
|
||||
@ -108,9 +111,8 @@ function mapStateToProps(state, ownProps) {
|
||||
const { collections, entryDraft } = state;
|
||||
const slug = ownProps.params.slug;
|
||||
const collection = collections.get(ownProps.params.name);
|
||||
const collectionModel = new Collection(collection);
|
||||
const newEntry = ownProps.route && ownProps.route.newRecord === true;
|
||||
|
||||
const fields = selectFields(collection, slug);
|
||||
const entry = newEntry ? null : selectEntry(state, collection.get('name'), slug);
|
||||
const boundGetMedia = getMedia.bind(null, state);
|
||||
return {
|
||||
@ -119,7 +121,7 @@ function mapStateToProps(state, ownProps) {
|
||||
newEntry,
|
||||
entryDraft,
|
||||
boundGetMedia,
|
||||
fields: collectionModel.entryFields(slug),
|
||||
fields,
|
||||
slug,
|
||||
entry,
|
||||
};
|
||||
@ -137,5 +139,6 @@ export default connect(
|
||||
discardDraft,
|
||||
persistEntry,
|
||||
cancelEdit,
|
||||
openSidebar,
|
||||
}
|
||||
)(entryPageHOC(EntryPage));
|
||||
|
Reference in New Issue
Block a user