SlideShare a Scribd company logo
1 of 34
Download to read offline
Angular.js + Rails = ♥
   or: The Accidental Feature
By Jonathan E. Magen / @yonkeltron Sr. Software Engineer, WeWork
Identify yourself
Jonathan E. Magen / yonkeltron errywhere else
Practitioner of the Computer Sciences
Research @ The Evergreen State College Advanced OS Lab
WeWork engineer
About WeWork
“ We want to change the way people work. ”
        - Adam Neumann, WeWork Co-Founder


     “ Design to make people happy. ”
        - Miguel McKelvey, WeWork Co-Founder


        7 Buildings
        3 Cities
        4000+ Members
        Services for the community
Computing at WeWork
      Tech stack
        Rails
        Heroku
        PostgreSQL
         Agile!
WeWork.com Member
    Network
Spaceman: WeWork
backoffice hawtness
   Space management
   Billing
   Reservations
   Accounting system integration
Things we've built with
       Angular
Audit trail + changelog inspector using audited gem
Infinite scroll using will_paginate gem
Inline edit
Lots of stuff using ngResource
Angular.js + Rails
       ♥
Free RESTful JSON endpoints
casOfrnsotolr<Apiainotolr
ls feigCnrle   plctoCnrle

 dfidx
  e ne
   @feig =Ofrn.aeprm[pg]
    ofrns feigpg(aas:ae)

   rsodt d |omt
    epn_o o fra|
     fra.tl#idxhm.r
      omthm  ne.tleb
     fra.sn{rne jo:@feig,ro:fle}
      omtjo  edr sn ofrns ot as
   ed
    n
 ed
  n

 #ohratos.
   te cin..
ed
n




              ActiveRecord → JSON → HTTP
ngResource
aglrmdl(ofrnsevc' [nRsuc')
nua.oue'feigSrie, 'geore].
 fcoy'feig,fnto ofrn(rsuc){
  atr(Ofrn' ucin feig$eore
   rtr $eore'ofrns:d,{d 'i',{
    eun rsuc(/feig/i' i: @d}
     cet:{mto:'OT }
      rae  ehd PS' ,
     idx {mto:'E' iAry tu }
      ne:  ehd GT, sra: re ,
     so: {mto:'E'}
      hw   ehd GT ,
     udt:{mto:'U'}
      pae  ehd PT
   };
    )
 };
  )




          Rails → JSON/HTTP → ngResource
Rails renders Angular template HTML
          Times you might want to do this:
    Permissions: only rendering parts of a template
    Dynamically populate form s l c options
                                eet
    Internationalization!
Permission-driven rendering
   <=i cretue.a_oe :uio %
    % f urn_srhsrl? adtr >
     <i dt-gap"pcmn>
      dv aan-p=saea"
       <i dt-uis"e"
        dv aaadt=yp
          dt-uial-ye"% Ofrn.os%"
           aaadtbetp=<= feigt_ >
          dt-uial-d"% @feigi %"<dv
           aaadtbei=<= ofrn.d >>/i>
     <dv
      /i>
   < ed%
    % n >




Only render the audit inspector directive iff the current user has the
                authorization to access audit data
