SlideShare a Scribd company logo
1 of 59
Download to read offline
WELCOME!

Monday, November 2, 2009
WHO AM I?

Monday, November 2, 2009
ME:
              JUSTIN HALSALL


Monday, November 2, 2009
FRONT END DEV
                             http://www.ļ¬‚ickr.com/photos/nathaninsandiego/3687500937/




Monday, November 2, 2009
FRONT END RAILS DEV
                           http://www.ļ¬‚ickr.com/photos/nathaninsandiego/3687500937/




Monday, November 2, 2009
DSLS FOR FRONT
                END RAILS


Monday, November 2, 2009
DSLS FOR FRONT END RAILS
                           ~OR~


              HOW TO USE BLOCKS
              IN YOUR VIEWS FOR
              MAXIMUM AMOUNTS
               OF AWESOMENESS

Monday, November 2, 2009
~BACKSTORY~


Monday, November 2, 2009
a developer
                      working in
                      his views




                               A DEVELOPER
                                    http://www.ļ¬‚ickr.com/photos/nathonline/918128338




Monday, November 2, 2009
a developer
                      working in
                      his views




                               A DEVELOPER
                                    http://www.ļ¬‚ickr.com/photos/nathonline/918128338
                                    http://www.ļ¬‚ickr.com/photos/pipeapple/2190051229




Monday, November 2, 2009
create sexy vertical
                             tabs
                             displayed with
                             javascript




                           VERTICAL TABS
                             http://www.ļ¬‚ickr.com/photos/denn/5291024/




Monday, November 2, 2009
Monday, November 2, 2009
All pages have a
                           couple things in
                           common




Monday, November 2, 2009
<h1>



                           All pages have a
                           couple things in
                           common




Monday, November 2, 2009
<h1>
                <ul>

                           All pages have a
                           couple things in
                           common




Monday, November 2, 2009
<h1>
                <ul>

                            All pages have a
                            couple things in
                            common




                           <div>



Monday, November 2, 2009
<div class='clearfix lead'>
         <h1>...</h1>
         <p>...</p>
       </div>
       <div id='add_connection' class='add_connection'>
         <div id='tabs' class='rounded_container'>
           <ul>
              <li><a href='#tabs-step1'>1. ...</a></li>
              <li><a href='#tabs-step2'>2. ...</a></li>
              <li><a href='#tabs-step3'>3. ...</a></li>
              <li><a href='#tabs-sync'>4. ...</a></li>
              <li><a href='#tabs-done'>Finished</a></li>
           </ul>
           <div id='tabs-step1' class='setup_box'>
              <h2>1. ...</h2>
              ...
              <a href='#tabs-step2' class='next'>next</a>
           </div>
           <div id='tabs-step2' class='setup_box'>
              <h2>2. ...</h2>
              ...
              <a href='#tabs-step1' class='previous'>previous</a>
              <a href='#tabs-step3' class='next'>next</a>
           </div>
           <div id='tabs-step3' class='setup_box'>
              <h2>3. ...</h2>
              ...
              <a href='#tabs-step2' class='previous'>previous</a>
              <a href='#tabs-sync' class='next'>next</a>
           </div>
           <div id='tabs-sync' class='setup_box'>
              <h2>4. ...</h2>
              <h3>Status</h3>
              <p id='status_message'>Checking sync status...</p>
              <a href='#tabs-step3' class='previous'>previous</a>
              <a href='#tabs-done' class='next'>next</a>
           </div>
           <div id='tabs-done' class='setup_box'>
              <h2>Finished - Well done!</h2>
              <img src='/images/giant_success_tick.png' class='success' alt='Success!'>
              <a href='/connections' class='continue add_more' title='back'><img src='/images/add_connection_btn.png' alt='Go to Contacts' /></a>
              <a href='/contacts' title='Go to Contacts' class='continue'><img src='/images/gotocontacts_btn.png' alt='Go to Contacts' /></a>
              <a href='#tabs-sync' class='previous'>previous</a>
           </div>
         </div>
       </div>




Monday, November 2, 2009
<div class='clearfix lead'>
         <h1>...</h1>


                                                 o ts
                                                L f
         <p>...</p>
       </div>
       <div id='add_connection' class='add_connection'>




                                                    o L
         <div id='tabs' class='rounded_container'>
           <ul>
              <li><a href='#tabs-step1'>1. ...</a></li>




                                                        M
              <li><a href='#tabs-step2'>2. ...</a></li>
              <li><a href='#tabs-step3'>3. ...</a></li>




                                                      T
              <li><a href='#tabs-sync'>4. ...</a></li>
              <li><a href='#tabs-done'>Finished</a></li>
           </ul>




                                                   H
           <div id='tabs-step1' class='setup_box'>
              <h2>1. ...</h2>
              ...
              <a href='#tabs-step2' class='next'>next</a>
           </div>
           <div id='tabs-step2' class='setup_box'>
              <h2>2. ...</h2>
              ...
              <a href='#tabs-step1' class='previous'>previous</a>
              <a href='#tabs-step3' class='next'>next</a>
           </div>
           <div id='tabs-step3' class='setup_box'>
              <h2>3. ...</h2>
              ...
              <a href='#tabs-step2' class='previous'>previous</a>
              <a href='#tabs-sync' class='next'>next</a>
           </div>
           <div id='tabs-sync' class='setup_box'>
              <h2>4. ...</h2>
              <h3>Status</h3>
              <p id='status_message'>Checking sync status...</p>
              <a href='#tabs-step3' class='previous'>previous</a>
              <a href='#tabs-done' class='next'>next</a>
           </div>
           <div id='tabs-done' class='setup_box'>
              <h2>Finished - Well done!</h2>
              <img src='/images/giant_success_tick.png' class='success' alt='Success!'>
              <a href='/connections' class='continue add_more' title='back'><img src='/images/add_connection_btn.png' alt='Go to Contacts' /></a>
              <a href='/contacts' title='Go to Contacts' class='continue'><img src='/images/gotocontacts_btn.png' alt='Go to Contacts' /></a>
              <a href='#tabs-sync' class='previous'>previous</a>
           </div>
         </div>
       </div>




Monday, November 2, 2009
<div class='clearfix lead'>
         <h1>...</h1>


                                                 o ts
                                                L f
         <p>...</p>
       </div>
       <div id='add_connection' class='add_connection'>




                                                    o L
         <div id='tabs' class='rounded_container'>
           <ul>
              <li><a href='#tabs-step1'>1. ...</a></li>




                                                        M
              <li><a href='#tabs-step2'>2. ...</a></li>
              <li><a href='#tabs-step3'>3. ...</a></li>




                                                      T
              <li><a href='#tabs-sync'>4. ...</a></li>
              <li><a href='#tabs-done'>Finished</a></li>
           </ul>




                                                   H
           <div id='tabs-step1' class='setup_box'>
              <h2>1. ...</h2>
              ...
              <a href='#tabs-step2' class='next'>next</a>
           </div>
           <div id='tabs-step2' class='setup_box'>
              <h2>2. ...</h2>
              ...
              <a href='#tabs-step1' class='previous'>previous</a>
              <a href='#tabs-step3' class='next'>next</a>
           </div>
           <div id='tabs-step3' class='setup_box'>




                                         Du
              <h2>3. ...</h2>
              ...
              <a href='#tabs-step2' class='previous'>previous</a>




                                                    pli
              <a href='#tabs-sync' class='next'>next</a>
           </div>
           <div id='tabs-sync' class='setup_box'>
              <h2>4. ...</h2>




                                                              ca
              <h3>Status</h3>
              <p id='status_message'>Checking sync status...</p>




                                                                tio
              <a href='#tabs-step3' class='previous'>previous</a>
              <a href='#tabs-done' class='next'>next</a>
           </div>




                                                                    n
           <div id='tabs-done' class='setup_box'>
              <h2>Finished - Well done!</h2>
              <img src='/images/giant_success_tick.png' class='success' alt='Success!'>
              <a href='/connections' class='continue add_more' title='back'><img src='/images/add_connection_btn.png' alt='Go to Contacts' /></a>
              <a href='/contacts' title='Go to Contacts' class='continue'><img src='/images/gotocontacts_btn.png' alt='Go to Contacts' /></a>
              <a href='#tabs-sync' class='previous'>previous</a>
           </div>
         </div>
       </div>




