Last active
September 22, 2017 20:49
-
-
Save Bestra/e2bd7210727e934a0fe9bca2762ced11 to your computer and use it in GitHub Desktop.
Rolodex Test Page
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({ | |
appName: 'A Really Simple Rolodex', | |
newEntry: null, | |
entries: Ember.computed.alias('model'), | |
showForm: false, | |
actions: { | |
addEntry() { | |
this.set('newEntry', {}); | |
this.set('showForm', true); | |
}, | |
saveEntry() { | |
this.get('entries').pushObject(this.get('newEntry')); | |
this.set('showForm', false); | |
} | |
} | |
}); |
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 Collection from 'ember-cli-mirage/orm/collection'; | |
export default function() { | |
window.server = this; | |
this.get('/entries', function (schema, request) { | |
var entries = [ | |
{firstName: "Bob", lastName: "Jones", phone: "123-4455"}, | |
{firstName: "Jeff", lastName: "Davidson", phone: "551-1830"}, | |
]; | |
return entries; | |
}); | |
}; |
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.Route.extend({ | |
model() { | |
return $.get('/entries'); | |
}, | |
afterModel(model) { | |
console.log('model is ', model); | |
} | |
}); |
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
body { | |
margin: 12px 16px; | |
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; | |
font-size: 12pt; | |
} | |
.contacts-header { | |
display: inline-block; | |
} | |
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.12.1", | |
"ENV": { | |
"ember-cli-mirage": { | |
"enabled": true | |
} | |
}, | |
"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.12.0", | |
"ember-template-compiler": "2.12.0", | |
"ember-testing": "2.12.0" | |
}, | |
"addons": { | |
"ember-data": "2.12.1", | |
"ember-cli-mirage": "0.3.3" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment