Skip to content

Commit bd18bbd

Browse files
author
kaptron
committed
fix openMoveMenu when called from an item
1 parent b341f7a commit bd18bbd

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

.rubocop.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ Style/PercentLiteralDelimiters:
8181
'%w': '[]'
8282
'%W': '[]'
8383

84+
Style/AsciiComments:
85+
AllowedChars:
86+
- ''
87+
8488
Style/AndOr:
8589
# `and` and `or` banned only in conditionals (conditionals), or completely (always).
8690
EnforcedStyle: 'always'

app/javascript/stores/UiStore.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,8 +403,8 @@ export default class UiStore {
403403
}
404404

405405
@action
406-
openMoveMenu({ from, cardAction = 'move', context = null }) {
407-
const { id: fromCollectionId } = from
406+
openMoveMenu({ from = null, cardAction = 'move', context = null }) {
407+
const fromCollectionId = from ? from.id : null
408408
this.dismissedMoveHelper = false
409409
this.pageMenuOpen = false
410410
this.closeCardMenu()

app/javascript/ui/grid/ActionMenu.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,10 @@ class ActionMenu extends React.Component {
5454

5555
openMoveMenu = cardAction => {
5656
const { card, onMoveMenu, uiStore } = this.props
57-
const { viewingCollection } = uiStore
57+
let { viewingCollection } = uiStore
58+
if (!viewingCollection) {
59+
viewingCollection = card.record.parent ? card.record.parent.id : null
60+
}
5861
if (onMoveMenu) onMoveMenu({ type: cardAction })
5962
uiStore.selectCardId(card.id)
6063
uiStore.openMoveMenu({ from: viewingCollection, cardAction })

0 commit comments

Comments
 (0)