mirror of
https://github.com/plankanban/planka.git
synced 2025-12-29 09:15:04 +03:00
Move cards between boards and projects
This commit is contained in:
@@ -9,6 +9,8 @@ import {
|
||||
makeTasksByCardIdSelector,
|
||||
makeUsersByCardIdSelector,
|
||||
membershipsForCurrentProjectSelector,
|
||||
pathSelector,
|
||||
projectsToListsForCurrentUserSelector,
|
||||
} from '../selectors';
|
||||
import {
|
||||
addLabelToCard,
|
||||
@@ -16,8 +18,11 @@ import {
|
||||
createLabelInCurrentBoard,
|
||||
deleteCard,
|
||||
deleteLabel,
|
||||
fetchBoard,
|
||||
moveCard,
|
||||
removeLabelFromCard,
|
||||
removeUserFromCard,
|
||||
transferCard,
|
||||
updateLabel,
|
||||
updateCard,
|
||||
} from '../actions/entry';
|
||||
@@ -31,10 +36,15 @@ const makeMapStateToProps = () => {
|
||||
const notificationsTotalByCardIdSelector = makeNotificationsTotalByCardIdSelector();
|
||||
|
||||
return (state, { id, index }) => {
|
||||
const { projectId } = pathSelector(state);
|
||||
const allProjectsToLists = projectsToListsForCurrentUserSelector(state);
|
||||
const allProjectMemberships = membershipsForCurrentProjectSelector(state);
|
||||
const allLabels = labelsForCurrentBoardSelector(state);
|
||||
|
||||
const { name, dueDate, timer, coverUrl, isPersisted } = cardByIdSelector(state, id);
|
||||
const { name, dueDate, timer, coverUrl, listId, boardId, isPersisted } = cardByIdSelector(
|
||||
state,
|
||||
id,
|
||||
);
|
||||
|
||||
const users = usersByCardIdSelector(state, id);
|
||||
const labels = labelsByCardIdSelector(state, id);
|
||||
@@ -48,11 +58,15 @@ const makeMapStateToProps = () => {
|
||||
dueDate,
|
||||
timer,
|
||||
coverUrl,
|
||||
listId,
|
||||
boardId,
|
||||
projectId,
|
||||
isPersisted,
|
||||
notificationsTotal,
|
||||
users,
|
||||
labels,
|
||||
tasks,
|
||||
allProjectsToLists,
|
||||
allProjectMemberships,
|
||||
allLabels,
|
||||
};
|
||||
@@ -63,9 +77,12 @@ const mapDispatchToProps = (dispatch, { id }) =>
|
||||
bindActionCreators(
|
||||
{
|
||||
onUpdate: (data) => updateCard(id, data),
|
||||
onMove: (listId, index) => moveCard(id, listId, index),
|
||||
onTransfer: (boardId, listId) => transferCard(id, boardId, listId),
|
||||
onDelete: () => deleteCard(id),
|
||||
onUserAdd: (userId) => addUserToCard(userId, id),
|
||||
onUserRemove: (userId) => removeUserFromCard(userId, id),
|
||||
onBoardFetch: fetchBoard,
|
||||
onLabelAdd: (labelId) => addLabelToCard(labelId, id),
|
||||
onLabelRemove: (labelId) => removeLabelFromCard(labelId, id),
|
||||
onLabelCreate: (data) => createLabelInCurrentBoard(data),
|
||||
|
||||
@@ -11,6 +11,8 @@ import {
|
||||
labelsForCurrentBoardSelector,
|
||||
labelsForCurrentCardSelector,
|
||||
membershipsForCurrentProjectSelector,
|
||||
pathSelector,
|
||||
projectsToListsForCurrentUserSelector,
|
||||
tasksForCurrentCardSelector,
|
||||
usersForCurrentCardSelector,
|
||||
} from '../selectors';
|
||||
@@ -27,8 +29,11 @@ import {
|
||||
deleteLabel,
|
||||
deleteTask,
|
||||
fetchActionsInCurrentCard,
|
||||
fetchBoard,
|
||||
moveCurrentCard,
|
||||
removeLabelFromCurrentCard,
|
||||
removeUserFromCurrentCard,
|
||||
transferCurrentCard,
|
||||
updateAttachment,
|
||||
updateCommentAction,
|
||||
updateCurrentCard,
|
||||
@@ -39,7 +44,9 @@ import Paths from '../constants/Paths';
|
||||
import CardModal from '../components/CardModal';
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
const { projectId } = pathSelector(state);
|
||||
const { isAdmin } = currentUserSelector(state);
|
||||
const allProjectsToLists = projectsToListsForCurrentUserSelector(state);
|
||||
const allProjectMemberships = membershipsForCurrentProjectSelector(state);
|
||||
const allLabels = labelsForCurrentBoardSelector(state);
|
||||
|
||||
@@ -51,6 +58,7 @@ const mapStateToProps = (state) => {
|
||||
isSubscribed,
|
||||
isActionsFetching,
|
||||
isAllActionsFetched,
|
||||
listId,
|
||||
boardId,
|
||||
} = currentCardSelector(state);
|
||||
|
||||
@@ -68,14 +76,17 @@ const mapStateToProps = (state) => {
|
||||
isSubscribed,
|
||||
isActionsFetching,
|
||||
isAllActionsFetched,
|
||||
listId,
|
||||
boardId,
|
||||
projectId,
|
||||
users,
|
||||
labels,
|
||||
tasks,
|
||||
attachments,
|
||||
actions,
|
||||
allProjectsToLists,
|
||||
allProjectMemberships,
|
||||
allLabels,
|
||||
boardId,
|
||||
isEditable: isAdmin,
|
||||
};
|
||||
};
|
||||
@@ -84,9 +95,12 @@ const mapDispatchToProps = (dispatch) =>
|
||||
bindActionCreators(
|
||||
{
|
||||
onUpdate: updateCurrentCard,
|
||||
onMove: moveCurrentCard,
|
||||
onTransfer: transferCurrentCard,
|
||||
onDelete: deleteCurrentCard,
|
||||
onUserAdd: addUserToCurrentCard,
|
||||
onUserRemove: removeUserFromCurrentCard,
|
||||
onBoardFetch: fetchBoard,
|
||||
onLabelAdd: addLabelToCurrentCard,
|
||||
onLabelRemove: removeLabelFromCurrentCard,
|
||||
onLabelCreate: createLabelInCurrentBoard,
|
||||
@@ -108,7 +122,7 @@ const mapDispatchToProps = (dispatch) =>
|
||||
);
|
||||
|
||||
const mergeProps = (stateProps, dispatchProps) => ({
|
||||
...omit(stateProps, 'boardId'),
|
||||
...stateProps,
|
||||
...omit(dispatchProps, 'push'),
|
||||
onClose: () => dispatchProps.push(Paths.BOARDS.replace(':id', stateProps.boardId)),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user