diff --git a/plugins/board-assets/lang/en.json b/plugins/board-assets/lang/en.json
index e5c4c2ca8f..ad6780e102 100644
--- a/plugins/board-assets/lang/en.json
+++ b/plugins/board-assets/lang/en.json
@@ -91,6 +91,9 @@
"DeleteCard": "All actions will be removed from the activity feed and you won’t be able to re-open the card. There is no undo.",
"SearchMembers": "Search members",
"Menu": "Menu",
- "ToArchive": "Archive"
+ "ToArchive": "Archive",
+ "CopyCard": "Copy card",
+ "AlsoCopy": "Keep...",
+ "CopyTo": "Copy to..."
}
}
diff --git a/plugins/board-assets/lang/ru.json b/plugins/board-assets/lang/ru.json
index 856d259414..367de6570b 100644
--- a/plugins/board-assets/lang/ru.json
+++ b/plugins/board-assets/lang/ru.json
@@ -91,6 +91,9 @@
"DeleteCard": "Все действия будут удалены из ленты, и вы не сможете повторно открыть карточку. Отмена невозможна.",
"SearchMembers": "Поиск участников",
"Menu": "Меню",
- "ToArchive": "Архивировать"
+ "ToArchive": "Архивировать",
+ "CopyCard": "Копировать карточку",
+ "AlsoCopy": "Также копировать...",
+ "CopyTo": "Копировать в..."
}
}
diff --git a/plugins/board-resources/src/components/popups/CopyCard.svelte b/plugins/board-resources/src/components/popups/CopyCard.svelte
new file mode 100644
index 0000000000..31513707dc
--- /dev/null
+++ b/plugins/board-resources/src/components/popups/CopyCard.svelte
@@ -0,0 +1,144 @@
+
+
+
diff --git a/plugins/board-resources/src/components/selectors/RankSelect.svelte b/plugins/board-resources/src/components/selectors/RankSelect.svelte
index cce535b99a..f8a5cf4ab8 100644
--- a/plugins/board-resources/src/components/selectors/RankSelect.svelte
+++ b/plugins/board-resources/src/components/selectors/RankSelect.svelte
@@ -12,6 +12,7 @@
export let label: IntlString
export let state: Ref
export let selected: string
+ export let isCopying: boolean = false
let ranks: DropdownTextItem[] = []
const tasksQuery = createQuery()
@@ -19,22 +20,29 @@
board.class.Card,
{ state },
async (result) => {
- ;[ranks] = [...result.filter((t) => t._id !== object._id), undefined].reduce<
- [DropdownTextItem[], Card | undefined]
- >(
+ const filteredResult = isCopying ? result : result.filter((t) => t._id !== object._id)
+
+ ;[ranks] = [...filteredResult, undefined].reduce<[DropdownTextItem[], Card | undefined]>(
([arr, prev], next) => [[...arr, { id: calcRank(prev, next), label: `${arr.length + 1}` }], next],
[[], undefined]
)
- ;[{ id: selected = object.rank }] = ranks.slice(-1)
+
+ let selectedRank = ranks.slice(-1)[0].id
if (object.state === state) {
const index = result.findIndex((t) => t._id === object._id)
- ranks[index] = {
- id: object.rank,
- label: await translate(board.string.Current, { label: ranks[index].label })
+
+ if (index !== -1) {
+ selectedRank = isCopying ? ranks[index].id : object.rank
+
+ ranks[index] = {
+ id: selectedRank,
+ label: await translate(board.string.Current, { label: ranks[index].label })
+ }
}
- selected = object.rank
}
+
+ selected = selectedRank
},
{ sort: { rank: SortingOrder.Ascending } }
)
diff --git a/plugins/board-resources/src/index.ts b/plugins/board-resources/src/index.ts
index 7f0bbc44db..8c68cf3f01 100644
--- a/plugins/board-resources/src/index.ts
+++ b/plugins/board-resources/src/index.ts
@@ -31,6 +31,7 @@ import AttachmentPicker from './components/popups/AttachmentPicker.svelte'
import CardLabelsPopup from './components/popups/CardLabelsPopup.svelte'
import MoveCard from './components/popups/MoveCard.svelte'
import DeleteCard from './components/popups/RemoveCard.svelte'
+import CopyCard from './components/popups/CopyCard.svelte'
import DateRangePicker from './components/popups/DateRangePicker.svelte'
import CardDatePresenter from './components/presenters/DatePresenter.svelte'
import CardLabelPresenter from './components/presenters/LabelPresenter.svelte'
@@ -56,6 +57,10 @@ async function showDeleteCardPopup (object: Card, client: Client, e?: Event): Pr
showPopup(DeleteCard, { object }, getPopupAlignment(e))
}
+async function showCopyCardPopup (object: Card, client: Client, e?: Event): Promise {
+ showPopup(CopyCard, { object, client }, getPopupAlignment(e))
+}
+
async function showDatePickerPopup (object: Card, client: Client, e?: Event): Promise {
showPopup(DateRangePicker, { object }, getPopupAlignment(e))
}
@@ -110,7 +115,8 @@ export default async (): Promise => ({
Archive: archiveCard,
SendToBoard: unarchiveCard,
Delete: showDeleteCardPopup,
- Members: showEditMembersPopup
+ Members: showEditMembersPopup,
+ Copy: showCopyCardPopup
},
cardActionSupportedHandler: {
Join: canAddCurrentUser,
diff --git a/plugins/board-resources/src/plugin.ts b/plugins/board-resources/src/plugin.ts
index 771b97ebb5..ff7d562259 100644
--- a/plugins/board-resources/src/plugin.ts
+++ b/plugins/board-resources/src/plugin.ts
@@ -112,7 +112,10 @@ export default mergeIds(boardId, board, {
SearchMembers: '' as IntlString,
DeleteCard: '' as IntlString,
Menu: '' as IntlString,
- ToArchive: '' as IntlString
+ ToArchive: '' as IntlString,
+ CopyCard: '' as IntlString,
+ AlsoCopy: '' as IntlString,
+ CopyTo: '' as IntlString
},
component: {
Boards: '' as AnyComponent,