Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Curry item models in events for Draggables and Droppables #17

Open
billdami opened this issue Mar 14, 2019 · 0 comments
Open

Curry item models in events for Draggables and Droppables #17

billdami opened this issue Mar 14, 2019 · 0 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@billdami
Copy link
Member

Right now the functionality of {{draggable-group}} and {{droppable-group}} are pretty bare-bones. They are good building blocks for more complex functionality, but on their own, they don't do much more than emitting the basic events when items are dragged and dropped.

One thing we can do to increase their usefulness is when events are emitted, instead of only sending an argument with the raw event to the action, also send along an optional "model" that is associated with the item that was dragged, dropped, etc.

For example:

<DroppableGroup
    @droppableActions={{hash
        dropped=(action "droppableDropped")
    }}
    as |Group|
>
    <Group.container as |Container|>
        <Container.dropzone as |Dropzone|}}
            <Dropzone.item @item={{item}}>{{item.name}}</Dropzone.item>
        </Container.dropzone>
        <Container.dropzone as |Dropzone|></Container.dropzone>
    </Group.container>
<DroppableGroup>
actions: {
    droppableDropped(event, item) {
        console.log(`The item/model that was dropped was ${item.name}`);
    }
}
@billdami billdami added enhancement New feature or request help wanted Extra attention is needed labels Mar 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant