ember-drag-drop-multiple
v0.0.4
Published
Ember addon that adds multi-selection functionalities to ember-drag-drop.
Downloads
3
Keywords
Readme
ember-drag-drop-multiple
Description
This Ember Addon exposes a component adding multiple selection functionalities to ember-drag-drop
Installation
ember install ember-drag-drop-multiple
Docs
Dragging multiple objects
TODO
Here's an example of how that would be accomplished:
{{#draggable-object-target action=(action 'increaseRating')}}
Drag here to increase rating
{{/draggable-object-target}}
<br>
{{#selectable-objects as |so|}}
{{#each model as |post|}}
{{#so.object content=post}}
{{post.title}} [ Rating: {{post.rating}} ]
{{/so.object}}
{{/each}}
{{/selectable-objects}}
import Ember from 'ember';
const { Controller, isArray } = Ember;
export default Controller.extend({
actions: {
increaseRating(payload, options) {
if (isArray(payload)) {
payload.map(post => post.incrementProperty('rating', 1));
} else {
payload.incrementProperty('rating', 1);
}
}
}
});
Change the drag image
If you wish to change the style of your draggable-object
when it's being dragged, simply provide an element selector using the dragImageSelector
property and the element will be set as the drag image.
{{#draggable-object dragImageSelector=".drag-image"}}
Drag Me
{{/draggable-object}}
<div class="drag-image">Drag Image</div>
License
This project is licensed under the MIT License.