ember-sortable
Version:
Sortable UI primitives for Ember.
89 lines (75 loc) • 2.29 kB
Markdown
To use modifiers, you must use angle-bracket syntax
1. Instead of using `sortable-group` as a component, use `sortable-group` as a modifier
any element. You no longer need to tell `sortable-group` about the models, so the `each`
uses the models directly.
**Old Component**
```hbs
{{
{{
```
**New Component**
```hbs
<ol {{sortable-group onChange=(action "reorderItems")}}>
{{
```
2. Each `item` can be represented by any dom element or component using angle-bracket syntax
**Old Component**
```hbs
{{
{{
{{
{{tem.name}}
{{/group.item}}
{{/each}}
{{/sortable-group}}
```
**New Component with modifier**
```hbs
<ol {{sortable-group onChange=(action "reorderItems")}}>
{{
<li {{sortable-item model=item}}>
{{tem.name}}
</li>
{{/each}}
</ol>
```
3. The Handle is also any element with a `sortable-handle` applied to it.
**Old Component**
```hbs
{{
{{
{{
{{modelItem.name}}
{{
<span class="handle">↕</span>
{{/item.handle}}
{{/group.item}}
{{/each}}
{{/sortable-group}}
```
**New Component with modifier**
```hbs
<ol {{sortable-group onChange=(action "reorderItems")}}>
{{
<li {{sortable-item model=item}}>
{{tem.name}}
<span class="handle" {{sortable-handle}}>↕</span>
</li>
{{/each}}
</ol>
```
4. The modifier `groupModel` property is no longer supported. The equivalent can
be accomplished by the `action` helper or the new `fn` helper.
```hbs
<ol {{sortable-group onChange=(action "reorderItems" model)}}>
{{
<li {{sortable-item model=item}}>
{{tem.name}}
<span class="handle" {{sortable-handle}}>↕</span>
</li>
{{/each}}
</ol>
```