diff --git a/package.json b/package.json
index 312193cf..2dbb5363 100644
--- a/package.json
+++ b/package.json
@@ -88,9 +88,8 @@
"prismjs": "^1.5.1",
"react-addons-css-transition-group": "^15.3.1",
"react-datetime": "^2.6.0",
- "react-dnd": "^2.1.4",
- "react-dnd-html5-backend": "^2.1.2",
"react-portal": "^2.2.1",
+ "react-simple-dnd": "^0.1.2",
"selection-position": "^1.0.0",
"semaphore": "^1.0.5",
"slate": "^0.13.6"
diff --git a/src/components/UnpublishedListing.js b/src/components/UnpublishedListing.js
index 9d09b6a0..91144c2f 100644
--- a/src/components/UnpublishedListing.js
+++ b/src/components/UnpublishedListing.js
@@ -1,6 +1,5 @@
import React, { PropTypes } from 'react';
-import { DragDropContext, DragSource, DropTarget } from 'react-dnd';
-import HTML5Backend from 'react-dnd-html5-backend';
+import { DragSource, DropTarget, HTML5DragDrop } from 'react-simple-dnd';
import ImmutablePropTypes from 'react-immutable-proptypes';
import moment from 'moment';
import { Card } from './UI';
@@ -8,78 +7,21 @@ import { Link } from 'react-router';
import { status, statusDescriptions } from '../constants/publishModes';
import styles from './UnpublishedListing.css';
-const CARD = 'card';
-
-/*
- * Column DropTarget Component
- */
-function Column({ connectDropTarget, status, isOver, children }) {
- const className = isOver ? `${styles.column} ${styles.highlighted}` : styles.column;
- return connectDropTarget(
-
-
{statusDescriptions.get(status)}
- {children}
-
- );
-}
-const columnTargetSpec = {
- drop(props, monitor) {
- const slug = monitor.getItem().slug;
- const collection = monitor.getItem().collection;
- const oldStatus = monitor.getItem().ownStatus;
- props.onChangeStatus(collection, slug, oldStatus, props.status);
- }
-};
-function columnCollect(connect, monitor) {
- return {
- connectDropTarget: connect.dropTarget(),
- isOver: monitor.isOver()
- };
-}
-Column = DropTarget(CARD, columnTargetSpec, columnCollect)(Column);
-
-
-/*
- * Card DropTarget Component
- */
-function EntryCard({ slug, collection, ownStatus, onRequestPublish, connectDragSource, children }) {
- return connectDragSource(
-
-
- {children}
- {(ownStatus === status.last()) &&
-
- }
-
-
- );
-}
-const cardDragSpec = {
- beginDrag(props) {
- return {
- slug: props.slug,
- collection: props.collection,
- ownStatus: props.ownStatus
- };
- }
-};
-function cardCollect(connect, monitor) {
- return {
- connectDragSource: connect.dragSource()
- };
-}
-EntryCard = DragSource(CARD, cardDragSpec, cardCollect)(EntryCard);
-
-/*
- * The actual exported component implementation
- */
class UnpublishedListing extends React.Component {
constructor(props) {
super(props);
this.renderColumns = this.renderColumns.bind(this);
+ this.handleChangeStatus = this.handleChangeStatus.bind(this);
this.requestPublish = this.requestPublish.bind(this);
}
+ handleChangeStatus(newStatus, dragProps) {
+ const slug = dragProps.slug;
+ const collection = dragProps.collection;
+ const oldStatus = dragProps.ownStatus;
+ this.props.handleChangeStatus(collection, slug, oldStatus, newStatus);
+ }
+
requestPublish(collection, slug, ownStatus) {
if (ownStatus !== status.last()) return;
if (window.confirm('Are you sure you want to publish this entry?')) {
@@ -91,14 +33,17 @@ class UnpublishedListing extends React.Component {
if (!entries) return;
if (!column) {
+ /* eslint-disable */
return entries.entrySeq().map(([currColumn, currEntries]) => (
-
- {this.renderColumns(currEntries, currColumn)}
-
+
+ {(isOver) => (
+
+
{statusDescriptions.get(currColumn)}
+ {this.renderColumns(currEntries, currColumn)}
+
+ )}
+
+ /* eslint-enable */
));
} else {
return
@@ -108,19 +53,22 @@ class UnpublishedListing extends React.Component {
const timeStamp = moment(entry.getIn(['metaData', 'timeStamp'])).format('llll');
const link = `/editorialworkflow/${entry.getIn(['metaData', 'collection'])}/${entry.getIn(['metaData', 'status'])}/${entry.get('slug')}`;
const slug = entry.get('slug');
- const status = entry.getIn(['metaData', 'status']);
+ const ownStatus = entry.getIn(['metaData', 'status']);
const collection = entry.getIn(['metaData', 'collection']);
return (
-
- {entry.getIn(['data', 'title'])} by {author}
- Last updated: {timeStamp} by {entry.getIn(['metaData', 'user'])}
-
+ /* eslint-disable */
+
+
+
+ {entry.getIn(['data', 'title'])} by {author}
+ Last updated: {timeStamp} by {entry.getIn(['metaData', 'user'])}
+ {(ownStatus === status.last()) &&
+
+ }
+
+
+
+ /* eslint-enable */
);
}
)}
@@ -147,4 +95,4 @@ UnpublishedListing.propTypes = {
handlePublish: PropTypes.func.isRequired,
};
-export default DragDropContext(HTML5Backend)(UnpublishedListing);
+export default HTML5DragDrop(UnpublishedListing);