Skip to content

Commit d2003aa

Browse files
Merge pull request #572 from mkszepp/update-readme
Add info about `grid` direction into readme and minimal fixes
2 parents 1eb6996 + 3fd8c1c commit d2003aa

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

README.md

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
# ember-sortable
22

33
[![npm version](https://badge.fury.io/js/ember-sortable.svg)](http://badge.fury.io/js/ember-sortable)
4-
[![Build Status](https://github.com/adopted-ember-addons/ember-sortable/workflows/build/badge.svg?branch=master)](https://github.com/adopted-ember-addons/ember-sortable/actions?query=branch%3Amaster+workflow%3A%22build%22)
4+
[![Build Status](https://github.com/adopted-ember-addons/ember-sortable/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/adopted-ember-addons/ember-sortable/actions?query=branch%3Amaster)
55
[![Downloads Weekly](https://img.shields.io/npm/dw/ember-sortable)](http://badge.fury.io/js/ember-sortable)
66
[![Ember Observer Score](http://emberobserver.com/badges/ember-sortable.svg)](http://emberobserver.com/addons/ember-sortable)
77
[![Code Climate](https://codeclimate.com/github/jgwhite/ember-sortable/badges/gpa.svg)](https://codeclimate.com/github/jgwhite/ember-sortable)
88

99
Sortable UI primitives for Ember.
1010

11-
![ember-sortable in action](/demo.gif)
12-
1311
[Check out the demo](https://ember-sortable.netlify.app/)
1412

1513
## Requirements
@@ -82,18 +80,22 @@ The modifier version does not support `groupModel`, use the currying of `action`
8280

8381
### Changing sort direction
8482

85-
To change sort direction, define `direction` on `sortable-group` (default is `y`):
83+
To change sort direction, define `direction` on `sortable-group`
84+
Possible values are:
85+
- `y` (default): allowes to move items up/down
86+
- `x`: allowes to move items left/right
87+
- `grid`: items can be moved in all directions inside a group
8688

8789
```hbs
88-
<ol {{sortable-group direction="x" onChange=(action "reorderItems")}>
90+
<ol {{sortable-group direction="x" onChange=this.reorderItems}}>
8991
```
9092

9193
### Changing spacing between currently dragged element and the rest of the group
9294

93-
When user starts to drag element, other elements jump back. Works both for the `x` and `y` direction option.
95+
When user starts to drag element, other elements jump back. Works for all direction option.
9496

9597
In `y` case: elements above current one jump up, and elements below current one - jump down.
96-
In `x` case: elements before current one jump to the left, and elements after current one - jump to the right.
98+
In `x` / `grid` case: elements before current one jump to the left, and elements after current one - jump to the right.
9799

98100
To change this property, define `spacing` on `sortable-item` (default is `0`):
99101

@@ -135,7 +137,7 @@ The classes look like this:
135137
<li class="sortable-item is-activated">...</li>
136138
```
137139

138-
In our [example app.css](tests/dummy/app/styles/app.css) we apply a
140+
In our [example app.css](docs/app/styles/app.css) we apply a
139141
transition of `.125s` in the default case:
140142

141143
```css
@@ -174,7 +176,7 @@ removed. Use this class to add a visual indicator that the item is selected and
174176
### Drag Actions
175177

176178
The `onDragStart` and `onDragStop` actions are available for the
177-
`sortable-item`s. You can provide an action name to listen to these actions to
179+
`sortable-item`s. You can provide an action to listen to these actions to
178180
be notified when an item is being dragged or not.
179181

180182
When the action is called, the item's model will be provided as the only
@@ -402,24 +404,30 @@ For modifiers, please read this [migration guide](/MIGRATION_GUIDE_MODIFIERS.md)
402404

403405
## Developing
404406

407+
### Requirement
408+
409+
You need to install nodejs and [pnpm](https://pnpm.io/installation).
410+
The specific versions you need, you can find [here](package.json#L19-L22)
411+
405412
### Setup
406413

407414
```sh
408415
$ git clone [email protected]:adopted-ember-addons/ember-sortable
409416
$ cd ember-sortable
410-
$ ember install
417+
$ pnpm install
411418
```
412419

413420
### Dev Server
414421

415422
```sh
423+
$ cd test-app
416424
$ ember serve
417425
```
418426

419427
### Running Tests
420428

421429
```sh
422-
$ npm test
430+
$ pnpm run test
423431
```
424432

425433
### Publishing Demo

0 commit comments

Comments
 (0)