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

Frontend Choices (Tropical Ruby)

Frontend Choices (Tropical Ruby)

Avatar for Alex Coles

Alex Coles

March 06, 2015

More Decks by Alex Coles

Other Decks in Technology

Transcript

  1. “

  2. “Rails Way” for views back in 2005 •Server Generated HTML

    (ERB, etc.) •Prototype •Scriptaculous •RJS
  3. RJS <div  id="items"></div>   <%=  link_to_remote  'Add  to  cart',  url:

     {  controller:  'cart',  action:   'add_to_cart'  }%> erb view class  CartController  <  ActionController::Base      def  add_to_cart          @item  =  CartItem.new          @cart.items  <<  @item      end   end controller page.insert_html    :bottom,  :items,  partial:  'item',  object:  @item   page.replace_html  :items_count,  I18n.t(:item,  count:  @cart.items.count)   rjs view
  4. “Rails Way” for views now • Server Generated HTML (ERB,

    Slim, HAML etc.) • jQuery • jQuery UI • Server generated JavaScript Responses (SJR)
  5. JavaScript has grown up percentage of total JS developer jobs

    has doubled from 2005 to 2010 indeed.com
  6. JavaScript has grown up Server-side usage of JS has been

    multiplied by 6 from Jan 2012 to Oct 2014 W3Techs.com
  7. meteor.com Meteor 50 UPCOMING EVENTS 4224 PACKAGES 9915 STACK OVERFLOW

    QUESTIONS 254K UNIQUE INSTALLS 12 PROFESSIONAL SERVICE PROVIDERS Meteor is a complete open source platform Build apps that are a delight to use, faster than you ever thought possible I N S TA L L M E T E O R I N S TA L L M E T E O R 1 .0. 3 . 2 1 .0. 3 . 2 Star Star Follow Follow @meteorjs @meteorjs 36.8K followers 22945 22945 TUTORIAL DOCS SUBPROJECTS PACKAGES THE METEOR PROJECT BLOG SIGN IN
  8. “

  9. “ – Marcin Stecki @madsheepPL at wroc_love.rb Not his [DHH’s]

    responsibility to tell us how to do these things.
  10. how unique is the view to be rendered? how many

    combinations of a unique set of data? • a blog with comments • a hotel page with reviews • a dashboard
  11. Ember.js is most like Rails • everything should inherit from

    main object ActiveRecord::Base.inherited Ember.Object Plain Old JavaScript Objects
  12. Ember.js is most like Rails • routing DSL built-in routing

    not in core, third party solutions built-in routing
  13. Ember.js is most like Rails • vocabulary (templates, partials, etc.)

    Dependency Injection, Factories, Services, Providers,
 Transclusion Models, Controllers, Views, Initializers Models, Controllers, Views, Initializers
  14. voltframework.com Volt Framework Volt is a framework for building data

    rich web applications shockingly fast. Play Video ! Get Started " Home Getting Started Docs API Blog Community #
  15. Volt <ul  id=“items">   {{  page._cart_items.each  do  |item|  }}  

    <li>        <strong>{{  item._name  }}</strong>      </li>   {{  end  }}   </ul> view class  CartController  <  Volt::ModelController      model  :cart      def  add_to_cart          page._cart_items  =  {  name:  page._new_item  }              page._new_item  <<  ''      end   controller
  16. RJS <div  id="items"></div>   <%=  link_to_remote  'Add  to  cart',  url:

     {  controller:  'cart',  action:   'add_to_cart'  }%> erb view class  CartController  <  ActionController::Base      def  add_to_cart          @item  =  CartItem.new          @cart.items  <<  @item      end   end controller page.insert_html    :bottom,  :items,  partial:  'item',  object:  @item   page.replace_html  :items_count,  I18n.t(:item,  count:  @cart.items.count)   rjs view