IvyApp / ivy-sortable

Ember helper for interacting with jQuery UI's Sortable module.
http://ivyapp.github.io/ivy-sortable/
MIT License
10 stars 6 forks source link

`moved` action doesn't get triggered on controller #12

Open guatedude2 opened 9 years ago

guatedude2 commented 9 years ago

Hi @omghax I tested out the component with your fix. Seems like the action target object is the content item.

This is my example where content is a list of items in a model:

// app/templates/card-view.hbs
{{#collection "ivy-sortable" content=content moved="moveCard" revert="200" }}
  {{card details=this}}
{{/collection}}
// app/controllers/card-view.js
  import Ember from 'ember';

  export default Ember.ArrayController.extend({
    actions: {
      moveCard(card, oldIndex, newIndex) {
        console.log("CARD MOVED", card, oldIndex, newIndex);
      }
    }
  });

and the debug of sendAction is Line 80 in ivy_sortable/views/ivy-sortable.js

this.triggerAction({
  action: actionName, //this is "moveCard"
  actionContext: contexts //this is an individual card model
});

So the controller moveCard doesnt work