diff --git a/README.md b/README.md index 5db3b0c16..97c6f0bfc 100644 --- a/README.md +++ b/README.md @@ -283,6 +283,19 @@ eventBus.publish({type: 'MOVE_CARD', fromLaneId: 'PLANNED', toLaneId: 'WIP', car //To update the lanes eventBus.publish({type: 'UPDATE_LANES', lanes: newLaneData}) +//To update one lane +eventBus.publish({type: 'UPDATE_LANE', lane: { id: 'TODO', title: 'teste' }}) + +//To add a new lane +eventBus.publish({type: 'ADD_LANE', lane: { id: 'TODO', title: 'teste' }}) + +//To move one lane +eventBus.publish({type: 'MOVE_LANE', fromIndex: 0, toIndex: 1 }) + +//To remove a lane +eventBus.publish({type: 'REMOVE_LANE', laneId: 'TODO' }) + + ``` diff --git a/src/controllers/BoardContainer.js b/src/controllers/BoardContainer.js index 2e80cd737..7ed7e5848 100644 --- a/src/controllers/BoardContainer.js +++ b/src/controllers/BoardContainer.js @@ -61,14 +61,15 @@ class BoardContainer extends Component { let eventBus = { publish: event => { switch (event.type) { + case 'REFRESH_BOARD': + return actions.loadBoard(event.data) + case 'ADD_CARD': return actions.addCard({laneId: event.laneId, card: event.card}) case 'UPDATE_CARD': return actions.updateCard({laneId: event.laneId, card: event.card}) case 'REMOVE_CARD': return actions.removeCard({laneId: event.laneId, cardId: event.cardId}) - case 'REFRESH_BOARD': - return actions.loadBoard(event.data) case 'MOVE_CARD': return actions.moveCardAcrossLanes({ fromLaneId: event.fromLaneId, @@ -78,10 +79,18 @@ class BoardContainer extends Component { }) case 'UPDATE_CARDS': return actions.updateCards({laneId: event.laneId, cards: event.cards}) + case 'UPDATE_LANES': return actions.updateLanes(event.lanes) case 'UPDATE_LANE': return actions.updateLane(event.lane) + case 'MOVE_LANE': + return actions.moveLane({ oldIndex: event.fromIndex, newIndex: event.toIndex }) + case 'REMOVE_LANE': + return actions.moveLane({ laneId: event.laneId }) + case 'ADD_LANE': + return actions.addLane(event.lane) + } } }