Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Restoring Sanity to JavaScript Development with Ember 2

Restoring Sanity to JavaScript Development with Ember 2

Are you overwhelmed by JavaScript framework fatigue? Do you wish for the benefits of the newest front-end advancements without continually rewriting your application? Let's take a look at the latest version of Ember. We'll review the tooling, debugging, and addons that have made Ember a growing choice for innovative companies like Heroku, Travis CI, Square, and Nest. See how Ember adopts the best from other frameworks while bringing us the future of JavaScript today. You'll leave this session with a clear understanding of how Ember fits into your front-end toolbox and why it might be the ideal choice for your next project.

Kevin Pfefferle

January 08, 2016
Tweet

More Decks by Kevin Pfefferle

Other Decks in Technology

Transcript

  1. <p>Super Rentals Representatives would love to help you choose a

    destination or answer any questions you may have.</p> <p>Contact us today:</p> <p> Super Rentals HQ<br> 1212 Test Address Avenue<br> Testington, OR 97233 </p> <p>(503)555-1212</p> <p>[email protected]</p> {{#link-to "about"}}About{{/link-to}}
  2. <p>Super Rentals Representatives would love to help you choose a

    destination or answer any questions you may have.</p> <p>Contact us today:</p> <p> Super Rentals HQ<br> 1212 Test Address Avenue<br> Testington, OR 97233 </p> <p>(503)555-1212</p> <p>[email protected]</p> {{#link-to "about"}}About{{/link-to}}
  3. // app/templates/components/rental-listing.hbs <h2>{{rental.title}}</h2> <p>Owner: {{rental.owner}}</p> <p>Type: {{rental.type}}</p> <p>Location: {{rental.city}}</p> <p>Number

    of bedrooms: {{rental.bedrooms}}</p> {{#if isImageShowing }} <p><img src={{rental.image}} alt={{rental.type}} width="500px"></p> {{else}} <button>Show image</button> {{/if}}
  4. // app/templates/components/rental-listing.hbs <h2>{{rental.title}}</h2> <p>Owner: {{rental.owner}}</p> <p>Type: {{rental.type}}</p> <p>Location: {{rental.city}}</p> <p>Number

    of bedrooms: {{rental.bedrooms}}</p> {{#if isImageShowing }} <p><img src={{rental.image}} 
 alt={{rental.type}} width="500px"></p> {{else}} <button>Show image</button> {{/if}}
  5. // app/templates/components/rental-listing.hbs <h2>{{rental.title}}</h2> <p>Owner: {{rental.owner}}</p> <p>Type: {{rental.type}}</p> <p>Location: {{rental.city}}</p> <p>Number

    of bedrooms: {{rental.bedrooms}}</p> {{#if isImageShowing }} <p><img src={{rental.image}} 
 alt={{rental.type}} width="500px"></p> {{else}} <button>Show image</button> {{/if}}
  6. // app/templates/components/rental-listing.hbs <h2>{{rental.title}}</h2> <p>Owner: {{rental.owner}}</p> <p>Type: {{rental.type}}</p> <p>Location: {{rental.city}}</p> <p>Number

    of bedrooms: {{rental.bedrooms}}</p> {{#if isImageShowing }} <p><img src={{rental.image}} 
 alt={{rental.type}} width="500px"></p> {{else}} <button>Show image</button> {{/if}}
  7. // app/templates/components/rental-listing.hbs <h2>{{rental.title}}</h2> <p>Owner: {{rental.owner}}</p> <p>Type: {{rental.type}}</p> <p>Location: {{rental.city}}</p> <p>Number

    of bedrooms: {{rental.bedrooms}}</p> {{#if isImageShowing }} <p><img src={{rental.image}} 
 alt={{rental.type}} width="500px"></p> {{else}} <button>Show image</button> {{/if}}
  8. // app/templates/components/rental-listing.hbs <h2>{{rental.title}}</h2> <p>Owner: {{rental.owner}}</p> <p>Type: {{rental.type}}</p> <p>Location: {{rental.city}}</p> <p>Number

    of bedrooms: {{rental.bedrooms}}</p> {{#if isImageShowing }} <p><img src={{rental.image}} 
 alt={{rental.type}} width="500px"></p> {{else}} <button {{action "imageShow"}}>Show image</button> {{/if}}
  9. // app/templates/components/rental-listing.hbs <h2>{{rental.title}}</h2> <p>Owner: {{rental.owner}}</p> <p>Type: {{rental.type}}</p> <p>Location: {{rental.city}}</p> <p>Number

    of bedrooms: {{rental.bedrooms}}</p> {{#if isImageShowing }} <p><img src={{rental.image}} 
 alt={{rental.type}} width="500px"></p> {{else}} <button {{action "imageShow"}}>Show image</button> {{/if}}
  10. // app/templates/components/rental-listing.hbs <h2>{{rental.title}}</h2> <p>Owner: {{rental.owner}}</p> <p>Type: {{rental.type}}</p> <p>Location: {{rental.city}}</p> <p>Number

    of bedrooms: {{rental.bedrooms}}</p> {{#if isImageShowing }} <p><img src={{rental.image}} 
 alt={{rental.type}} width="500px"></p> {{else}} <button {{action "imageShow"}}>Show image</button> {{/if}}
  11. #

  12. #!

  13. // app/routes/index.js import Ember from 'ember'; export default Ember.Route.extend({ model()

    { return this.store.findAll('rental'); // => GET /posts }, });
  14. // app/routes/index.js import Ember from 'ember'; export default Ember.Route.extend({ model()

    { return this.store.findAll('rental'); // => GET /posts }, });
  15. // app/routes/index.js import Ember from 'ember'; export default Ember.Route.extend({ model()

    { return this.store.findAll('rental'); // => GET /posts }, });
  16. // app/routes/index.js import Ember from 'ember'; export default Ember.Route.extend({ model()

    { return this.store.findAll('rental'); // => GET /rentals }, });
  17. configure (all plugins) setup willDeploy willBuild build ember-cli-deploy-build didBuild willPrepare

    prepare didPrepare willUpload ember-cli-deploy-gzip, ember-cli-deploy-manifest upload ember-cli-deploy-s3 didUpload willActivate activate didActivate ember-cli-deploy-cloudfront didDeploy teardown
  18. configure (all plugins) setup willDeploy willBuild build ember-cli-deploy-build didBuild willPrepare

    prepare didPrepare willUpload ember-cli-deploy-gzip, ember-cli-deploy-manifest upload ember-cli-deploy-s3 didUpload willActivate activate didActivate ember-cli-deploy-cloudfront didDeploy teardown
  19. configure (all plugins) setup willDeploy willBuild build ember-cli-deploy-build didBuild willPrepare

    prepare didPrepare willUpload ember-cli-deploy-gzip, ember-cli-deploy-manifest upload ember-cli-deploy-s3 didUpload willActivate activate didActivate ember-cli-deploy-cloudfront didDeploy teardown
  20. configure (all plugins) setup willDeploy willBuild build ember-cli-deploy-build didBuild willPrepare

    prepare didPrepare willUpload ember-cli-deploy-gzip, ember-cli-deploy-manifest upload ember-cli-deploy-s3 didUpload willActivate activate didActivate ember-cli-deploy-cloudfront didDeploy teardown
  21. configure (all plugins) setup willDeploy willBuild build ember-cli-deploy-build didBuild willPrepare

    prepare didPrepare willUpload ember-cli-deploy-gzip, ember-cli-deploy-manifest upload ember-cli-deploy-s3 didUpload willActivate activate didActivate ember-cli-deploy-cloudfront didDeploy teardown
  22. configure (all plugins) setup willDeploy willBuild build ember-cli-deploy-build didBuild willPrepare

    prepare didPrepare willUpload ember-cli-deploy-gzip, ember-cli-deploy-manifest upload ember-cli-deploy-s3 didUpload willActivate activate didActivate ember-cli-deploy-cloudfront didDeploy teardown
  23. configure (all plugins) setup willDeploy willBuild build ember-cli-deploy-build didBuild willPrepare

    prepare didPrepare willUpload ember-cli-deploy-gzip, ember-cli-deploy-manifest upload ember-cli-deploy-s3 didUpload willActivate activate didActivate ember-cli-deploy-cloudfront didDeploy teardown
  24. // app/mirage/config.js export default function() { this.get('/api/users', function() { return

    { users: [ {id: 1, name: 'Zelda'}, {id: 2, name: 'Link'}, {id: 3, name: 'Epona'}, ] } }); }
  25. // app/mirage/config.js export default function() { this.get('/api/users', function() { return

    { users: [ {id: 1, name: 'Zelda'}, {id: 2, name: 'Link'}, {id: 3, name: 'Epona'}, ] } }); }
  26. // app/mirage/config.js export default function() { this.get('/api/users', function() { return

    { users: db.users {id: 1, name: 'Zelda'}, {id: 2, name: 'Link'}, {id: 3, name: 'Epona'}, ] } }); }
  27. // app/mirage/factories/user.js import Mirage, {faker} from 'ember-cli-mirage'; export default Mirage.Factory.extend({

    name(i) { return `Person ${i}`; }, age: 28, admin: false, avatar(i) { return faker.internet.avatar(); } });
  28. // app/mirage/factories/user.js import Mirage, {faker} from 'ember-cli-mirage'; export default Mirage.Factory.extend({

    name(i) { return `Person ${i}`; }, age: 28, admin: false, avatar(i) { return faker.internet.avatar(); } });
  29. // app/mirage/factories/user.js import Mirage, {faker} from 'ember-cli-mirage'; export default Mirage.Factory.extend({

    name(i) { return `Person ${i}`; }, age: 28, admin: false, avatar(i) { return faker.internet.avatar(); } });
  30. // app/mirage/factories/user.js import Mirage, {faker} from 'ember-cli-mirage'; export default Mirage.Factory.extend({

    name(i) { return `Person ${i}`; }, age: 28, admin: false, avatar(i) { return faker.internet.avatar(); } });
  31. // app/mirage/scenarios/default.js // Create 10 non-admin and 1 admin users

    for development export default function(server) { server.createList('user', 10); server.create('user', {admin: true}); };
  32. // app/mirage/scenarios/default.js // Create 10 non-admin and 1 admin users

    for development export default function(server) { server.createList('user', 10); server.create('user', {admin: true}); };
  33. // app/mirage/scenarios/default.js // Create 10 non-admin and 1 admin users

    for development export default function(server) { server.createList('user', 10); server.create('user', {admin: true}); };
  34. // tests/acceptance/users-test.js test("I can view the users", function() { var

    users = server.createList('user', 3); visit('/users'); andThen(function() { equal(find('li').length, 3); equal(find('li:first').text(),users[0].name); }); });
  35. // tests/acceptance/users-test.js test("I can view the users", function() { var

    users = server.createList('user', 3); visit('/users'); andThen(function() { equal(find('li').length, 3); equal(find('li:first').text(),users[0].name); }); });
  36. // app/mirage/config.js export default function() { this.passthrough('/api/users'); } // Config

    that is only loaded during tests export function testConfig() { } return { users: db.users } }); }
  37. // app/mirage/config.js export default function() { this.passthrough('/api/users'); } // Config

    that is only loaded during tests export function testConfig() { this.get('/api/users', function() { return { users: db.users } }); }
  38. // app/mirage/config.js export default function() { this.passthrough('/api/users'); } // Config

    that is only loaded during tests export function testConfig() { this.get('/api/users', function() { return { users: db.users } }); }
  39. Credits: - Product Demo courtesy of Batterii - Browser by

    useiconic.com from the Noun Project - Server by Dmitry Mamaev from the Noun Project - reload by Daniel Llamas Soto from the Noun Project - iPhone by Edward Boatman from the Noun Project - application by Marie Van den Broeck from the Noun Project - Borrowers by Adolfo Builes (https://github.com/abuiles/borrowers) - EmberConf 2015 - Physical Design (https://youtu.be/p8aF-7-_cE8) - React.js Conf 2015 - Hype! (https://youtu.be/z5e7kWSHWTg) - EmberConf 2015 - Opening Keynote (https://youtu.be/o12-90Dm-Qs)