Component working on a collection


#1

Hi guys! I would like some guideline help: I’m working on this addon: https://github.com/bitzik/ember-drag-drop-list it is working (well I need to write test and get ride of some junk code but overall it works) but for now one must use it like this:

{{#each blah as | bla |}}
    {{#dnd-item list=blah item=bla}}
        {{render your bla as you want }}
    {{/dnd-item}}
{{/each}}

And I am not quite satisfied by this syntax.

How would I go about if I wanted to allow people to use it like that:

{{#dnd-each blah as |bla|}}
    {{render the bla as you please}}
{{/dnd-each}}

Is that something I should aim for or should I stick with the previous syntax? What would be the most Emberish-way?


#2

for https://github.com/krisselden/draggable-each we used collection view, and made it behave as a component: https://github.com/krisselden/draggable-each/blob/master/app/components/draggable-each.js#L55

Not really ideal, plans exist to enable this in an easier way, but its not currently trivial


#3

Thanks! I’ll check that out. I will first release the addon with the item syntax I think and add the other one after.