Monday, November 2, 2009
<div class='clearfix lead'>
         <h1>...</h1>


                                                 o ts
                                                L f
         <p>...</p>
       </div>
       <div id='add_connection' class='add_connection'>




                                                    o L
         <div id='tabs' class='rounded_container'>
           <ul>
              <li><a href='#tabs-step1'>1. ...</a></li>




                                                        M
              <li><a href='#tabs-step2'>2. ...</a></li>
              <li><a href='#tabs-step3'>3. ...</a></li>




                                                      T
              <li><a href='#tabs-sync'>4. ...</a></li>
              <li><a href='#tabs-done'>Finished</a></li>
           </ul>




                                                   H
           <div id='tabs-step1' class='setup_box'>
              <h2>1. ...</h2>
              ...
              <a href='#tabs-step2' class='next'>next</a>
           </div>
           <div id='tabs-step2' class='setup_box'>
              <h2>2. ...</h2>
              ...
              <a href='#tabs-step1' class='previous'>previous</a>
              <a href='#tabs-step3' class='next'>next</a>
           </div>
           <div id='tabs-step3' class='setup_box'>




                                         Du
              <h2>3. ...</h2>
              ...
              <a href='#tabs-step2' class='previous'>previous</a>




                                                    pli
              <a href='#tabs-sync' class='next'>next</a>
           </div>
           <div id='tabs-sync' class='setup_box'>
              <h2>4. ...</h2>




                                                              ca
              <h3>Status</h3>
              <p id='status_message'>Checking sync status...</p>




                                                                tio
              <a href='#tabs-step3' class='previous'>previous</a>
              <a href='#tabs-done' class='next'>next</a>
           </div>




                                                                    n
           <div id='tabs-done' class='setup_box'>
              <h2>Finished - Well done!</h2>
              <img src='/images/giant_success_tick.png' class='success' alt='Success!'>
              <a href='/connections' class='continue add_more' title='back'><img src='/images/add_connection_btn.png' alt='Go to Contacts' /></a>
              <a href='/contacts' title='Go to Contacts' class='continue'><img src='/images/gotocontacts_btn.png' alt='Go to Contacts' /></a>
              <a href='#tabs-sync' class='previous'>previous</a>
           </div>
         </div>
       </div>




Monday, November 2, 2009
Imagine having to
           do this 8 times and
           changing things
           around

           Awefull




Monday, November 2, 2009
HOW COULD
             THIS BE BETTER?


Monday, November 2, 2009
And on the 8th day I created methods
                                to awesomify with your views.
                              You shall refer to these as helpers.


                                      if we where evil we
                                      could misuse rails
                                      helpers with blocks
                                      to create a nice little
                                      DSL we can use
                                      everywhere




             GOD GAVE US HELPERS
                           http://www.ļ¬‚ickr.com/photos/zippy/2429678961/




Monday, November 2, 2009
And on the 8th day I created methods
                                to awesomify with your views.
                              You shall refer to these as helpers.


                                      if we where evil we
                                      could misuse rails
                                      helpers with blocks
                                      to create a nice little
                                      DSL we can use
                                      everywhere




             GOD GAVE US HELPERS
                           http://www.ļ¬‚ickr.com/photos/zippy/2429678961/




Monday, November 2, 2009
And on the 8th day I created methods
                                to awesomify with your views.
                                           Kill JAVA!
                              You shall refer to these as helpers.


                                      if we where evil we
                                      could misuse rails
                                      helpers with blocks
                                      to create a nice little
                                      DSL we can use
                                      everywhere




             GOD GAVE US HELPERS
                           http://www.ļ¬‚ickr.com/photos/zippy/2429678961/




Monday, November 2, 2009
<% add_connection_tabs(:for => "...", :subtitle => "...") do |tab| %>

             <% tab.step "..." do %>
               ...
             <% end %>

             <% tab.step "..." do %>
               ...
             <% end %>

             <% tab.step "..." do %>
               ...
             <% end %>

             <% tab.sync %>

             <% tab.done %>

         <% end %>




Monday, November 2, 2009
http://www.ļ¬‚ickr.com/photos/bodoggirl/3598561539   http://www.ļ¬‚ickr.com/photos/juice10/3501376901



Monday, November 2, 2009
x y!
               Se
       http://www.ļ¬‚ickr.com/photos/bodoggirl/3598561539   http://www.ļ¬‚ickr.com/photos/juice10/3501376901



Monday, November 2, 2009
LOOKING GOOD HURTS
                           http://www.ļ¬‚ickr.com/photos/thenovys/3791884189




Monday, November 2, 2009
HOW TO TAKE THE
                      HURT OUT OF
                   LOOKING BEAUTIFUL
                                                        (ehow.com)
               1) Freeze t weezers before t weezing eyebrows, it'll numb the area being t weezed at its touch.
               2) Carry those oversized designer purses and totes on different shoulders everyday to avoid
               straining your arms and shoulder muscles.
               3) Make sure to thoroughly stretch your muscles before exercising to increase.. bla bla bla
               4) Choose the best fitted high heel or stiletto possible to reduce pain and pressure on your toes
               (translated ā€“ donā€™t choose a heel thatā€™ll make your foot slide leaving a gap bet ween the shoe
               and back of your foot).
               5) Something about sticking tape on your toes so that your sandals don't eat your feet


Monday, November 2, 2009
BLOCK_HELPER
                           http://github.com/markevans/block_helpers

               Dax briefly talked about
               it yesterday




Monday, November 2, 2009
wor
                                                  ks b
                                              stick etter
                                                   y tap than
                                                        e on    stick
                                                             your ing
                                                                  toes
                BLOCK_HELPER
                           http://github.com/markevans/block_helpers

               Dax briefly talked about
               it yesterday




Monday, November 2, 2009
THE MEAT
                           http://www.ļ¬‚ickr.com/photos/splorp/12200621




Monday, November 2, 2009
# config/environment.rb
             config.gem "block_helpers",
                        :lib => "block_helpers",
                        :source => "http://gemcutter.org"



             $ rake gems:install




Monday, November 2, 2009
THE PAGE WE ARE GOING TO
                           DRYUP
                   <h1>Symptoms of Apple addiction</h1>
                   <div id='symptoms'>
                     <ul class="tabs">
                       <li><a href="#praying_panel">Praying</a></li>
                       <li><a href="#happiness_panel">Happiness</a></li>
                       <li><a href="#microsoft_panel">Microsoft</a></li>
                     </ul>

                     <div class="panes">
                       <div id="praying_panel">
                          <h2>Praying to Steve Jobs</h2>
                          <p>It is not uncommon for an Apple addict to pray to his Steveness.</p>
                       </div>
                       <div id="happiness_panel">
                          <h2>Happiness and iPhone battery level equal</h2>
                          <p>Addict gets the shakes from low battery power</p>
                       </div>
                       <div id="microsoft_panel">
                          <h2>Microsoft powered nervous break downs</h2>
                          <p>Addict gets the shakes from non-Apple devices</p>
                       </div>
                     </div>
                   </div>



Monday, November 2, 2009
THE PAGE WE ARE GOING TO
                           DRYUP
                   <h1>Symptoms of Apple addiction</h1>
                   <div id='symptoms'>
                     <ul class="tabs">
                       <li><a href="#praying_panel">Praying</a></li>
                       <li><a href="#happiness_panel">Happiness</a></li>
                       <li><a href="#microsoft_panel">Microsoft</a></li>
                     </ul>

                     <div class="panes">
                       <div id="praying_panel">
                          <h2>Praying to Steve Jobs</h2>
                          <p>It is not uncommon for an Apple addict to pray to his Steveness.</p>
                       </div>
                       <div id="happiness_panel">
                          <h2>Happiness and iPhone battery level equal</h2>
                          <p>Addict gets the shakes from low battery power</p>
                       </div>
                       <div id="microsoft_panel">
                          <h2>Microsoft powered nervous break downs</h2>
                          <p>Addict gets the shakes from non-Apple devices</p>
                       </div>
                     </div>
                   </div>



Monday, November 2, 2009
NO MORE TOWELS NEEDED

       <% symptom_tabs_for "Apple addiction" do |tabs| %>

           <% tabs.symptom "Praying to Steve Jobs" do %>
             <p>It is not uncommon for an Apple addict to pray to his Steveness.</p>
           <% end %>

           <% tabs.symptom "Happiness and iPhone energy level equal" do %>
             <p>Addict gets the shakes from low battery power</p>
           <% end %>

           <% tabs.symptom "Microsoft powered nervous break downs" do %>
             <p>Addict gets the shakes from non-Apple devices</p>
           <% end %>

       <% end %>




Monday, November 2, 2009
ARE WE THERE YET?
                           http://www.ļ¬‚ickr.com/photos/sbluerock/415736417




Monday, November 2, 2009
NO! SHUT UP OR NO MORE TV!
                           http://www.ļ¬‚ickr.com/photos/chubbychandru/2273272995




Monday, November 2, 2009
FIRST THINGS FIRST

       # view.html.erb
       <% symptom_tabs_for "Apple addiction" do |tabs| %>
         ...
       <% end %>

       # application_helper.rb
       module ApplicationHelper
         class SymptomTabsFor < BlockHelpers::Base
           # symptom_tabs_for code
         end
       end


Monday, November 2, 2009
# view.html.erb
       <% symptom_tabs_for "Apple addiction" do |tabs| %>
         <% tabs.symptom "Praying to Steve Jobs" do %>
           ...
         <% end %>
         ...
       <% end %>

       # application_helper.rb
       module ApplicationHelper
         class SymptomTabsFor < BlockHelpers::Base
           def initialize(title)
           end

           def symptom(name, &block)
           end
         end
       end

Monday, November 2, 2009
# view.html.erb
       <% symptom_tabs_for "Apple addiction" do |tabs| %>
         ...
       <% end %>

       # application_helper.rb
       module ApplicationHelper
         class SymptomTabsFor < BlockHelpers::Base
           def initialize(title)
             @title = title
           end

                def display(body)
                  content_tag('h1', "Symptoms of #{@title}") +
                  content_tag('div', (
                    content_tag('div', body, :class => 'panes')),
                    :id => 'symptoms')
                end

         end
       end


Monday, November 2, 2009
# view.html.erb
       <% symptom_tabs_for "Apple addiction" do |tabs| %>
         ...
       <% end %>

       # application_helper.rb
       module ApplicationHelper
         class SymptomTabsFor < BlockHelpers::Base
           def initialize(title)
             @title = title
           end

                def display(body)
                  content_tag('h1', "Symptoms of #{@title}") +
                  content_tag('div', (
                    content_tag('div', body, :class => 'panes')),
                    :id => 'symptoms')
                end

         end
       end


Monday, November 2, 2009
# view.html.erb
       <% symptom_tabs_for "Apple addiction" do |tabs| %>
         ...
       <% end %>

       # application_helper.rb
       module ApplicationHelper
         class SymptomTabsFor < BlockHelpers::Base
           def initialize(title)
             @title = title
           end

                def display(body)
                  content_tag('h1', "Symptoms of #{@title}") +
                  content_tag('div', (
                    content_tag('div', body, :class => 'panes')),
                    :id => 'symptoms')
                end

         end
       end


Monday, November 2, 2009
# view.html.erb
       <% symptom_tabs_for "Apple addiction" do |tabs| %>
         ...
       <% end %>

       # application_helper.rb
       module ApplicationHelper
         class SymptomTabsFor < BlockHelpers::Base
           def initialize(title)
             @title = title
           end

                def display(body)
                  content_tag('h1', "Symptoms of #{@title}") +
                  content_tag('div', (
                    content_tag('div', body, :class => 'panes')),
                    :id => 'symptoms')
                end

         end
       end


Monday, November 2, 2009
# view.html.erb
       <% symptom_tabs_for "Apple addiction" do |tabs| %>
         ...
       <% end %>

       # application_helper.rb
       module ApplicationHelper
         class SymptomTabsFor < BlockHelpers::Base
           def initialize(title)
             @title = title
           end

             def display(body)
               content_tag('h1', "Symptoms of #{@title}") +
               content_tag('div', (
                 content_tag('div', body, :class => 'panes')),
                 :id => 'symptoms')
             end

         end
       end


       # browser
       <h1>Symptoms of Apple addiction</h1>
       <div id="symptoms">
         <div class="panes">

         </div>
       </div>


Monday, November 2, 2009
# application_helper.rb
       module ApplicationHelper
         class SymptomTabsFor < BlockHelpers::Base
           def initialize(title)
             @title = title
           end

               def display(body)
                 content_tag('h1', "Symptoms of #{@title}") +
                 content_tag('div', (
                   content_tag('div', body, :class => 'panes')),
                   :id => 'symptoms')
               end

           def sypmtom(name, &block)
             @short = name.split.first
             @content = capture &block
             concat content_tag('div', (
               content_tag( 'h2', name) + @content),
               :id => "#{@short.downcase}_panel")
           end
         end
       end


Monday, November 2, 2009
# application_helper.rb
       module ApplicationHelper
         class SymptomTabsFor < BlockHelpers::Base
           def initialize(title)
             @title = title
           end

               def display(body)
                 content_tag('h1', "Symptoms of #{@title}") +
                 content_tag('div', (
                   content_tag('div', body, :class => 'panes')),
                   :id => 'symptoms')
               end

           def sypmtom(name, &block)
             @short = name.split.first
             @content = capture(&block)
             concat content_tag('div', (
               content_tag( 'h2', name) + @content),
               :id => "#{@short.downcase}_panel")
           end
         end
       end


Monday, November 2, 2009
# application_helper.rb
       module ApplicationHelper
         class SymptomTabsFor < BlockHelpers::Base
           def initialize(title)
             @title = title
           end

               def display(body)
                 content_tag('h1', "Symptoms of #{@title}") +
                 content_tag('div', (
                   content_tag('div', body, :class => 'panes')),
                   :id => 'symptoms')
               end

           def sypmtom(name, &block)
             @short = name.split.first
             @content = capture(&block)
             concat content_tag('div', (
               content_tag( 'h2', name) + @content),
               :id => "#{@short.downcase}_panel")
           end
         end
       end


Monday, November 2, 2009
# application_helper.rb
       module ApplicationHelper
         class SymptomTabsFor < BlockHelpers::Base
           def initialize(title)
             @title = title
           end

               def display(body)
                 content_tag('h1', "Symptoms of #{@title}") +
                 content_tag('div', (
                   content_tag('div', body, :class => 'panes')),
                   :id => 'symptoms')
               end

           def sypmtom(name, &block)
             @short = name.split.first
             @content = capture(&block)
             concat content_tag('div', (
               content_tag( 'h2', name) + @content),
               :id => "#{@short.downcase}_panel")
           end
         end
       end


Monday, November 2, 2009
CONCAT


       concat "hello"
       # the equivalent of <%= "hello" %>




