Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
emberjs
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
mmr
February 20, 2014
240
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
emberjs
sarma ruby meetup, Feb 2014
mmr
February 20, 2014
More Decks by mmr
See All by mmr
rails decorators
mribica
0
84
make your own gem
mribica
0
110
Featured
See All Featured
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
BBQ
matthewcrist
89
10k
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
840
A Soul's Torment
seathinner
8
3.7k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
710
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
Thoughts on Productivity
jonyablonski
76
5.4k
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
5
760
Google's AI Overviews - The New Search
badams
0
1.6k
The Pragmatic Product Professional
lauravandoore
37
7.5k
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.6k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
232
55k
Transcript
Sarma Feb, 2014
• @mribica • https://github.com/mribica/twtr
Ember.js • client-side MVC framework for creating ambitious web applications
Tradicionalni web • req • full page response • req
• full page response
Ajax • req • full page response • ajax req
• partial response
Pjax/Turbolinks • req na server • full page response •
ajax req • page body response
SPA • req na server • full page response •
ajax req • response.json (client-side rendering)
Ember.js • url driven aplikacija • discourse • demo •
MVC
MVC • App.Router • Em.Route • DS.Model ili Em.Object •
ArrayController, ObjectController • Template • Em.View
Model # models/tweet.js.coffee App.Tweet = DS.Model.extend body: DS.attr(‘text’) favorite: DS.attr(‘boolean’)
createdAt: DS.attr(‘date’)
View (Template) # templates/tweet.handlebars <div class=”tweet”> <small> {{moment}} </small> <p>
{{body}} </p> </div>
View (Em.View) # views/tweet_view.js.coffee App.TweetView = Em.View.extend templateName: ‘tweet’ didInsertElement:
-> # neki kod koji se treba izvrsiti nakon # ubacivanja tweet-a u DOM
View (Em.View) # views/tweet_area_view.js.coffee App.TweetView = Em.TextArea.extend escape: -> #
logika kada se pritisne esc key @sendAction ‘cancel’
Controller # controllers/tweet_controller.js.coffee App.TweetController = Em.ObjectController moment:(-> moment(@get(‘createdAt’)).fromNow() ).property()
Controller # controllers/tweets_controller.js.coffee App.TweetsNewController = Em.ObjectController action: save: -> #
logika za spremanje tweeta
App.Router # router.js.coffee App.Router.map -> @resource ‘tweets’, -> @route ‘new’
Em.Route # tweets_route.js.coffee App.TweetsRoute = Em.Route.extend # model hook model:
-> @store.find(‘tweet’)
Em.Route # tweets_route.js.coffee App.TweetsNewRoute = Em.Route.extend # model hook model:
-> @store.createRecord ‘tweet’
Em.Route • beforeModel(params,) • model(params) • afterModel(params) • setupController(controller, model)
Demo