Ember.js Enterprise Application Framework Heather Brysiewicz - - PowerPoint PPT Presentation

ember js
SMART_READER_LITE
LIVE PREVIEW

Ember.js Enterprise Application Framework Heather Brysiewicz - - PowerPoint PPT Presentation

Ember.js Enterprise Application Framework Heather Brysiewicz @caligoanimus / Who is using Ember.js? emberjs.com/ember-users Who is using Ember.js? builtwithember.io So Why do these companies chose Ember.js? App grows, complexity doesn't


slide-1
SLIDE 1

Ember.js

Enterprise Application Framework

/ Heather Brysiewicz @caligoanimus

slide-2
SLIDE 2
slide-3
SLIDE 3
slide-4
SLIDE 4
slide-5
SLIDE 5
slide-6
SLIDE 6

Who is using Ember.js?

emberjs.com/ember-users

slide-7
SLIDE 7

Who is using Ember.js?

builtwithember.io

slide-8
SLIDE 8
slide-9
SLIDE 9

So Why do these companies chose Ember.js?

App grows, complexity doesn't

Sam Mueller, Yahoo Ad-Manager Plus

Ember has the ability to manage the complexity of large applications and websites with grace

Jackie Hade, from Digitaria on Qualcomm

The fact that Ember is so opinionated... any Ember developer can look at any other Ember application and immediately have a huge benefit

Lance Harper, NBCNews

slide-10
SLIDE 10

It Grows!

slide-11
SLIDE 11

Opinionated = Performance + Productivity

slide-12
SLIDE 12

Evolution: Rise from the Ashes

Where did we come from?

slide-13
SLIDE 13

Ajax DOM Selection and Traversing Events, Effects, and Animations Extensible

slide-14
SLIDE 14

Lean MVC Small Footprint Easy to Learn Provides Basic Tools

slide-15
SLIDE 15

Two-Way Binding Manages View Life-Cycle Automatic Creation Router Ember-Data Performance

slide-16
SLIDE 16

It's a Framework Models* Router Controllers Views & Components Templates

slide-17
SLIDE 17

Ember-CLI

slide-18
SLIDE 18
slide-19
SLIDE 19
slide-20
SLIDE 20

Imgur Example

slide-21
SLIDE 21

URL / Template Path app/templates/application.hbs View Path app/views/application.js Controller Path app/controllers/application.js Route Path app/routes/application.js

slide-22
SLIDE 22

URL / Template Path app/templates/application.hbs View Path app/views/application.js Controller Path app/controllers/application.js Route Path app/routes/application.js

slide-23
SLIDE 23

Application Template

 app/templates/application.hbs

<header> {{#link-to 'index'}} <i class="fa fa-circle fa-emgur-logo"></i> Emgur {{/link-to}} </header> <div class="main-container"> {{outlet}} </div>

slide-24
SLIDE 24

URL / Template Path app/templates/index.hbs View Path app/views/index.js Controller Path app/controllers/index.js Route Path app/routes/index.js

slide-25
SLIDE 25

URL / Template Path app/templates/index.hbs View Path app/views/index.js Controller Path app/controllers/index.js Route Path app/routes/index.js

slide-26
SLIDE 26

Index Route

 app/routes/index.js

import Ember from 'ember'; export default Ember.Route.extend({ model: function() { return this.store.find('gallery'); } });

slide-27
SLIDE 27

 app/templates/index.hbs

<div class="container"> {{#each}} {{image-thumb content=this}} {{/each}} <div class="clear"></div> </div>

slide-28
SLIDE 28

Template Path app/templates/components/image-thumb.hbs Component Path app/components/image-thumb.js

slide-29
SLIDE 29

:isHovering commentCount

slide-30
SLIDE 30

Image Thumbnail Component

 app/components/image-thumb.js

import Ember from 'ember'; export default Ember.Component.extend({ isHovering: false, commentsCount: function() { return this.get('content.comments.length'); }.property('content.comments'), mouseEnter: function() { this.set('isHovering', true); }, mouseLeave: function() { this.set('isHovering', false); } });

slide-31
SLIDE 31

Image Thumbnail Template

 app/templates/components/image-thumb.hbs

{{#link-to 'gallery' content}} <div class="image-item"> <div class="image-thumb"> <img {{bind-attr src=content.image.url}}> </div> {{#if isHovering}} <div class="image-details"> <div class="image-comment"> <div class="comment-count">{{commentsCount}} comments</div> </div> </div> {{/if}} </div> {{/link-to}}

slide-32
SLIDE 32

Adding Routes

slide-33
SLIDE 33

Define Routes

 app/router.js

import Ember from 'ember'; import config from './config/environment'; var Router = Ember.Router.extend({ location: config.locationType }); Router.map(function() { this.route('gallery', { path: '/gallery/:gallery_id' }); }); export default Router;

slide-34
SLIDE 34

URL /gallery/:gallery_id Template Path app/templates/gallery.hbs View Path app/views/gallery.js Controller Path app/controllers/gallery.js Route Path app/routes/gallery.js

slide-35
SLIDE 35

URL /gallery/:gallery_id Template Path app/templates/gallery.hbs View Path app/views/gallery.js Controller Path app/controllers/gallery.js Route Path app/routes/gallery.js

slide-36
SLIDE 36
slide-37
SLIDE 37

Gallery Item Template

 app/templates/gallery.hbs

<div class="gallery-container"> <div class="gallery-full"> <div class="gallery-title">{{title}}</div> <div class="gallery-posted">{{postedFormated}}</div> <div class="gallery-image"> <img {{bind-attr src=image.url}}> </div> </div> <div class="gallery-comments"> <div class="comment-new"> {{#if isEditing}} {{focus-textarea value=newComment rows=3 focus-out='offEdit' action='submitComment <div class="comment-button-container"> <div class='save-button' {{action 'submitComment'}}>save</div> <div class="comment-length">{{newCommentCharacters}}</div> </div> <div class="clear"></div> {{else}} {{input placeholder='Submit a comment' focus-in='onEdit'}} {{/if}} </div> <ul class="gallery-comments-ul"> {{#each comments}} <li class="gallery-comment"> <div class="comment-posted">{{postedFormatted}}</div> <div class="comment-content">{{content}}</div> </li> {{/each}}

slide-38
SLIDE 38

Gallery Item Template

 app/templates/gallery.hbs

slide-39
SLIDE 39

Gallery Item Template

 app/templates/gallery.hbs

slide-40
SLIDE 40

Gallery Item Template

 app/templates/gallery.hbs

slide-41
SLIDE 41

Gallery Item Template

 app/templates/gallery.hbs

slide-42
SLIDE 42

Gallery Item Controller

 app/controllers/gallery.js

import Ember from 'ember'; export default Ember.ObjectController.extend({ maxChars: 140, isEditing: false, newComment: null, // bound to value of textarea postedFormated: function() { return moment(this.get('posted')).fromNow(); }.property('posted'), newCommentCharacters: function() { return this.maxChars - this.get('newComment.length'); }.property('newComment'), actions: {

  • nEdit: function() {

this.set('isEditing', true); },

  • ffEdit: function() {

if (this.get('newCommentCharacters') === this.maxChars) { this.set('isEditing', false); } }, submitComment: function() { var _this = this;

slide-43
SLIDE 43

That's all you need to get started with

slide-44
SLIDE 44

Get Involved!

Community #emberjs

slide-45
SLIDE 45

Thanks!

 hbrysiewicz.github.io  @caligoanimus