ember-drag-drop-multiple

0.0.4 • Public • Published

ember-drag-drop-multiple

npm version Ember Observer Score Build Status Code Climate

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.

Readme

Keywords

Package Sidebar

Install

npm i ember-drag-drop-multiple

Weekly Downloads

0

Version

0.0.4

License

MIT

Unpacked Size

10.9 kB

Total Files

12

Last publish

Collaborators

  • julien128
  • mechabear
  • alanlalonde
  • piknik
  • marcus_91
  • shadowere
  • alexandre.nadon1