0.6.0 • Published 7 years ago

ds-inline-edit v0.6.0

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

DS-inline-edit

Edit an ember DS.model inline by clicking on it to toggle editor. Click outside or press escape to rollback change and cancel edit.

inspired by ember-inline-edit

Inline Edit Demo

Installation

ember install ember-ds-inline-edit

Usage

Use the ds-inline-edit component and provide it a model with the property to edit/display.

  {{ds-inline-edit
    model=model
    prop='name'
    onError='onError'
  }}

Customize input template using #ds-inline-edit :

  {{#ds-inline-edit model=person prop='age' as |age|}}
    {{input type="number" class="form-control" value=age}}
  {{/ds-inline-edit}}

Ember Data Integration

This plugin relies on a strict usage of Ember Data. An automatic model update is sent upon confirming edit.

If the prop is an object, the default display is the following property of the model : displayName > name > id

Only the property identified through prop is updated, the rest of the model remains uncommited.

Keyboard Support

Currently, the only way to confirm an edit is to hit enter.

Hitting esc or clicking outside the component will also discard the edit.

Error Handling

When an error occurs, an onError action is sent.