Sha256: cfbd592346484d647f0bad68513c970b1ea1aa8573ce34bc52808d768844944b

Contents?: true

Size: 729 Bytes

Versions: 2

Compression:

Stored size: 729 Bytes

Contents

require 'rubygems'
require 'capcode'
require 'capcode/render/markaby'
$:.unshift( "../lib" )
require 'capcode/render/coffee'


module Capcode
  set :coffee, "coffee", {:no_wrap => true}
  
  class Index < Route '/'
    def get
      @time = Time.now
      render :markaby => :index, :layout => :glop
    end
  end
  
  class Script < Route '/coffee'
    def get
      render :coffee => :alert
    end
  end
end

module Capcode::Views
  def glop
    html do
      head do
        script :type => "text/javascript", :src => "/coffee"
      end
      body do
        yield
      end
    end
  end
  
  def index
    h1 "Hello !"
    p "It's #{@time}"
    a "Try Coffee !", :href => "javascript:alert_me();"
  end
end

Capcode.run( )

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
capcode-render-coffee-script-0.2.0 examples/render-coffee.rb
capcode-render-coffee-script-0.1.0 examples/render-coffee.rb