Sha256: d347aa5b12da1c3d0b955e1924907345d5b7dfa49e8eb3e62bffddd929d43427

Contents?: true

Size: 1.14 KB

Versions: 8

Compression:

Stored size: 1.14 KB

Contents

require "rubygems"
require "ramaze"

class MainController < Ramaze::Controller
  view_root __DIR__/:template
  engine :Tenjin

  def index
    %{ #{A 'Home', :href => :/} | #{A(:internal)} | #{A(:external)} }
  end

  def internal(*args)
    @args = args
    @place = :internal
    <<'__TENJIN__'
<html>
  <head>
    <title>Template::Tenjin #{@place}</title>
  </head>
  <body>
  <h1>The #{@place} Template for Tenjin</h1>
  <a href="#{Rs(:/)}">Home</a>
  <p>
  Here you can pass some stuff if you like, parameters are just passed like this:<br />
  <a href="#{Rs(@place, :one)}">#{Rs(@place, :one)}</a><br />
  <a href="#{Rs(@place, :two, :three)}">#{Rs(@place, :two, :three)}</a><br />
  <a href="#{Rs(@place, :one, :foo => :bar)}">#{Rs(@place, :one, :foo => :bar)}</a>
  </p>

  <div>
    The arguments you have passed to this action are:<br />
    <?rb if @args.empty? ?>
      none
    <?rb else ?>
      <?rb @args.each do |arg| ?>
        <span>#{arg}</span>
      <?rb end ?>
    <?rb end ?>
  </div>

  <div>#{request.params.inspect}</div>
  </body>
</html>
__TENJIN__
  end

  def external(*args)
    @args = args
    @place = :external
  end
end

Ramaze.start

Version data entries

8 entries across 8 versions & 4 rubygems

Version Path
Pistos-ramaze-2008.09 examples/templates/template_tenjin.rb
clivecrous-ramaze-0.3.9.5 examples/templates/template_tenjin.rb
manveru-ramaze-2008.07 examples/templates/template_tenjin.rb
manveru-ramaze-2008.08 examples/templates/template_tenjin.rb
manveru-ramaze-2008.09 examples/templates/template_tenjin.rb
manveru-ramaze-2008.10 examples/templates/template_tenjin.rb
ramaze-2008.06 examples/templates/template_tenjin.rb
ramaze-2008.11 examples/templates/template_tenjin.rb