Monday, November 2, 2009
CAPTURE
       <% @greeting = capture do %>
         Welcome to my shiny new web page!    The date and time is
         <%= Time.now %>
       <% end %>



       def myblockheader(&block)
         content = capture(&block)
         concat(content_tag('h1', content))
       end

       <% myblockheader do %>
         Welcome to my shiny new web page!
       <% end %>


Monday, November 2, 2009
module ApplicationHelper
         class SymptomTabsFor < BlockHelpers::Base

              def initialize(title)
                @title = title
                @tabs = []
              end

              def display(body)
                content_tag('h1', "Symptoms of #{@title}") +
                content_tag('div', (
                  content_tag('ul', @tabs.collect{|t| content_tag('li', t)}, :class => 'tabs') +
                  content_tag('div', body, :class => 'panes')),
                  :id => 'symptoms')
              end

              def symptom(name, &block)
                @short = name.split.first
                @tabs << content_tag('a', @short, :href => "##{@short.downcase}_panel")
                @content = capture &block
                concat content_tag('div', (
                  content_tag( 'h2', name) + @content),
                  :id => "#{@short.downcase}_panel")
              end

         end
       end



Monday, November 2, 2009
module ApplicationHelper
         class SymptomTabsFor < BlockHelpers::Base

              def initialize(title)
                @title = title
                @tabs = []
              end

              def display(body)
                content_tag('h1', "Symptoms of #{@title}") +
                content_tag('div', (
                  content_tag('ul', @tabs.collect{|t| content_tag('li', t)}, :class => 'tabs') +
                  content_tag('div', body, :class => 'panes')),
                  :id => 'symptoms')
              end

              def symptom(name, &block)
                @short = name.split.first
                @tabs << content_tag('a', @short, :href => "##{@short.downcase}_panel")
                @content = capture &block
                concat content_tag('div', (
                  content_tag( 'h2', name) + @content),
                  :id => "#{@short.downcase}_panel")
              end

         end
       end



Monday, November 2, 2009
module ApplicationHelper
         class SymptomTabsFor < BlockHelpers::Base

              def initialize(title)
                @title = title
                @tabs = []
              end

              def display(body)
                content_tag('h1', "Symptoms of #{@title}") +
                content_tag('div', (
                  content_tag('ul', @tabs.collect{|t| content_tag('li', t)}, :class => 'tabs') +
                  content_tag('div', body, :class => 'panes')),
                  :id => 'symptoms')
              end

              def symptom(name, &block)
                @short = name.split.first
                @tabs << content_tag('a', @short, :href => "##{@short.downcase}_panel")
                @content = capture &block
                concat content_tag('div', (
                  content_tag( 'h2', name) + @content),
                  :id => "#{@short.downcase}_panel")
              end

         end
       end



Monday, November 2, 2009
module ApplicationHelper
         class SymptomTabsFor < BlockHelpers::Base

              def initialize(title)
                @title = title
                @tabs = []
              end

              def display(body)
                content_tag('h1', "Symptoms of #{@title}") +
                content_tag('div', (
                  content_tag('ul', @tabs.collect{|t| content_tag('li', t)}, :class => 'tabs') +
                  content_tag('div', body, :class => 'panes')),
                  :id => 'symptoms')
              end

              def symptom(name, &block)
                @short = name.split.first
                @tabs << content_tag('a', @short, :href => "##{@short.downcase}_panel")
                @content = capture &block
                concat content_tag('div', (
                  content_tag( 'h2', name) + @content),
                  :id => "#{@short.downcase}_panel")
              end

         end
       end



Monday, November 2, 2009
COMMUNITY PLUG

                     dev-groups.org
                     rubyists.eu
                     http://amsterdam-rb.org/
                     http://groups.google.com/group/utrecht-rb




Monday, November 2, 2009
FIN...




Monday, November 2, 2009
JUSTIN HALSALL

                     blog: juice10.com
                     pet project: tvnotify.com
                     twitter.com/juice10
                     wakoopa.com/juice10
                     github.com/Juice10



Monday, November 2, 2009

More Related Content

Viewers also liked

Railways
RailwaysRailways
RailwaysPete Lee
Ā 
Blue Ocean Strategy Henry Robben
Blue Ocean Strategy   Henry RobbenBlue Ocean Strategy   Henry Robben
Blue Ocean Strategy Henry RobbenNIMA
Ā 
[Cia do chopp] Planejamento Digital
[Cia do chopp] Planejamento Digital[Cia do chopp] Planejamento Digital
[Cia do chopp] Planejamento Digitalnathalia cantanhede
Ā 
Possum Class Notes
Possum Class NotesPossum Class Notes
Possum Class NotesGihan Lahoud
Ā 
propuesta didƔctica de tecnologƭa
propuesta didƔctica de tecnologƭapropuesta didƔctica de tecnologƭa
propuesta didƔctica de tecnologƭagimena ocampo
Ā 
Cebic08 Sistema 4 HilosƱ
Cebic08 Sistema 4 HilosƱCebic08 Sistema 4 HilosƱ
Cebic08 Sistema 4 HilosƱF Blanco
Ā 
Silaboinformatica 150202110744-conversion-gate02
Silaboinformatica 150202110744-conversion-gate02Silaboinformatica 150202110744-conversion-gate02
Silaboinformatica 150202110744-conversion-gate02UNIANDES
Ā 

Viewers also liked (10)

Railways
RailwaysRailways
Railways
Ā 
Blue Ocean Strategy Henry Robben
Blue Ocean Strategy   Henry RobbenBlue Ocean Strategy   Henry Robben
Blue Ocean Strategy Henry Robben
Ā 
R. zdrajkowski richard krok w kierunku klastra e_zdrowia w wl
R. zdrajkowski richard krok w kierunku klastra e_zdrowia w wlR. zdrajkowski richard krok w kierunku klastra e_zdrowia w wl
R. zdrajkowski richard krok w kierunku klastra e_zdrowia w wl
Ā 
[Cia do chopp] Planejamento Digital
[Cia do chopp] Planejamento Digital[Cia do chopp] Planejamento Digital
[Cia do chopp] Planejamento Digital
Ā 
Renovar - TablĆ³ide
Renovar - TablĆ³ideRenovar - TablĆ³ide
Renovar - TablĆ³ide
Ā 
Lunch Break
Lunch BreakLunch Break
Lunch Break
Ā 
Possum Class Notes
Possum Class NotesPossum Class Notes
Possum Class Notes
Ā 
propuesta didƔctica de tecnologƭa
propuesta didƔctica de tecnologƭapropuesta didƔctica de tecnologƭa
propuesta didƔctica de tecnologƭa
Ā 
Cebic08 Sistema 4 HilosƱ
Cebic08 Sistema 4 HilosƱCebic08 Sistema 4 HilosƱ
Cebic08 Sistema 4 HilosƱ
Ā 
Silaboinformatica 150202110744-conversion-gate02
Silaboinformatica 150202110744-conversion-gate02Silaboinformatica 150202110744-conversion-gate02
Silaboinformatica 150202110744-conversion-gate02
Ā 

Similar to DSLs for Front End Rails

Practical progressive enhancement
Practical progressive enhancementPractical progressive enhancement
Practical progressive enhancementGraham Bird
Ā 
TOSSUG HTML5 讀ę›ø꜃ ꖰęؙē±¤čˆ‡č”Ø單
TOSSUG HTML5 讀ę›ø꜃ ꖰęؙē±¤čˆ‡č”Ø單TOSSUG HTML5 讀ę›ø꜃ ꖰęؙē±¤čˆ‡č”Ø單
TOSSUG HTML5 讀ę›ø꜃ ꖰęؙē±¤čˆ‡č”Øå–®å‰ę ¼ 高
Ā 
Vue.js - zastosowanie i budowa komponentĆ³w
Vue.js - zastosowanie i budowa komponentĆ³wVue.js - zastosowanie i budowa komponentĆ³w
Vue.js - zastosowanie i budowa komponentĆ³wLaravel Poland MeetUp
Ā 
Copy of-a-walk-around-westfall-plaza
Copy of-a-walk-around-westfall-plazaCopy of-a-walk-around-westfall-plaza
Copy of-a-walk-around-westfall-plazahelgawerth
Ā 
Game Changing Dependency Management
Game Changing Dependency ManagementGame Changing Dependency Management
Game Changing Dependency ManagementJeremy Kendall
Ā 
Featured posts
Featured postsFeatured posts
Featured postsaidee58
Ā 
Index of jquery template 2 Minuteman Summer Web Dev.
Index of jquery template 2 Minuteman Summer Web Dev.Index of jquery template 2 Minuteman Summer Web Dev.
Index of jquery template 2 Minuteman Summer Web Dev.Daniel Downs
Ā 
HTML5 Essentials
HTML5 EssentialsHTML5 Essentials
HTML5 EssentialsMarc Grabanski
Ā 
The Responsive Grid & You: Extending Your WordPress Site Across Multiple Dev...
The Responsive Grid & You:  Extending Your WordPress Site Across Multiple Dev...The Responsive Grid & You:  Extending Your WordPress Site Across Multiple Dev...
The Responsive Grid & You: Extending Your WordPress Site Across Multiple Dev...Jeremy Fuksa
Ā 
Your Custom WordPress Admin Pages Suck
Your Custom WordPress Admin Pages SuckYour Custom WordPress Admin Pages Suck
Your Custom WordPress Admin Pages SuckAnthony Montalbano
Ā 
Polymer Polytechnic George Town 2014
Polymer Polytechnic George Town 2014Polymer Polytechnic George Town 2014
Polymer Polytechnic George Town 2014Vin Lim
Ā 
Herramientas de desarrollo e implementacion
Herramientas de desarrollo e implementacionHerramientas de desarrollo e implementacion
Herramientas de desarrollo e implementacionCarlos Solis
Ā 
Bootstrap 3 in Joomla!
Bootstrap 3 in Joomla!Bootstrap 3 in Joomla!
Bootstrap 3 in Joomla!Hans Kuijpers
Ā 

Similar to DSLs for Front End Rails (20)

El Codigo x jorge
El Codigo x jorgeEl Codigo x jorge
El Codigo x jorge
Ā 
JQuery Mobile UI
JQuery Mobile UIJQuery Mobile UI
JQuery Mobile UI
Ā 
Practical progressive enhancement
Practical progressive enhancementPractical progressive enhancement
Practical progressive enhancement
Ā 
TOSSUG HTML5 讀ę›ø꜃ ꖰęؙē±¤čˆ‡č”Ø單
TOSSUG HTML5 讀ę›ø꜃ ꖰęؙē±¤čˆ‡č”Ø單TOSSUG HTML5 讀ę›ø꜃ ꖰęؙē±¤čˆ‡č”Ø單
TOSSUG HTML5 讀ę›ø꜃ ꖰęؙē±¤čˆ‡č”Ø單
Ā 
Vue.js - zastosowanie i budowa komponentĆ³w
Vue.js - zastosowanie i budowa komponentĆ³wVue.js - zastosowanie i budowa komponentĆ³w
Vue.js - zastosowanie i budowa komponentĆ³w
Ā 
Copy of-a-walk-around-westfall-plaza
Copy of-a-walk-around-westfall-plazaCopy of-a-walk-around-westfall-plaza
Copy of-a-walk-around-westfall-plaza
Ā 
Game Changing Dependency Management
Game Changing Dependency ManagementGame Changing Dependency Management
Game Changing Dependency Management
Ā 
Featured posts
Featured postsFeatured posts
Featured posts
Ā 
Upload[1]
Upload[1]Upload[1]
Upload[1]
Ā 
Index of jquery template 2 Minuteman Summer Web Dev.
Index of jquery template 2 Minuteman Summer Web Dev.Index of jquery template 2 Minuteman Summer Web Dev.
Index of jquery template 2 Minuteman Summer Web Dev.
Ā 
HTML5 Essentials
HTML5 EssentialsHTML5 Essentials
HTML5 Essentials
Ā 
The Responsive Grid & You: Extending Your WordPress Site Across Multiple Dev...
The Responsive Grid & You:  Extending Your WordPress Site Across Multiple Dev...The Responsive Grid & You:  Extending Your WordPress Site Across Multiple Dev...
The Responsive Grid & You: Extending Your WordPress Site Across Multiple Dev...
Ā 
Try Web Components
Try Web ComponentsTry Web Components
Try Web Components
Ā 
Your Custom WordPress Admin Pages Suck
Your Custom WordPress Admin Pages SuckYour Custom WordPress Admin Pages Suck
Your Custom WordPress Admin Pages Suck
Ā 
Polymer Polytechnic George Town 2014
Polymer Polytechnic George Town 2014Polymer Polytechnic George Town 2014
Polymer Polytechnic George Town 2014
Ā 
Herramientas de desarrollo e implementacion
Herramientas de desarrollo e implementacionHerramientas de desarrollo e implementacion
Herramientas de desarrollo e implementacion
Ā 
laboratorio
laboratoriolaboratorio
laboratorio
Ā 
Bootstrap 3 in Joomla!
Bootstrap 3 in Joomla!Bootstrap 3 in Joomla!
Bootstrap 3 in Joomla!
Ā 
Navigation Bar.pptx
Navigation Bar.pptxNavigation Bar.pptx
Navigation Bar.pptx
Ā 
iWebkit
iWebkitiWebkit
iWebkit
Ā 

More from Justin Halsall

Principles, Backbone and Bottlenose
Principles, Backbone and BottlenosePrinciples, Backbone and Bottlenose
Principles, Backbone and BottlenoseJustin Halsall
Ā 
Vote Amsterdam For EuRuKo 2012
Vote Amsterdam For EuRuKo 2012Vote Amsterdam For EuRuKo 2012
Vote Amsterdam For EuRuKo 2012Justin Halsall
Ā 
Headless browser testing with ruby
Headless browser testing with rubyHeadless browser testing with ruby
Headless browser testing with rubyJustin Halsall
Ā 
Front End on Rails
Front End on RailsFront End on Rails
Front End on RailsJustin Halsall
Ā 

More from Justin Halsall (6)

Principles, Backbone and Bottlenose
Principles, Backbone and BottlenosePrinciples, Backbone and Bottlenose
Principles, Backbone and Bottlenose
Ā 
Vote Amsterdam For EuRuKo 2012
Vote Amsterdam For EuRuKo 2012Vote Amsterdam For EuRuKo 2012
Vote Amsterdam For EuRuKo 2012
Ā 
Headless browser testing with ruby
Headless browser testing with rubyHeadless browser testing with ruby
Headless browser testing with ruby
Ā 
HTML5 semantics
HTML5 semanticsHTML5 semantics
HTML5 semantics
Ā 
HTML5 offline
HTML5 offlineHTML5 offline
HTML5 offline
Ā 
Front End on Rails
Front End on RailsFront End on Rails
Front End on Rails
Ā 

Recently uploaded

Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfOverkill Security
Ā 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
Ā 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
Ā 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
Ā 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
Ā 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
Ā 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
Ā 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
Ā 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
Ā 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
Ā 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
Ā 
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 educationjfdjdjcjdnsjd
Ā 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
Ā 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
Ā 
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 2024The Digital Insurer
Ā 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
Ā 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
Ā 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
Ā 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
Ā 

Recently uploaded (20)

Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
Ā 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
Ā 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
Ā 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Ā 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Ā 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
Ā 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
Ā 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Ā 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Ā 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Ā 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Ā 
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
Ā 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
Ā 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
Ā 
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
Ā 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
Ā 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Ā 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
Ā 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
Ā 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
Ā 

