Created
March 1, 2017 20:21
-
-
Save jmimi/09083b26ea467379466b475ddc2d2c31 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
const Binder = Ember.Object.extend({ | |
id: Ember.computed(function() { | |
return Ember.guidFor(this); | |
}), | |
value: null, | |
//just for show and css manipulating in liquid-fire | |
removing: false, | |
binder: Ember.computed('removing', function(){ | |
return `${this.get('id')}-${this.get('removing')}`; | |
}) | |
}); | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle', | |
rawData: [{id: 1, name: 'Test 1'}, {id: 2, name: 'Test 2'}, {id: 3, name: 'Test 3'}, {id: 4, name: 'Test 4'}], | |
list: Ember.computed('rawData.[]', function(){ | |
return this.get('rawData').map(function(item){ | |
return Binder.create({ | |
value: item | |
}); | |
}); | |
}), | |
actions: { | |
removeItem(item){ | |
Ember.set(item, 'removing', true); | |
Ember.run.later(this, function() { | |
this.get('rawData').removeObject(item.value); | |
}, 1000); | |
} | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default function() { | |
this.transition( | |
this.matchSelector('.data-binder'), | |
this.toValue(function(value){ | |
return value.indexOf('true') > 0; | |
}), | |
this.use('fade', {duration: 1000}) | |
); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.11.0", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "2.10.2", | |
"ember-data": "2.11.0", | |
"ember-template-compiler": "2.10.2", | |
"ember-testing": "2.10.2" | |
}, | |
"addons": { | |
"liquid-fire": "0.27.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment