Sha256: 67049100c902326230b78a1727dd5579d9d328301588ff4fb1b4c36373672407

Contents?: true

Size: 1.58 KB

Versions: 4

Compression:

Stored size: 1.58 KB

Contents

require 'sinatra/base'
require 'haml'
require 'rack/jquery'

class App < Sinatra::Base

  enable :inline_templates
  use Rack::JQuery

  get "/" do
    output = <<STR
!!!
%body
  %ul
    %li
      %a{ href: "/google-cdn"} google-cdn
    %li
      %a{ href: "/media-temple-cdn"} media-temple-cdn
    %li
      %a{ href: "/microsoft-cdn"} microsoft-cdn
    %li
      %a{ href: "/cloudflare-cdn"} cloudflare-cdn
    %li
      %a{ href: "/unspecified-cdn"} unspecified-cdn
STR
    haml output
  end

  get "/google-cdn" do
    haml :index, :layout => :google
  end

  get "/media-temple-cdn" do
    haml :index, :layout => :mediatemple
  end

  get "/microsoft-cdn" do
    haml :index, :layout => :microsoft
  end

  get "/cloudflare-cdn" do
    haml :index, :layout => :cloudflare
  end

  get "/unspecified-cdn" do
    haml :index, :layout => :unspecified
  end
end

__END__

@@google
%html
  %head
    = Rack::JQuery.cdn( :google )
  = yield

@@microsoft
%html
  %head
    = Rack::JQuery.cdn( :microsoft )
  = yield

@@mediatemple
%html
  %head
    = Rack::JQuery.cdn( :media_temple )
  = yield

@@cloudflare
%html
  %head
    = Rack::JQuery.cdn( :cloudflare )
  = yield

@@unspecified
%html
  %head
    = Rack::JQuery.cdn()
  = yield

@@index
  
%p.aclass
  "NOTHING TO SEE HERE… "
%p.aclass
  "MOVE ALONG… "
%p.aclass
  "MOVE ALONG… "
#placeholder
:javascript
  all_text = $('.aclass').text();
  $('#placeholder').text(all_text).mouseover(function() {
    $(this).css({ 'color': 'red', 'font-size': '150%' });    
  }).mouseout(function() {
    $(this).css({ 'color': 'blue', 'font-size': '100%' });
  });

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rack-jquery-1.5.1 examples/config.rb
rack-jquery-1.5.0 examples/config.rb
rack-jquery-1.4.0 examples/config.rb
rack-jquery-1.3.2 examples/config.rb