i18n API column headers
 <al cas"al tbesrpd dt-gap"pcmn>
 tbe ls=tbe al-tie" aan-p=saea"
  <ha>
   ted
    <h<=Ofrn.ua_trbt_ae:ae %<t>
     t>% feighmnatiuenm(nm) >/h
    <h<=Ofrn.ua_trbt_ae:aeoiain %<t>
     t>% feighmnatiuenm(ctgrzto) >/h
    <h<=Ofrn.ua_trbt_ae:rc)%<t>
     t>% feighmnatiuenm(pie >/h
    <h<t>
     t>/h
    <h<t>
     t>/h
  <ted
   /ha>




t e drendered by Rails includes localized column headers. This
 ha
    lets Angular render the t o ycontaining actual data.
                             bd
One minor snag
cni.sesj_opesr=Srces:ayopesrnwd
ofgast.scmrso    pokt:LzCmrso.e o
 Ulfe.e(age fle #dntoltrt nms
  giirnwmnl: as)  o' bieae ae
ed
n




         config/environments/production.rb
Angular on Rails
Rails gives you RESTful JSON endpoints for free
ngResource lets you consume them for free
Let Rails help you render templates
The Accidental Feature
It started with a spike
                       The requirement:
Allow a user to quickly inline edit inventory on the index page.




                      *Actual Spaceman wireframe
The search for
  inline edit
   Oh God, please make it stop
Yeah, I know there were easier
         ways to do this
        Gorillions of jQuery plugins
        Far fewer Angular-friendly options
           Google Groups
           StackOverflow
 We knew we'd need Angular.js but
 wanted to ease our way in gradually
A subtle rejection of ngGrid
        Reimplementing t b ein terms of d v
                          al             i
        Does way more than what we needed
        Sub project of Angular UI
TBH: Angular.js could really use widgets
               Web Components?
How we did it
Offerings controller
saea.otolr'feig' fnto (soe sacPrmevc,Ofrn){
pcmncnrle(ofrns, ucin $cp, erhaaSrie feig
 cnoelg'feig Cnolr)
  osl.o(Ofrns otle';

 $cp.feig =Ofrn.ur(;/ nRsuc ZM!
  soeofrns  feigqey) / geore OG

 $cp.dtnTgl =fnto eiigogeofrn){
  soeeiigoge    ucin dtnTgl(feig
   i (feigeiig {
    f ofrn.dtn)
     Ofrn.paeofrn)
      feigudt(feig;
     ofrn.dtn =fle
      feigeiig  as;
   }es {
      le
     ofrn.dtn =tu;
      feigeiig  re
   }
 };
};
)
The show/hide model for cells
      in the table body
 <bd dt-gcnrle=ofrns>
 toy aan-otolr"feig"
  <rdt-grpa=ofrn i ofrns>
   t aan-eet"feig n feig"
    <d
     t>
     < he=/feig/{feigi}"
      a rf"ofrns{ofrn.d}
        dt-gso=!feigeiig>{feignm}<a
         aan-hw"ofrn.dtn"{ofrn.ae}/>

    <nu dt-gso=ofrn.dtn"
     ipt aan-hw"feigeiig
        tp=tx"dt-gmdl"feignm"rqie/
         ye"et aan-oe=ofrn.ae eurd>
   <t>
    /d




              show(value) ⊕ show(input)
ngShow + ngResource
Problems
Verbose
Soaking wet (non-DRY)
Not easily reused
Next steps for inline edit
Figure out how to turn this in to a reusable component
Accidental success
          ↓
Angular empowerment
Changelog + audit inspector
          Strong audit trail
          Data integrity
          audited gem
Who, what, when, where, why, how

casOfrn <AtvRcr:Bs
ls feig  cieeod:ae
 adtd
  uie

 #..
   .
ed
n




Adtd:dpes:cieeod:ui <AtvRcr:Bs {
 uie:Aatr:AtvRcr:Adt     cieeod:ae
           :d= :nee,
           i > itgr
     :uial_d= :nee,
      adtbei > itgr
    :uial_ye= :tig
    adtbetp > srn,
    :soitdi = :nee,
     ascae_d > itgr
   :soitdtp = :tig
    ascae_ye > srn,
        :sri = :nee,
        ue_d > itgr
       :srtp = :tig
       ue_ye > srn,
       :srae= :tig
        uenm > srn,
        :cin= :tig
         ato > srn,
   :uie_hne = :et
    adtdcags > tx, #< ZM df
                     - OG if
        :eso = :nee,
        vrin > itgr
        :omn = :tig
        cmet > srn,
    :eoeades= :tig
    rmt_drs > srn,
      :rae_t= :aeie
       cetda > dttm
}
END / FIN / ‫סוף‬
   Thanks to Google
  Thanks to WeWork
    Thanks to you

More Related Content

What's hot

Useful javascript
Useful javascriptUseful javascript
Useful javascript
Lei Kang
 
Paperjs presentation
Paperjs presentationPaperjs presentation
Paperjs presentation
sharp-blade
 
Shkrubbel for Open Web Camp 3
Shkrubbel for Open Web Camp 3Shkrubbel for Open Web Camp 3
Shkrubbel for Open Web Camp 3
kitthod
 
Nomethoderror talk
Nomethoderror talkNomethoderror talk
Nomethoderror talk
Jan Berdajs
 
Program(Output)
Program(Output)Program(Output)
Program(Output)
princy75
 
Gitosis on Mac OS X Server
Gitosis on Mac OS X ServerGitosis on Mac OS X Server
Gitosis on Mac OS X Server
Yasuhiro Asaka
 

What's hot (20)

Useful javascript
Useful javascriptUseful javascript
Useful javascript
 
A Backbone.js Tutorial for the Impatient - Part 1
A Backbone.js Tutorial for the Impatient - Part 1A Backbone.js Tutorial for the Impatient - Part 1
A Backbone.js Tutorial for the Impatient - Part 1
 
Paperjs presentation
Paperjs presentationPaperjs presentation
Paperjs presentation
 
Connecting Pebble to the World
Connecting Pebble to the WorldConnecting Pebble to the World
Connecting Pebble to the World
 
Shkrubbel for Open Web Camp 3
Shkrubbel for Open Web Camp 3Shkrubbel for Open Web Camp 3
Shkrubbel for Open Web Camp 3
 
Intro to Systems Orchestration with MCollective
Intro to Systems Orchestration with MCollectiveIntro to Systems Orchestration with MCollective
Intro to Systems Orchestration with MCollective
 
Use of django at jolt online v3
Use of django at jolt online v3Use of django at jolt online v3
Use of django at jolt online v3
 
Czzawk
CzzawkCzzawk
Czzawk
 
Absolute Beginners Guide to Puppet Through Types - PuppetConf 2014
Absolute Beginners Guide to Puppet Through Types - PuppetConf 2014Absolute Beginners Guide to Puppet Through Types - PuppetConf 2014
Absolute Beginners Guide to Puppet Through Types - PuppetConf 2014
 
Tilting Google Maps and MissileLauncher
Tilting Google Maps and MissileLauncherTilting Google Maps and MissileLauncher
Tilting Google Maps and MissileLauncher
 
WebXR if X = how?
WebXR if X = how?WebXR if X = how?
WebXR if X = how?
 
Gkm referral program
Gkm referral programGkm referral program
Gkm referral program
 
"Визуализация данных с помощью d3.js", Михаил Дунаев, MoscowJS 19
"Визуализация данных с помощью d3.js", Михаил Дунаев, MoscowJS 19"Визуализация данных с помощью d3.js", Михаил Дунаев, MoscowJS 19
"Визуализация данных с помощью d3.js", Михаил Дунаев, MoscowJS 19
 
Web Tech & Architecture
Web Tech & ArchitectureWeb Tech & Architecture
Web Tech & Architecture
 
Nomethoderror talk
Nomethoderror talkNomethoderror talk
Nomethoderror talk
 
Program(Output)
Program(Output)Program(Output)
Program(Output)
 
Couchdb
CouchdbCouchdb
Couchdb
 
Go Containers
Go ContainersGo Containers
Go Containers
 
Gitosis on Mac OS X Server
Gitosis on Mac OS X ServerGitosis on Mac OS X Server
Gitosis on Mac OS X Server
 
Voldemort collections library
Voldemort collections libraryVoldemort collections library
Voldemort collections library
 

Viewers also liked

Viewers also liked (20)

WeWork - NOAH16 Berlin
WeWork - NOAH16 BerlinWeWork - NOAH16 Berlin
WeWork - NOAH16 Berlin
 
We work south bank
We work south bankWe work south bank
We work south bank
 
The joy of sharing_WeWork
The joy of sharing_WeWorkThe joy of sharing_WeWork
The joy of sharing_WeWork
 
WeWork Lunch & Learn
WeWork Lunch & LearnWeWork Lunch & Learn
WeWork Lunch & Learn
 
160518 테헤란로 커피클럽 WeWork
160518 테헤란로 커피클럽 WeWork160518 테헤란로 커피클럽 WeWork
160518 테헤란로 커피클럽 WeWork
 
Guide pour créer un espace de coworking
Guide pour créer un espace de coworkingGuide pour créer un espace de coworking
Guide pour créer un espace de coworking
 
Insidesaleswiz-info
Insidesaleswiz-infoInsidesaleswiz-info
Insidesaleswiz-info
 
Scaling CTO / On Freund
Scaling CTO / On Freund   Scaling CTO / On Freund
Scaling CTO / On Freund
 
Labs Overview
Labs OverviewLabs Overview
Labs Overview
 
WeWork Labs Seminar: Raising Money by Convertible Debt
WeWork Labs Seminar: Raising Money by Convertible DebtWeWork Labs Seminar: Raising Money by Convertible Debt
WeWork Labs Seminar: Raising Money by Convertible Debt
 
We work pitch deck
We work pitch deckWe work pitch deck
We work pitch deck
 
D&T Association Summer School 2015
D&T Association Summer School 2015D&T Association Summer School 2015
D&T Association Summer School 2015
 
Stories and Experience (TEDx Newcastle)
Stories and Experience (TEDx Newcastle)Stories and Experience (TEDx Newcastle)
Stories and Experience (TEDx Newcastle)
 
Scrppy
ScrppyScrppy
Scrppy
 
Visual Design Thinking - Prague 2013 - WebExpo
Visual Design Thinking - Prague 2013 - WebExpoVisual Design Thinking - Prague 2013 - WebExpo
Visual Design Thinking - Prague 2013 - WebExpo
 
Twenty Plus
Twenty PlusTwenty Plus
Twenty Plus
 
Conversation 2.0
Conversation 2.0Conversation 2.0
Conversation 2.0
 
Pregi e difetti dei principali CMS Open Source
Pregi e difetti dei principali CMS Open SourcePregi e difetti dei principali CMS Open Source
Pregi e difetti dei principali CMS Open Source
 
HungryMind
HungryMindHungryMind
HungryMind
 
Designing interactive Experience
Designing interactive ExperienceDesigning interactive Experience
Designing interactive Experience
 

Similar to Angular.js + Rails at WeWork or: The Accidental Feature

Introduction to AngularJS
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJS
Pat Cito
 
Refactoring to symfony components
Refactoring to symfony componentsRefactoring to symfony components
Refactoring to symfony components
Michael Peacock
 
Tips on how to improve the performance of your custom modules for high volume...
Tips on how to improve the performance of your custom modules for high volume...Tips on how to improve the performance of your custom modules for high volume...
Tips on how to improve the performance of your custom modules for high volume...
Odoo
 
Nginx Scripting - Extending Nginx Functionalities with Lua
Nginx Scripting - Extending Nginx Functionalities with LuaNginx Scripting - Extending Nginx Functionalities with Lua
Nginx Scripting - Extending Nginx Functionalities with Lua
Tony Fabeen
 
Devinsampa nginx-scripting
Devinsampa nginx-scriptingDevinsampa nginx-scripting
Devinsampa nginx-scripting
Tony Fabeen
 

Similar to Angular.js + Rails at WeWork or: The Accidental Feature (20)

Introduction to AngularJS
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJS
 
Starting out with Ember.js
Starting out with Ember.jsStarting out with Ember.js
Starting out with Ember.js
 
Noah Zoschke at Waza 2013: Heroku Secrets
Noah Zoschke at Waza 2013: Heroku SecretsNoah Zoschke at Waza 2013: Heroku Secrets
Noah Zoschke at Waza 2013: Heroku Secrets
 
Beginner workshop to angularjs presentation at Google
Beginner workshop to angularjs presentation at GoogleBeginner workshop to angularjs presentation at Google
Beginner workshop to angularjs presentation at Google
 
Learn Frontend Testing
Learn Frontend TestingLearn Frontend Testing
Learn Frontend Testing
 
Refactoring to symfony components
Refactoring to symfony componentsRefactoring to symfony components
Refactoring to symfony components
 
Building modern web apps with html5, javascript, and java
Building modern web apps with html5, javascript, and javaBuilding modern web apps with html5, javascript, and java
Building modern web apps with html5, javascript, and java
 
One page app with AngularJS
One page app with AngularJSOne page app with AngularJS
One page app with AngularJS
 
Cross Domain Web
Mashups with JQuery and Google App Engine
Cross Domain Web
Mashups with JQuery and Google App EngineCross Domain Web
Mashups with JQuery and Google App Engine
Cross Domain Web
Mashups with JQuery and Google App Engine
 
Tips on how to improve the performance of your custom modules for high volume...
Tips on how to improve the performance of your custom modules for high volume...Tips on how to improve the performance of your custom modules for high volume...
Tips on how to improve the performance of your custom modules for high volume...
 
Logstash for SEO: come monitorare i Log del Web Server in realtime
Logstash for SEO: come monitorare i Log del Web Server in realtimeLogstash for SEO: come monitorare i Log del Web Server in realtime
Logstash for SEO: come monitorare i Log del Web Server in realtime
 
Flow of events during Media Player creation in Android
Flow of events during Media Player creation in AndroidFlow of events during Media Player creation in Android
Flow of events during Media Player creation in Android
 
Improving the performance of Odoo deployments
Improving the performance of Odoo deploymentsImproving the performance of Odoo deployments
Improving the performance of Odoo deployments
 
Architecting Android Apps: Marko Gargenta
Architecting Android Apps: Marko GargentaArchitecting Android Apps: Marko Gargenta
Architecting Android Apps: Marko Gargenta
 
Beyond PHP - It's not (just) about the code
Beyond PHP - It's not (just) about the codeBeyond PHP - It's not (just) about the code
Beyond PHP - It's not (just) about the code
 
Elk stack
Elk stackElk stack
Elk stack
 
Keep it simple web development stack
Keep it simple web development stackKeep it simple web development stack
Keep it simple web development stack
 
Nginx Scripting - Extending Nginx Functionalities with Lua
Nginx Scripting - Extending Nginx Functionalities with LuaNginx Scripting - Extending Nginx Functionalities with Lua
Nginx Scripting - Extending Nginx Functionalities with Lua
 
Devinsampa nginx-scripting
Devinsampa nginx-scriptingDevinsampa nginx-scripting
Devinsampa nginx-scripting
 
Groovy
GroovyGroovy
Groovy
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Recently uploaded (20)

TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 

Angular.js + Rails at WeWork or: The Accidental Feature

  • 1. Angular.js + Rails = ♥ or: The Accidental Feature By Jonathan E. Magen / @yonkeltron Sr. Software Engineer, WeWork
  • 2. Identify yourself Jonathan E. Magen / yonkeltron errywhere else Practitioner of the Computer Sciences Research @ The Evergreen State College Advanced OS Lab WeWork engineer
  • 3. About WeWork “ We want to change the way people work. ” - Adam Neumann, WeWork Co-Founder “ Design to make people happy. ” - Miguel McKelvey, WeWork Co-Founder 7 Buildings 3 Cities 4000+ Members Services for the community
  • 4. Computing at WeWork Tech stack Rails Heroku PostgreSQL Agile!
  • 6.
  • 7. Spaceman: WeWork backoffice hawtness Space management Billing Reservations Accounting system integration
  • 8. Things we've built with Angular Audit trail + changelog inspector using audited gem Infinite scroll using will_paginate gem Inline edit Lots of stuff using ngResource
  • 10. Free RESTful JSON endpoints casOfrnsotolr<Apiainotolr ls feigCnrle plctoCnrle dfidx e ne @feig =Ofrn.aeprm[pg] ofrns feigpg(aas:ae) rsodt d |omt epn_o o fra| fra.tl#idxhm.r omthm ne.tleb fra.sn{rne jo:@feig,ro:fle} omtjo edr sn ofrns ot as ed n ed n #ohratos. te cin.. ed n ActiveRecord → JSON → HTTP
  • 11. ngResource aglrmdl(ofrnsevc' [nRsuc') nua.oue'feigSrie, 'geore]. fcoy'feig,fnto ofrn(rsuc){ atr(Ofrn' ucin feig$eore rtr $eore'ofrns:d,{d 'i',{ eun rsuc(/feig/i' i: @d} cet:{mto:'OT } rae ehd PS' , idx {mto:'E' iAry tu } ne: ehd GT, sra: re , so: {mto:'E'} hw ehd GT , udt:{mto:'U'} pae ehd PT }; ) }; ) Rails → JSON/HTTP → ngResource
  • 12. Rails renders Angular template HTML Times you might want to do this: Permissions: only rendering parts of a template Dynamically populate form s l c options eet Internationalization!
  • 13. Permission-driven rendering <=i cretue.a_oe :uio % % f urn_srhsrl? adtr > <i dt-gap"pcmn> dv aan-p=saea" <i dt-uis"e" dv aaadt=yp dt-uial-ye"% Ofrn.os%" aaadtbetp=<= feigt_ > dt-uial-d"% @feigi %"<dv aaadtbei=<= ofrn.d >>/i> <dv /i> < ed% % n > Only render the audit inspector directive iff the current user has the authorization to access audit data
  • 14. i18n API column headers <al cas"al tbesrpd dt-gap"pcmn> tbe ls=tbe al-tie" aan-p=saea" <ha> ted <h<=Ofrn.ua_trbt_ae:ae %<t> t>% feighmnatiuenm(nm) >/h <h<=Ofrn.ua_trbt_ae:aeoiain %<t> t>% feighmnatiuenm(ctgrzto) >/h <h<=Ofrn.ua_trbt_ae:rc)%<t> t>% feighmnatiuenm(pie >/h <h<t> t>/h <h<t> t>/h <ted /ha> t e drendered by Rails includes localized column headers. This ha lets Angular render the t o ycontaining actual data. bd
  • 15. One minor snag cni.sesj_opesr=Srces:ayopesrnwd ofgast.scmrso pokt:LzCmrso.e o Ulfe.e(age fle #dntoltrt nms giirnwmnl: as) o' bieae ae ed n config/environments/production.rb
  • 16. Angular on Rails Rails gives you RESTful JSON endpoints for free ngResource lets you consume them for free Let Rails help you render templates
  • 18. It started with a spike The requirement: Allow a user to quickly inline edit inventory on the index page. *Actual Spaceman wireframe
  • 19. The search for inline edit Oh God, please make it stop
  • 20. Yeah, I know there were easier ways to do this Gorillions of jQuery plugins Far fewer Angular-friendly options Google Groups StackOverflow We knew we'd need Angular.js but wanted to ease our way in gradually
  • 21. A subtle rejection of ngGrid Reimplementing t b ein terms of d v al i Does way more than what we needed Sub project of Angular UI TBH: Angular.js could really use widgets Web Components?
  • 23. Offerings controller saea.otolr'feig' fnto (soe sacPrmevc,Ofrn){ pcmncnrle(ofrns, ucin $cp, erhaaSrie feig cnoelg'feig Cnolr) osl.o(Ofrns otle'; $cp.feig =Ofrn.ur(;/ nRsuc ZM! soeofrns feigqey) / geore OG $cp.dtnTgl =fnto eiigogeofrn){ soeeiigoge ucin dtnTgl(feig i (feigeiig { f ofrn.dtn) Ofrn.paeofrn) feigudt(feig; ofrn.dtn =fle feigeiig as; }es { le ofrn.dtn =tu; feigeiig re } }; }; )
  • 24. The show/hide model for cells in the table body <bd dt-gcnrle=ofrns> toy aan-otolr"feig" <rdt-grpa=ofrn i ofrns> t aan-eet"feig n feig" <d t> < he=/feig/{feigi}" a rf"ofrns{ofrn.d} dt-gso=!feigeiig>{feignm}<a aan-hw"ofrn.dtn"{ofrn.ae}/> <nu dt-gso=ofrn.dtn" ipt aan-hw"feigeiig tp=tx"dt-gmdl"feignm"rqie/ ye"et aan-oe=ofrn.ae eurd> <t> /d show(value) ⊕ show(input)
  • 27. Next steps for inline edit Figure out how to turn this in to a reusable component
  • 28. Accidental success ↓ Angular empowerment
  • 29. Changelog + audit inspector Strong audit trail Data integrity audited gem
  • 30. Who, what, when, where, why, how casOfrn <AtvRcr:Bs ls feig cieeod:ae adtd uie #.. . ed n Adtd:dpes:cieeod:ui <AtvRcr:Bs { uie:Aatr:AtvRcr:Adt cieeod:ae :d= :nee, i > itgr :uial_d= :nee, adtbei > itgr :uial_ye= :tig adtbetp > srn, :soitdi = :nee, ascae_d > itgr :soitdtp = :tig ascae_ye > srn, :sri = :nee, ue_d > itgr :srtp = :tig ue_ye > srn, :srae= :tig uenm > srn, :cin= :tig ato > srn, :uie_hne = :et adtdcags > tx, #< ZM df - OG if :eso = :nee, vrin > itgr :omn = :tig cmet > srn, :eoeades= :tig rmt_drs > srn, :rae_t= :aeie cetda > dttm }
  • 31.
  • 32.
  • 33.
  • 34. END / FIN / ‫סוף‬ Thanks to Google Thanks to WeWork Thanks to you