-
-
Save kumkanillam/79b79497f8f927ccef45 to your computer and use it in GitHub Desktop.
New Twiddle
This file contains 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 DS from 'ember-data'; | |
export default DS.RESTAdapter; |
This file contains 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'; | |
export default Ember.Controller.extend({ | |
saveUser(user) { | |
Ember.run.debounce(user, 'save', 250); | |
}, | |
actions: { | |
saveName(user, event) { | |
user.set('name', event.target.value); | |
this.saveUser(user); | |
}, | |
saveCoolness(user, event) { | |
user.set('isCool', event.target.checked); | |
this.saveUser(user); | |
}, | |
saveDescription(user, event) { | |
user.set('description', event.target.value); | |
this.saveUser(user); | |
} | |
} | |
}); |
This file contains 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'; | |
$.mockjax({ | |
type: 'GET', | |
url: '/users/314', | |
status: '200', | |
dataType: 'json', | |
responseText: { | |
user: { | |
id: '314', | |
isCool: true, | |
name: "Bob", | |
description: "He's a great guy." | |
} | |
} | |
}); | |
$.mockjax({ | |
type: 'PUT', | |
url: '/users/314', | |
status: '200', | |
dataType: 'json', | |
responseText: {} | |
}); | |
export default Ember.Route.extend({ | |
model() { | |
return this.store.findRecord('user', '314'); | |
} | |
}); |
This file contains 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 DS from 'ember-data'; | |
export default DS.Model.extend({ | |
isCool: DS.attr(), | |
name: DS.attr(), | |
description: DS.attr() | |
}); |
This file contains 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.5.0", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"jquery-mockjack": "https://cdnjs.cloudflare.com/ajax/libs/jquery-mockjax/1.5.3/jquery.mockjax.js", | |
"ember": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.2.0/ember.debug.js", | |
"ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/2.2.0/ember-data.js", | |
"ember-template-compiler": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.2.0/ember-template-compiler.js" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment