Refactored how actions were passed
This commit is contained in:
parent
450d8b4036
commit
d30bf89db3
3 changed files with 16 additions and 6 deletions
|
@ -1,4 +1,5 @@
|
|||
<LinkTo
|
||||
{{on 'focus' @handleFocus}}
|
||||
{{on 'blur' @handleBlur}}
|
||||
@route="meal"
|
||||
@model={{@meal}}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<SortableGroupAccessible
|
||||
@models={{this.sortedItems}}
|
||||
as |groupHasFocus selectedIndex orderItemDown orderItemUp handleBlur|>
|
||||
as |groupHasFocus selectedIndex groupActions|>
|
||||
<SortableGroup
|
||||
@onChange={{action this.reorderMeals}}
|
||||
as |group|>
|
||||
|
@ -9,16 +9,17 @@
|
|||
@groupHasFocus={{groupHasFocus}}
|
||||
@currentIndex={{index}}
|
||||
@selectedIndex={{selectedIndex}}
|
||||
@orderItemDown={{orderItemDown}}
|
||||
@orderItemUp={{orderItemUp}}
|
||||
@handleBlur={{handleBlur}}>
|
||||
@orderItemDown={{groupActions.orderItemDown}}
|
||||
@orderItemUp={{groupActions.orderItemUp}}
|
||||
@handleBlur={{groupActions.handleBlur}}>
|
||||
<SortableItem
|
||||
@model={{meal}}
|
||||
@group={{group}}
|
||||
data-test-id="meal-item">
|
||||
<MealItem
|
||||
@meal={{meal}}
|
||||
@handleBlur={{handleBlur}}
|
||||
@handleFocus={{groupActions.handleFocus}}
|
||||
@handleBlur={{groupActions.handleBlur}}
|
||||
/>
|
||||
</SortableItem>
|
||||
</SortableItemAccessible>
|
||||
|
|
|
@ -8,5 +8,13 @@
|
|||
{{key-down this.preventDefault key='ArrowDown'}}
|
||||
tabindex="0"
|
||||
class="shadow-md bg-gray-200 outline-none border border-gray-400 focus:border-teal-400 focus:shadow-lg">
|
||||
{{yield this.groupHasFocus this.selectedIndex (action 'orderItemDown') (action 'orderItemUp') (action 'handleBlur')}}
|
||||
{{yield
|
||||
this.groupHasFocus
|
||||
this.selectedIndex
|
||||
(hash
|
||||
orderItemDown=(action 'orderItemDown')
|
||||
orderItemUp=(action 'orderItemUp')
|
||||
handleFocus=(action 'handleFocus')
|
||||
handleBlur=(action 'handleBlur')
|
||||
)}}
|
||||
</div>
|
||||
|
|
Loading…
Add table
Reference in a new issue