Sha256: 8078048544a2a965a30eb73f997ea6ed1fb79f1f4576ac1aceb767ab002de221

Contents?: true

Size: 1.06 KB

Versions: 10

Compression:

Stored size: 1.06 KB

Contents

require 'rubygems'
require 'ramaze'

class MainController < Ramaze::Controller
  view_root __DIR__(:template)
  engine :Erubis

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

  def internal *args
    @args = args
    @place = :internal
    %q{
<html>
  <head>
    <title>Template::Erubis internal</title>
  </head>
  <body>
  <h1>The internal Template for Erubis</h1>
    <%= A('Home', :href => :/) %>
    <p>
      Here you can pass some stuff if you like, parameters are just passed like this:<br />
      <%= A("/#@place/one") %><br />
      <%= A("#@place/two/three") %><br />
      <%= A("#@place/one?foo=bar") %><br />
    </p>
    <div>
      The arguments you have passed to this action are:
      <% if @args.empty? %>
        none
      <% else %>
        <% @args.each do |arg| %>
          <span><%= arg %></span>
        <% end %>
      <% end %>
    </div>
    <div>
      <%= request.params.inspect %>
    </div>
  </body>
</html>
    }
  end

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

Ramaze.start

Version data entries

10 entries across 10 versions & 4 rubygems

Version Path
Pistos-ramaze-2008.12 examples/templates/template_erubis.rb
Pistos-ramaze-2009.01 examples/templates/template_erubis.rb
Pistos-ramaze-2009.02 examples/templates/template_erubis.rb
manveru-ramaze-2008.12 examples/templates/template_erubis.rb
manveru-ramaze-2009.01 examples/templates/template_erubis.rb
ptomato-ramaze-2009.02.1 examples/templates/template_erubis.rb
ptomato-ramaze-2009.02 examples/templates/template_erubis.rb
ramaze-2009.01 examples/templates/template_erubis.rb
ramaze-2009.02 examples/templates/template_erubis.rb
ramaze-2009.03 examples/templates/template_erubis.rb