Sha256: db71905e67e4c965160be2df19a11cf2e63f0b8b0b6cf42b4dbee3f1b70010e2

Contents?: true

Size: 1.21 KB

Versions: 2

Compression:

Stored size: 1.21 KB

Contents

require "rubygems"
require "ramaze"

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

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

  def internal(*args)
    @context = {
      :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)
    @context = {
      :args => args,
      :place => :external
    }
  end
end

Ramaze.start

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ramaze-0.3.9.1 examples/templates/template_tenjin.rb
ramaze-0.3.9 examples/templates/template_tenjin.rb