Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ember-ds-inline-edit

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ember-ds-inline-edit - npm Package Compare versions

Comparing version 0.3.8 to 0.3.9

25

addon/components/ds-inline-edit.js

@@ -66,10 +66,22 @@ import Ember from 'ember'

onEditSuccess(){
this._super(...arguments)
this.onUpdate && this.onUpdate(...arguments)
},
onEditError(error, previousValue){
this._super(...arguments)
const prop = this.get('prop')
this.set(`model.${prop}`, previousValue)
this.onError ? this.onError(...arguments) : console.error(error)
},
actions: {
confirmEdit(){
const model = this.get('model')
const prop = this.get('prop')
const { model, prop, value } = this.getProperties('model', 'prop', 'value')
const previousValue = model.get(prop)
this.set('isEditing', false)
model.set(prop, this.get('value'))
model.set(prop, value)

@@ -87,7 +99,4 @@ // only update the currently edited value

return model.save()
.then(updatedModel => this.onUpdate && this.onUpdate(updatedModel))
.catch(error => Ember.run(() => {
model.set(prop, previousValue)
this.onError ? this.onError(error) : console.error(error)
}))
.then(updatedModel => this.onEditSuccess(updatedModel))
.catch(error => this.onEditError(error, previousValue))
.finally(() => {

@@ -94,0 +103,0 @@ Object.keys(modifiedAttrs).forEach(a => {

{
"name": "ember-ds-inline-edit",
"version": "0.3.8",
"version": "0.3.9",
"bugs": {

@@ -5,0 +5,0 @@ "url": "https://github.com/IliasDeros/ember-ds-inline-edit/issues"

@@ -46,2 +46,14 @@ Edit an ember DS.model inline by clicking on it to toggle editor.

#### Extending this plugin
Feel free to extend `ds-inline-edit` using the following code :
```
// app/pods/components/ds-inline-edit
import DsInlineEdit from 'ds-inline-edit/components/ds-inline-edit'
export default DsInlineEdit.extend({})
```
You can override the `onEditSuccess` and `onEditError` functions for custom logic on all updates.
#### Keyboard Support

@@ -48,0 +60,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc