GithubHelp home page GithubHelp logo

isabella232 / ivy-sortable Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ivyapp/ivy-sortable

0.0 0.0 0.0 1.67 MB

Ember helper for interacting with jQuery UI's Sortable module.

Home Page: http://ivyapp.github.io/ivy-sortable/

License: MIT License

JavaScript 82.73% Shell 6.93% HTML 7.44% CSS 0.16% Handlebars 2.75%

ivy-sortable's Introduction

ivy-sortable

Build Status

An Ember component for jQuery UI's Sortable Widget.

Installation

As an ember-cli addon:

npm install --save-dev ivy-sortable
ember generate ivy-sortable

Or if you aren't using ember-cli, you can use this library as a standalone Bower package:

bower install --save ivy-sortable

...and then add the ivy-sortable.js script to your page.

Usage

Use the ivy-sortable view with Ember's built-in collection helper.

{{#collection "ivy-sortable" content=people}}
  Greetings, {{name}}!
{{/collection}}

This will output a sortable list, and dragging and dropping items will reorder them in the corresponding array (in this case, people). There is also a moved action that will fire after an item has been moved, in case you want to take further action:

{{#collection content=people moved="movePerson"}}
  Greetings, {{name}}!
{{/collection}}

In this case the movePerson handler will be called with the item that has been moved, and its old and new index:

App.ApplicationController = Ember.Controller.extend({
  actions: {
    movePerson: function(person, oldIndex, newIndex) {
      // ...
    }
  }
});

The following jQuery UI Sortable options are supported:

  • axis
  • containment
  • cursorAt
  • cursor
  • delay
  • disabled
  • distance
  • forceHelperSize
  • forcePlaceholderSize
  • grid
  • handle
  • helper
  • opacity
  • placeholder
  • revert
  • scrollSensitivity
  • scrollSpeed
  • scroll
  • tolerance
  • zIndex

If there's an option that you need that isn't supported, you can easily add it in your own app by extending from 'ivy-sortable/views/ivy-sortable' and adding it to the uiOptions property like so:

import IvySortableView from 'ivy-sortable/views/ivy-sortable';

export default IvySortableView.extend({
  uiOptions: [
    'someOtherOption'
  ]
});

Contributing

Fork this repo, make a new branch, and send a pull request. Make sure your change is tested or it won't be merged.

To run tests:

git clone # <this repo>
npm install
npm test

Or, to start a test server that continually runs (for development):

ember test --server

ivy-sortable's People

Contributors

omghax avatar toddsmithsalter avatar kategengler avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.