DSLs for Front End Rails

  • 2. WHO AM I? Monday, November 2, 2009
  • 3. ME: JUSTIN HALSALL Monday, November 2, 2009
  • 4. FRONT END DEV http://www.ļ¬‚ickr.com/photos/nathaninsandiego/3687500937/ Monday, November 2, 2009
  • 5. FRONT END RAILS DEV http://www.ļ¬‚ickr.com/photos/nathaninsandiego/3687500937/ Monday, November 2, 2009
  • 6. DSLS FOR FRONT END RAILS Monday, November 2, 2009
  • 7. DSLS FOR FRONT END RAILS ~OR~ HOW TO USE BLOCKS IN YOUR VIEWS FOR MAXIMUM AMOUNTS OF AWESOMENESS Monday, November 2, 2009
  • 9. a developer working in his views A DEVELOPER http://www.ļ¬‚ickr.com/photos/nathonline/918128338 Monday, November 2, 2009
  • 10. a developer working in his views A DEVELOPER http://www.ļ¬‚ickr.com/photos/nathonline/918128338 http://www.ļ¬‚ickr.com/photos/pipeapple/2190051229 Monday, November 2, 2009
  • 11. create sexy vertical tabs displayed with javascript VERTICAL TABS http://www.ļ¬‚ickr.com/photos/denn/5291024/ Monday, November 2, 2009
  • 13. All pages have a couple things in common Monday, November 2, 2009
  • 14. <h1> All pages have a couple things in common Monday, November 2, 2009
  • 15. <h1> <ul> All pages have a couple things in common Monday, November 2, 2009
  • 16. <h1> <ul> All pages have a couple things in common <div> Monday, November 2, 2009
  • 17. <div class='clearfix lead'> <h1>...</h1> <p>...</p> </div> <div id='add_connection' class='add_connection'> <div id='tabs' class='rounded_container'> <ul> <li><a href='#tabs-step1'>1. ...</a></li> <li><a href='#tabs-step2'>2. ...</a></li> <li><a href='#tabs-step3'>3. ...</a></li> <li><a href='#tabs-sync'>4. ...</a></li> <li><a href='#tabs-done'>Finished</a></li> </ul> <div id='tabs-step1' class='setup_box'> <h2>1. ...</h2> ... <a href='#tabs-step2' class='next'>next</a> </div> <div id='tabs-step2' class='setup_box'> <h2>2. ...</h2> ... <a href='#tabs-step1' class='previous'>previous</a> <a href='#tabs-step3' class='next'>next</a> </div> <div id='tabs-step3' class='setup_box'> <h2>3. ...</h2> ... <a href='#tabs-step2' class='previous'>previous</a> <a href='#tabs-sync' class='next'>next</a> </div> <div id='tabs-sync' class='setup_box'> <h2>4. ...</h2> <h3>Status</h3> <p id='status_message'>Checking sync status...</p> <a href='#tabs-step3' class='previous'>previous</a> <a href='#tabs-done' class='next'>next</a> </div> <div id='tabs-done' class='setup_box'> <h2>Finished - Well done!</h2> <img src='/images/giant_success_tick.png' class='success' alt='Success!'> <a href='/connections' class='continue add_more' title='back'><img src='/images/add_connection_btn.png' alt='Go to Contacts' /></a> <a href='/contacts' title='Go to Contacts' class='continue'><img src='/images/gotocontacts_btn.png' alt='Go to Contacts' /></a> <a href='#tabs-sync' class='previous'>previous</a> </div> </div> </div> Monday, November 2, 2009
  • 18. <div class='clearfix lead'> <h1>...</h1> o ts L f <p>...</p> </div> <div id='add_connection' class='add_connection'> o L <div id='tabs' class='rounded_container'> <ul> <li><a href='#tabs-step1'>1. ...</a></li> M <li><a href='#tabs-step2'>2. ...</a></li> <li><a href='#tabs-step3'>3. ...</a></li> T <li><a href='#tabs-sync'>4. ...</a></li> <li><a href='#tabs-done'>Finished</a></li> </ul> H <div id='tabs-step1' class='setup_box'> <h2>1. ...</h2> ... <a href='#tabs-step2' class='next'>next</a> </div> <div id='tabs-step2' class='setup_box'> <h2>2. ...</h2> ... <a href='#tabs-step1' class='previous'>previous</a> <a href='#tabs-step3' class='next'>next</a> </div> <div id='tabs-step3' class='setup_box'> <h2>3. ...</h2> ... <a href='#tabs-step2' class='previous'>previous</a> <a href='#tabs-sync' class='next'>next</a> </div> <div id='tabs-sync' class='setup_box'> <h2>4. ...</h2> <h3>Status</h3> <p id='status_message'>Checking sync status...</p> <a href='#tabs-step3' class='previous'>previous</a> <a href='#tabs-done' class='next'>next</a> </div> <div id='tabs-done' class='setup_box'> <h2>Finished - Well done!</h2> <img src='/images/giant_success_tick.png' class='success' alt='Success!'> <a href='/connections' class='continue add_more' title='back'><img src='/images/add_connection_btn.png' alt='Go to Contacts' /></a> <a href='/contacts' title='Go to Contacts' class='continue'><img src='/images/gotocontacts_btn.png' alt='Go to Contacts' /></a> <a href='#tabs-sync' class='previous'>previous</a> </div> </div> </div> Monday, November 2, 2009
  • 19. <div class='clearfix lead'> <h1>...</h1> o ts L f <p>...</p> </div> <div id='add_connection' class='add_connection'> o L <div id='tabs' class='rounded_container'> <ul> <li><a href='#tabs-step1'>1. ...</a></li> M <li><a href='#tabs-step2'>2. ...</a></li> <li><a href='#tabs-step3'>3. ...</a></li> T <li><a href='#tabs-sync'>4. ...</a></li> <li><a href='#tabs-done'>Finished</a></li> </ul> H <div id='tabs-step1' class='setup_box'> <h2>1. ...</h2> ... <a href='#tabs-step2' class='next'>next</a> </div> <div id='tabs-step2' class='setup_box'> <h2>2. ...</h2> ... <a href='#tabs-step1' class='previous'>previous</a> <a href='#tabs-step3' class='next'>next</a> </div> <div id='tabs-step3' class='setup_box'> Du <h2>3. ...</h2> ... <a href='#tabs-step2' class='previous'>previous</a> pli <a href='#tabs-sync' class='next'>next</a> </div> <div id='tabs-sync' class='setup_box'> <h2>4. ...</h2> ca <h3>Status</h3> <p id='status_message'>Checking sync status...</p> tio <a href='#tabs-step3' class='previous'>previous</a> <a href='#tabs-done' class='next'>next</a> </div> n <div id='tabs-done' class='setup_box'> <h2>Finished - Well done!</h2> <img src='/images/giant_success_tick.png' class='success' alt='Success!'> <a href='/connections' class='continue add_more' title='back'><img src='/images/add_connection_btn.png' alt='Go to Contacts' /></a> <a href='/contacts' title='Go to Contacts' class='continue'><img src='/images/gotocontacts_btn.png' alt='Go to Contacts' /></a> <a href='#tabs-sync' class='previous'>previous</a> </div> </div> </div> Monday, November 2, 2009
  • 20. <div class='clearfix lead'> <h1>...</h1> o ts L f <p>...</p> </div> <div id='add_connection' class='add_connection'> o L <div id='tabs' class='rounded_container'> <ul> <li><a href='#tabs-step1'>1. ...</a></li> M <li><a href='#tabs-step2'>2. ...</a></li> <li><a href='#tabs-step3'>3. ...</a></li> T <li><a href='#tabs-sync'>4. ...</a></li> <li><a href='#tabs-done'>Finished</a></li> </ul> H <div id='tabs-step1' class='setup_box'> <h2>1. ...</h2> ... <a href='#tabs-step2' class='next'>next</a> </div> <div id='tabs-step2' class='setup_box'> <h2>2. ...</h2> ... <a href='#tabs-step1' class='previous'>previous</a> <a href='#tabs-step3' class='next'>next</a> </div> <div id='tabs-step3' class='setup_box'> Du <h2>3. ...</h2> ... <a href='#tabs-step2' class='previous'>previous</a> pli <a href='#tabs-sync' class='next'>next</a> </div> <div id='tabs-sync' class='setup_box'> <h2>4. ...</h2> ca <h3>Status</h3> <p id='status_message'>Checking sync status...</p> tio <a href='#tabs-step3' class='previous'>previous</a> <a href='#tabs-done' class='next'>next</a> </div> n <div id='tabs-done' class='setup_box'> <h2>Finished - Well done!</h2> <img src='/images/giant_success_tick.png' class='success' alt='Success!'> <a href='/connections' class='continue add_more' title='back'><img src='/images/add_connection_btn.png' alt='Go to Contacts' /></a> <a href='/contacts' title='Go to Contacts' class='continue'><img src='/images/gotocontacts_btn.png' alt='Go to Contacts' /></a> <a href='#tabs-sync' class='previous'>previous</a> </div> </div> </div> Monday, November 2, 2009
  • 21. Imagine having to do this 8 times and changing things around Awefull Monday, November 2, 2009
  • 22. HOW COULD THIS BE BETTER? Monday, November 2, 2009
  • 23. And on the 8th day I created methods to awesomify with your views. You shall refer to these as helpers. if we where evil we could misuse rails helpers with blocks to create a nice little DSL we can use everywhere GOD GAVE US HELPERS http://www.ļ¬‚ickr.com/photos/zippy/2429678961/ Monday, November 2, 2009
  • 24. And on the 8th day I created methods to awesomify with your views. You shall refer to these as helpers. if we where evil we could misuse rails helpers with blocks to create a nice little DSL we can use everywhere GOD GAVE US HELPERS http://www.ļ¬‚ickr.com/photos/zippy/2429678961/ Monday, November 2, 2009
  • 25. And on the 8th day I created methods to awesomify with your views. Kill JAVA! You shall refer to these as helpers. if we where evil we could misuse rails helpers with blocks to create a nice little DSL we can use everywhere GOD GAVE US HELPERS http://www.ļ¬‚ickr.com/photos/zippy/2429678961/ Monday, November 2, 2009
  • 26. <% add_connection_tabs(:for => "...", :subtitle => "...") do |tab| %> <% tab.step "..." do %> ... <% end %> <% tab.step "..." do %> ... <% end %> <% tab.step "..." do %> ... <% end %> <% tab.sync %> <% tab.done %> <% end %> Monday, November 2, 2009
  • 27. http://www.ļ¬‚ickr.com/photos/bodoggirl/3598561539 http://www.ļ¬‚ickr.com/photos/juice10/3501376901 Monday, November 2, 2009
  • 28. x y! Se http://www.ļ¬‚ickr.com/photos/bodoggirl/3598561539 http://www.ļ¬‚ickr.com/photos/juice10/3501376901 Monday, November 2, 2009
  • 29. LOOKING GOOD HURTS http://www.ļ¬‚ickr.com/photos/thenovys/3791884189 Monday, November 2, 2009
  • 30. HOW TO TAKE THE HURT OUT OF LOOKING BEAUTIFUL (ehow.com) 1) Freeze t weezers before t weezing eyebrows, it'll numb the area being t weezed at its touch. 2) Carry those oversized designer purses and totes on different shoulders everyday to avoid straining your arms and shoulder muscles. 3) Make sure to thoroughly stretch your muscles before exercising to increase.. bla bla bla 4) Choose the best fitted high heel or stiletto possible to reduce pain and pressure on your toes (translated ā€“ donā€™t choose a heel thatā€™ll make your foot slide leaving a gap bet ween the shoe and back of your foot). 5) Something about sticking tape on your toes so that your sandals don't eat your feet Monday, November 2, 2009
  • 31. BLOCK_HELPER http://github.com/markevans/block_helpers Dax briefly talked about it yesterday Monday, November 2, 2009
  • 32. wor ks b stick etter y tap than e on stick your ing toes BLOCK_HELPER http://github.com/markevans/block_helpers Dax briefly talked about it yesterday Monday, November 2, 2009
  • 33. THE MEAT http://www.ļ¬‚ickr.com/photos/splorp/12200621 Monday, November 2, 2009
  • 34. # config/environment.rb config.gem "block_helpers", :lib => "block_helpers", :source => "http://gemcutter.org" $ rake gems:install Monday, November 2, 2009
  • 35. THE PAGE WE ARE GOING TO DRYUP <h1>Symptoms of Apple addiction</h1> <div id='symptoms'> <ul class="tabs"> <li><a href="#praying_panel">Praying</a></li> <li><a href="#happiness_panel">Happiness</a></li> <li><a href="#microsoft_panel">Microsoft</a></li> </ul> <div class="panes"> <div id="praying_panel"> <h2>Praying to Steve Jobs</h2> <p>It is not uncommon for an Apple addict to pray to his Steveness.</p> </div> <div id="happiness_panel"> <h2>Happiness and iPhone battery level equal</h2> <p>Addict gets the shakes from low battery power</p> </div> <div id="microsoft_panel"> <h2>Microsoft powered nervous break downs</h2> <p>Addict gets the shakes from non-Apple devices</p> </div> </div> </div> Monday, November 2, 2009
  • 36. THE PAGE WE ARE GOING TO DRYUP <h1>Symptoms of Apple addiction</h1> <div id='symptoms'> <ul class="tabs"> <li><a href="#praying_panel">Praying</a></li> <li><a href="#happiness_panel">Happiness</a></li> <li><a href="#microsoft_panel">Microsoft</a></li> </ul> <div class="panes"> <div id="praying_panel"> <h2>Praying to Steve Jobs</h2> <p>It is not uncommon for an Apple addict to pray to his Steveness.</p> </div> <div id="happiness_panel"> <h2>Happiness and iPhone battery level equal</h2> <p>Addict gets the shakes from low battery power</p> </div> <div id="microsoft_panel"> <h2>Microsoft powered nervous break downs</h2> <p>Addict gets the shakes from non-Apple devices</p> </div> </div> </div> Monday, November 2, 2009
  • 37. NO MORE TOWELS NEEDED <% symptom_tabs_for "Apple addiction" do |tabs| %> <% tabs.symptom "Praying to Steve Jobs" do %> <p>It is not uncommon for an Apple addict to pray to his Steveness.</p> <% end %> <% tabs.symptom "Happiness and iPhone energy level equal" do %> <p>Addict gets the shakes from low battery power</p> <% end %> <% tabs.symptom "Microsoft powered nervous break downs" do %> <p>Addict gets the shakes from non-Apple devices</p> <% end %> <% end %> Monday, November 2, 2009
  • 38. ARE WE THERE YET? http://www.ļ¬‚ickr.com/photos/sbluerock/415736417 Monday, November 2, 2009
  • 39. NO! SHUT UP OR NO MORE TV! http://www.ļ¬‚ickr.com/photos/chubbychandru/2273272995 Monday, November 2, 2009
  • 40. FIRST THINGS FIRST # view.html.erb <% symptom_tabs_for "Apple addiction" do |tabs| %> ... <% end %> # application_helper.rb module ApplicationHelper class SymptomTabsFor < BlockHelpers::Base # symptom_tabs_for code end end Monday, November 2, 2009
  • 41. # view.html.erb <% symptom_tabs_for "Apple addiction" do |tabs| %> <% tabs.symptom "Praying to Steve Jobs" do %> ... <% end %> ... <% end %> # application_helper.rb module ApplicationHelper class SymptomTabsFor < BlockHelpers::Base def initialize(title) end def symptom(name, &block) end end end Monday, November 2, 2009
  • 42. # view.html.erb <% symptom_tabs_for "Apple addiction" do |tabs| %> ... <% end %> # application_helper.rb module ApplicationHelper class SymptomTabsFor < BlockHelpers::Base def initialize(title) @title = title end def display(body) content_tag('h1', "Symptoms of #{@title}") + content_tag('div', ( content_tag('div', body, :class => 'panes')), :id => 'symptoms') end end end Monday, November 2, 2009
  • 43. # view.html.erb <% symptom_tabs_for "Apple addiction" do |tabs| %> ... <% end %> # application_helper.rb module ApplicationHelper class SymptomTabsFor < BlockHelpers::Base def initialize(title) @title = title end def display(body) content_tag('h1', "Symptoms of #{@title}") + content_tag('div', ( content_tag('div', body, :class => 'panes')), :id => 'symptoms') end end end Monday, November 2, 2009
  • 44. # view.html.erb <% symptom_tabs_for "Apple addiction" do |tabs| %> ... <% end %> # application_helper.rb module ApplicationHelper class SymptomTabsFor < BlockHelpers::Base def initialize(title) @title = title end def display(body) content_tag('h1', "Symptoms of #{@title}") + content_tag('div', ( content_tag('div', body, :class => 'panes')), :id => 'symptoms') end end end Monday, November 2, 2009
  • 45. # view.html.erb <% symptom_tabs_for "Apple addiction" do |tabs| %> ... <% end %> # application_helper.rb module ApplicationHelper class SymptomTabsFor < BlockHelpers::Base def initialize(title) @title = title end def display(body) content_tag('h1', "Symptoms of #{@title}") + content_tag('div', ( content_tag('div', body, :class => 'panes')), :id => 'symptoms') end end end Monday, November 2, 2009
  • 46. # view.html.erb <% symptom_tabs_for "Apple addiction" do |tabs| %> ... <% end %> # application_helper.rb module ApplicationHelper class SymptomTabsFor < BlockHelpers::Base def initialize(title) @title = title end def display(body) content_tag('h1', "Symptoms of #{@title}") + content_tag('div', ( content_tag('div', body, :class => 'panes')), :id => 'symptoms') end end end # browser <h1>Symptoms of Apple addiction</h1> <div id="symptoms"> <div class="panes"> </div> </div> Monday, November 2, 2009
  • 47. # application_helper.rb module ApplicationHelper class SymptomTabsFor < BlockHelpers::Base def initialize(title) @title = title end def display(body) content_tag('h1', "Symptoms of #{@title}") + content_tag('div', ( content_tag('div', body, :class => 'panes')), :id => 'symptoms') end def sypmtom(name, &block) @short = name.split.first @content = capture &block concat content_tag('div', ( content_tag( 'h2', name) + @content), :id => "#{@short.downcase}_panel") end end end Monday, November 2, 2009
  • 48. # application_helper.rb module ApplicationHelper class SymptomTabsFor < BlockHelpers::Base def initialize(title) @title = title end def display(body) content_tag('h1', "Symptoms of #{@title}") + content_tag('div', ( content_tag('div', body, :class => 'panes')), :id => 'symptoms') end def sypmtom(name, &block) @short = name.split.first @content = capture(&block) concat content_tag('div', ( content_tag( 'h2', name) + @content), :id => "#{@short.downcase}_panel") end end end Monday, November 2, 2009
  • 49. # application_helper.rb module ApplicationHelper class SymptomTabsFor < BlockHelpers::Base def initialize(title) @title = title end def display(body) content_tag('h1', "Symptoms of #{@title}") + content_tag('div', ( content_tag('div', body, :class => 'panes')), :id => 'symptoms') end def sypmtom(name, &block) @short = name.split.first @content = capture(&block) concat content_tag('div', ( content_tag( 'h2', name) + @content), :id => "#{@short.downcase}_panel") end end end Monday, November 2, 2009
  • 50. # application_helper.rb module ApplicationHelper class SymptomTabsFor < BlockHelpers::Base def initialize(title) @title = title end def display(body) content_tag('h1', "Symptoms of #{@title}") + content_tag('div', ( content_tag('div', body, :class => 'panes')), :id => 'symptoms') end def sypmtom(name, &block) @short = name.split.first @content = capture(&block) concat content_tag('div', ( content_tag( 'h2', name) + @content), :id => "#{@short.downcase}_panel") end end end Monday, November 2, 2009
  • 51. CONCAT concat "hello" # the equivalent of <%= "hello" %> Monday, November 2, 2009
  • 52. CAPTURE <% @greeting = capture do %> Welcome to my shiny new web page! The date and time is <%= Time.now %> <% end %> def myblockheader(&block) content = capture(&block) concat(content_tag('h1', content)) end <% myblockheader do %> Welcome to my shiny new web page! <% end %> Monday, November 2, 2009
  • 53. module ApplicationHelper class SymptomTabsFor < BlockHelpers::Base def initialize(title) @title = title @tabs = [] end def display(body) content_tag('h1', "Symptoms of #{@title}") + content_tag('div', ( content_tag('ul', @tabs.collect{|t| content_tag('li', t)}, :class => 'tabs') + content_tag('div', body, :class => 'panes')), :id => 'symptoms') end def symptom(name, &block) @short = name.split.first @tabs << content_tag('a', @short, :href => "##{@short.downcase}_panel") @content = capture &block concat content_tag('div', ( content_tag( 'h2', name) + @content), :id => "#{@short.downcase}_panel") end end end Monday, November 2, 2009
  • 54. module ApplicationHelper class SymptomTabsFor < BlockHelpers::Base def initialize(title) @title = title @tabs = [] end def display(body) content_tag('h1', "Symptoms of #{@title}") + content_tag('div', ( content_tag('ul', @tabs.collect{|t| content_tag('li', t)}, :class => 'tabs') + content_tag('div', body, :class => 'panes')), :id => 'symptoms') end def symptom(name, &block) @short = name.split.first @tabs << content_tag('a', @short, :href => "##{@short.downcase}_panel") @content = capture &block concat content_tag('div', ( content_tag( 'h2', name) + @content), :id => "#{@short.downcase}_panel") end end end Monday, November 2, 2009
  • 55. module ApplicationHelper class SymptomTabsFor < BlockHelpers::Base def initialize(title) @title = title @tabs = [] end def display(body) content_tag('h1', "Symptoms of #{@title}") + content_tag('div', ( content_tag('ul', @tabs.collect{|t| content_tag('li', t)}, :class => 'tabs') + content_tag('div', body, :class => 'panes')), :id => 'symptoms') end def symptom(name, &block) @short = name.split.first @tabs << content_tag('a', @short, :href => "##{@short.downcase}_panel") @content = capture &block concat content_tag('div', ( content_tag( 'h2', name) + @content), :id => "#{@short.downcase}_panel") end end end Monday, November 2, 2009
  • 56. module ApplicationHelper class SymptomTabsFor < BlockHelpers::Base def initialize(title) @title = title @tabs = [] end def display(body) content_tag('h1', "Symptoms of #{@title}") + content_tag('div', ( content_tag('ul', @tabs.collect{|t| content_tag('li', t)}, :class => 'tabs') + content_tag('div', body, :class => 'panes')), :id => 'symptoms') end def symptom(name, &block) @short = name.split.first @tabs << content_tag('a', @short, :href => "##{@short.downcase}_panel") @content = capture &block concat content_tag('div', ( content_tag( 'h2', name) + @content), :id => "#{@short.downcase}_panel") end end end Monday, November 2, 2009
  • 57. COMMUNITY PLUG dev-groups.org rubyists.eu http://amsterdam-rb.org/ http://groups.google.com/group/utrecht-rb Monday, November 2, 2009
  • 59. JUSTIN HALSALL blog: juice10.com pet project: tvnotify.com twitter.com/juice10 wakoopa.com/juice10 github.com/Juice10 Monday, November 2, 2009