├── app ├── views │ └── .gitkeep ├── components │ ├── .gitkeep │ └── contact-card.js ├── helpers │ └── .gitkeep ├── models │ ├── .gitkeep │ └── contact.js ├── routes │ ├── .gitkeep │ ├── .contacts.js.swo │ ├── contacts │ │ └── show.js │ ├── contacts.js │ └── contact.js ├── controllers │ ├── .gitkeep │ └── contacts.js ├── templates │ ├── components │ │ ├── .gitkeep │ │ └── contact-card.hbs │ ├── index.hbs │ ├── contact.hbs │ ├── contacts │ │ └── show.hbs │ ├── application.hbs │ └── contacts.hbs ├── adapters │ └── application.js ├── mirage │ ├── factories │ │ ├── .contact.js.swo │ │ └── contact.js │ ├── scenarios │ │ └── default.js │ └── config.js ├── router.js ├── app.js ├── styles │ └── app.css └── index.html ├── vendor └── .gitkeep ├── tests ├── unit │ ├── .gitkeep │ ├── routes │ │ ├── contact-test.js │ │ ├── contacts-test.js │ │ └── contacts │ │ │ └── show-test.js │ ├── models │ │ └── contact-test.js │ ├── controllers │ │ └── contacts-test.js │ └── adapters │ │ └── application-test.js ├── test-helper.js ├── helpers │ ├── resolver.js │ └── start-app.js ├── acceptance │ └── list-contacts-test.js ├── integration │ └── components │ │ └── contact-card-test.js ├── .jshintrc └── index.html ├── .watchmanconfig ├── public ├── robots.txt └── crossdomain.xml ├── .bowerrc ├── testem.json ├── .ember-cli ├── .gitignore ├── .travis.yml ├── .jshintrc ├── .editorconfig ├── bower.json ├── highlight.css ├── Brocfile.js ├── ember-cli-build.js ├── package.json ├── config └── environment.js ├── README.md └── config.js.html /app/views/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vendor/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/components/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/helpers/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/models/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/routes/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/unit/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/controllers/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/templates/components/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/templates/index.hbs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /.watchmanconfig: -------------------------------------------------------------------------------- 1 | { 2 | "ignore_dirs": ["tmp"] 3 | } 4 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # http://www.robotstxt.org 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /.bowerrc: -------------------------------------------------------------------------------- 1 | { 2 | "directory": "bower_components", 3 | "analytics": false 4 | } 5 | -------------------------------------------------------------------------------- /app/templates/contact.hbs: -------------------------------------------------------------------------------- 1 |
{{model.description}}
4 | {{outlet}} 5 | -------------------------------------------------------------------------------- /app/routes/.contacts.js.swo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheanyi/front-porch-demo/master/app/routes/.contacts.js.swo -------------------------------------------------------------------------------- /app/adapters/application.js: -------------------------------------------------------------------------------- 1 | import DS from 'ember-data'; 2 | 3 | export default DS.RESTAdapter.extend({ 4 | namespace: 'api' 5 | }); 6 | -------------------------------------------------------------------------------- /app/mirage/factories/.contact.js.swo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheanyi/front-porch-demo/master/app/mirage/factories/.contact.js.swo -------------------------------------------------------------------------------- /tests/test-helper.js: -------------------------------------------------------------------------------- 1 | import resolver from './helpers/resolver'; 2 | import { setResolver } from 'ember-mocha'; 3 | 4 | setResolver(resolver); 5 | -------------------------------------------------------------------------------- /app/templates/components/contact-card.hbs: -------------------------------------------------------------------------------- 1 |{{contact.description}}
5 |E-Mail: {{model.email}}
4 | 5 |{{model.description}}
6 | 7 | {{outlet}} 8 | -------------------------------------------------------------------------------- /app/components/contact-card.js: -------------------------------------------------------------------------------- 1 | import Ember from 'ember'; 2 | 3 | export default Ember.Component.extend({ 4 | 5 | actions: { 6 | someAction: function() { 7 | 8 | } 9 | } 10 | }); 11 | -------------------------------------------------------------------------------- /app/controllers/contacts.js: -------------------------------------------------------------------------------- 1 | import Ember from 'ember'; 2 | 3 | export default Ember.Controller.extend({ 4 | sortProperties: ['fullName'], 5 | sortedContacts: Ember.computed.sort('model', 'sortProperties') 6 | }); 7 | -------------------------------------------------------------------------------- /app/mirage/scenarios/default.js: -------------------------------------------------------------------------------- 1 | export default function( server ) { 2 | 3 | // Seed your development database using your factories. This 4 | // data will not be loaded in your tests. 5 | 6 | server.createList('contact', 10); 7 | } 8 | -------------------------------------------------------------------------------- /app/routes/contacts.js: -------------------------------------------------------------------------------- 1 | // app/routes/contact.js 2 | import Ember from 'ember'; 3 | 4 | export default Ember.Route.extend({ 5 | model() { 6 | // fetches every contact from api/contacts 7 | return this.store.find('contact'); 8 | } 9 | }); 10 | -------------------------------------------------------------------------------- /testem.json: -------------------------------------------------------------------------------- 1 | { 2 | "framework": "qunit", 3 | "test_page": "tests/index.html?hidepassed", 4 | "disable_watching": true, 5 | "launch_in_ci": [ 6 | "PhantomJS" 7 | ], 8 | "launch_in_dev": [ 9 | "PhantomJS", 10 | "Chrome" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /.ember-cli: -------------------------------------------------------------------------------- 1 | { 2 | /** 3 | Ember CLI sends analytics information by default. The data is completely 4 | anonymous, but there are times when you might want to disable this behavior. 5 | 6 | Setting `disableAnalytics` to true will prevent any data from being sent. 7 | */ 8 | "disableAnalytics": false 9 | } 10 | -------------------------------------------------------------------------------- /tests/helpers/resolver.js: -------------------------------------------------------------------------------- 1 | import Resolver from 'ember/resolver'; 2 | import config from '../../config/environment'; 3 | 4 | var resolver = Resolver.create(); 5 | 6 | resolver.namespace = { 7 | modulePrefix: config.modulePrefix, 8 | podModulePrefix: config.podModulePrefix 9 | }; 10 | 11 | export default resolver; 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /tmp 6 | 7 | # dependencies 8 | /node_modules 9 | /bower_components 10 | 11 | # misc 12 | /.sass-cache 13 | /connect.lock 14 | /coverage/* 15 | /libpeerconnection.log 16 | npm-debug.log 17 | testem.log 18 | *.swp 19 | -------------------------------------------------------------------------------- /tests/unit/routes/contact-test.js: -------------------------------------------------------------------------------- 1 | import { 2 | moduleFor, 3 | test 4 | } from 'ember-qunit'; 5 | 6 | moduleFor('route:contact', { 7 | // Specify the other units that are required for this test. 8 | // needs: ['controller:foo'] 9 | }); 10 | 11 | test('it exists', function(assert) { 12 | var route = this.subject(); 13 | assert.ok(route); 14 | }); 15 | -------------------------------------------------------------------------------- /tests/unit/routes/contacts-test.js: -------------------------------------------------------------------------------- 1 | import { 2 | moduleFor, 3 | test 4 | } from 'ember-qunit'; 5 | 6 | moduleFor('route:contacts', { 7 | // Specify the other units that are required for this test. 8 | // needs: ['controller:foo'] 9 | }); 10 | 11 | test('it exists', function(assert) { 12 | var route = this.subject(); 13 | assert.ok(route); 14 | }); 15 | -------------------------------------------------------------------------------- /tests/unit/routes/contacts/show-test.js: -------------------------------------------------------------------------------- 1 | import { 2 | moduleFor, 3 | test 4 | } from 'ember-qunit'; 5 | 6 | moduleFor('route:contacts/show', { 7 | // Specify the other units that are required for this test. 8 | // needs: ['controller:foo'] 9 | }); 10 | 11 | test('it exists', function(assert) { 12 | var route = this.subject(); 13 | assert.ok(route); 14 | }); 15 | -------------------------------------------------------------------------------- /tests/unit/models/contact-test.js: -------------------------------------------------------------------------------- 1 | import { 2 | moduleForModel, 3 | test 4 | } from 'ember-qunit'; 5 | 6 | moduleForModel('contact', { 7 | // Specify the other units that are required for this test. 8 | needs: [] 9 | }); 10 | 11 | test('it exists', function(assert) { 12 | var model = this.subject(); 13 | // var store = this.store(); 14 | assert.ok(!!model); 15 | }); 16 | -------------------------------------------------------------------------------- /app/router.js: -------------------------------------------------------------------------------- 1 | import Ember from 'ember'; 2 | import config from './config/environment'; 3 | 4 | var Router = Ember.Router.extend({ 5 | location: config.locationType 6 | }); 7 | 8 | export default Router.map(function() { 9 | this.route('contacts', function() { 10 | this.route('show', {path: '/:id'}); 11 | }); 12 | 13 | //this.route('contact', {path: '/contacts/:id'}); 14 | }); 15 | -------------------------------------------------------------------------------- /tests/unit/controllers/contacts-test.js: -------------------------------------------------------------------------------- 1 | import { 2 | moduleFor, 3 | test 4 | } from 'ember-qunit'; 5 | 6 | moduleFor('controller:contacts', { 7 | // Specify the other units that are required for this test. 8 | // needs: ['controller:foo'] 9 | }); 10 | 11 | // Replace this with your real tests. 12 | test('it exists', function(assert) { 13 | var controller = this.subject(); 14 | assert.ok(controller); 15 | }); 16 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | --- 2 | language: node_js 3 | node_js: 4 | - "0.12" 5 | 6 | sudo: false 7 | 8 | cache: 9 | directories: 10 | - node_modules 11 | 12 | before_install: 13 | - export PATH=/usr/local/phantomjs-2.0.0/bin:$PATH 14 | - "npm config set spin false" 15 | - "npm install -g npm@^2" 16 | 17 | install: 18 | - npm install -g bower 19 | - npm install 20 | - bower install 21 | 22 | script: 23 | - npm test 24 | -------------------------------------------------------------------------------- /app/routes/contact.js: -------------------------------------------------------------------------------- 1 | import Ember from 'ember'; 2 | 3 | export default Ember.Route.extend({ 4 | model(params) { 5 | 6 | /*this.store.filter('contact', function(contact) { 7 | return contact.get('firstName')[0] === "A"; 8 | });*/ 9 | 10 | return this.store.find('contact', params.id).then(function(contact) { 11 | contact.set('firstName', 'Iheanyi'); 12 | contact.save(); 13 | }); 14 | } 15 | }); 16 | -------------------------------------------------------------------------------- /tests/unit/adapters/application-test.js: -------------------------------------------------------------------------------- 1 | import { 2 | moduleFor, 3 | test 4 | } from 'ember-qunit'; 5 | 6 | moduleFor('adapter:application', 'ApplicationAdapter', { 7 | // Specify the other units that are required for this test. 8 | // needs: ['serializer:foo'] 9 | }); 10 | 11 | // Replace this with your real tests. 12 | test('it exists', function(assert) { 13 | var adapter = this.subject(); 14 | assert.ok(adapter); 15 | }); 16 | -------------------------------------------------------------------------------- /app/templates/application.hbs: -------------------------------------------------------------------------------- 1 | 15 | {{outlet}} 16 | -------------------------------------------------------------------------------- /app/models/contact.js: -------------------------------------------------------------------------------- 1 | // app/models/contact.js 2 | import DS from 'ember-data'; 3 | 4 | export default DS.Model.extend({ 5 | firstName: DS.attr('string'), 6 | lastName: DS.attr('string'), 7 | avatar: DS.attr('string'), 8 | email: DS.attr('string'), 9 | description: DS.attr('string'), 10 | fullName: Ember.computed('firstName', 'lastName', function(key, value) { 11 | return `${this.get('firstName')} ${this.get('lastName')}`; 12 | }) 13 | }); 14 | -------------------------------------------------------------------------------- /app/app.js: -------------------------------------------------------------------------------- 1 | import Ember from 'ember'; 2 | import Resolver from 'ember/resolver'; 3 | import loadInitializers from 'ember/load-initializers'; 4 | import config from './config/environment'; 5 | 6 | var App; 7 | 8 | Ember.MODEL_FACTORY_INJECTIONS = true; 9 | 10 | App = Ember.Application.extend({ 11 | modulePrefix: config.modulePrefix, 12 | podModulePrefix: config.podModulePrefix, 13 | Resolver: Resolver 14 | }); 15 | 16 | loadInitializers(App, config.modulePrefix); 17 | 18 | export default App; 19 | -------------------------------------------------------------------------------- /app/styles/app.css: -------------------------------------------------------------------------------- 1 | /*@import 'bootstrap'; 2 | */ 3 | 4 | 5 | .contacts__sidebar { 6 | width: 30%; 7 | float: left; 8 | } 9 | 10 | .contacts__detail { 11 | width: 70%; 12 | } 13 | 14 | .contacts__list { 15 | list-style: none; 16 | padding: 0; 17 | } 18 | 19 | .contacts__list__item { 20 | margin: 8px 0; 21 | } 22 | 23 | .contact__sidebar__picture { 24 | border-radius: 50%; 25 | height: 50px; 26 | width: 50px; 27 | } 28 | 29 | .contact__sidebar__name { 30 | margin-left: 8px; 31 | } 32 | -------------------------------------------------------------------------------- /tests/helpers/start-app.js: -------------------------------------------------------------------------------- 1 | import Ember from 'ember'; 2 | import Application from '../../app'; 3 | import config from '../../config/environment'; 4 | 5 | export default function startApp(attrs) { 6 | var application; 7 | 8 | var attributes = Ember.merge({}, config.APP); 9 | attributes = Ember.merge(attributes, attrs); // use defaults, but you can override; 10 | 11 | Ember.run(function() { 12 | application = Application.create(attributes); 13 | application.setupForTesting(); 14 | application.injectTestHelpers(); 15 | }); 16 | 17 | return application; 18 | } 19 | -------------------------------------------------------------------------------- /public/crossdomain.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 |export default function() { 10 | this.namespace = '/api'; 11 | 12 | this.get('/contacts', function(db) { 13 | return {contacts: db.contacts}; 14 | }); 15 | 16 | this.get('/contacts/:id', function(db, request) { 17 | return {contacts: db.contacts.find(request.params.id)}; 18 | }); 19 | 20 | // These comments are here to help you get started. Feel free to delete them. 21 | // 22 | 23 | /* 24 | Config (with defaults). 25 | 26 | Note: these only affect routes defined *after* them! 27 | */ 28 | // this.namespace = ''; // make this `api`, for example, if your API is namespaced 29 | // this.timing = 400; // delay for each request, automatically set to 0 during testing 30 | 31 | /* 32 | Route shorthand cheatsheet 33 | */ 34 | /* 35 | GET shorthands 36 | 37 | // Collections 38 | this.get('/contacts'); 39 | this.get('/contacts', 'users'); 40 | this.get('/contacts', ['contacts', 'addresses']); 41 | 42 | // Single objects 43 | this.get('/contacts/:id'); 44 | this.get('/contacts/:id', 'user'); 45 | this.get('/contacts/:id', ['contact', 'addresses']); 46 | */ 47 | 48 | /* 49 | POST shorthands 50 | 51 | this.post('/contacts'); 52 | this.post('/contacts', 'user'); // specify the type of resource to be created 53 | */ 54 | 55 | /* 56 | PUT shorthands 57 | 58 | this.put('/contacts/:id'); 59 | this.put('/contacts/:id', 'user'); // specify the type of resource to be updated 60 | */ 61 | 62 | /* 63 | DELETE shorthands 64 | 65 | this.del('/contacts/:id'); 66 | this.del('/contacts/:id', 'user'); // specify the type of resource to be deleted 67 | 68 | // Single object + related resources. Make sure parent resource is first. 69 | this.del('/contacts/:id', ['contact', 'addresses']); 70 | */ 71 | 72 | /* 73 | Function fallback. Manipulate data in the db via 74 | 75 | - db.{collection} 76 | - db.{collection}.find(id) 77 | - db.{collection}.where(query) 78 | - db.{collection}.update(target, attrs) 79 | - db.{collection}.remove(target) 80 | 81 | // Example: return a single object with related models 82 | this.get('/contacts/:id', function(db, request) { 83 | var contactId = +request.params.id; 84 | 85 | return { 86 | contact: db.contacts.find(contactId), 87 | addresses: db.addresses.where({contact_id: contactId}); 88 | }; 89 | }); 90 | 91 | */ 92 | } 93 | 94 | /* 95 | You can optionally export a config that is only loaded during tests 96 | export function testConfig() { 97 | 98 | } 99 | */ 100 |101 | 102 | 103 | 104 | --------------------------------------------------------------------------------