Sha256: 4583444316c27de0bf0d50501df1b3b470173270c8171d6c962ddbe94c8e1bc4

Contents?: true

Size: 1.32 KB

Versions: 37

Compression:

Stored size: 1.32 KB

Contents

require 'rubygems'
require 'ramaze'

class MainController < Ramaze::Controller
  engine :Liquid

  def index
    %{ {% anchor "Home" / %} |
       {% anchor "internal" internal %} |
       {% anchor "external" external %}}
  end

  def internal(*args)
    set_liquid_variables(:internal, *args)

    %q{
<html>
  <head>
    <title>Template::Liquid internal</title>
  </head>
  <body>
  <h1>{{header}}</h1>
    {{link_home}}
    <p>
      Here you can pass some stuff if you like, parameters are just passed like this:<br />
      {{link_one}}<br />
      {{link_two}}<br />
      {{link_three}}
    </p>
    <div>
      The arguments you have passed to this action are:
      {% if args_empty %}
        none
      {% else %}
        {% for arg in args %}
          <span>{{arg}}</span>
        {% endfor %}
      {% endif %}
    </div>
    <div>
      {{params}}
    </div>
  </body>
</html>
    }
  end

  def external *args
    set_liquid_variables(:internal, *args)
  end

  private

  def set_liquid_variables(place, *args)
    @header = "The #{place} Template for Liquid"
    @link_home = a('Home', :/)
    @link_one = a("#{place}/one")
    @link_two = a("#{place}/one/two/three")
    @link_three = a("#{place}?foo=Bar")
    @args = args
    @args_empty = args.empty?
    @params = request.params.inspect
  end
end

Ramaze.start :file => __FILE__

Version data entries

37 entries across 37 versions & 4 rubygems

Version Path
ramaze-2023.01.06 examples/templates/template_liquid.rb
Pistos-ramaze-2009.04.08 examples/templates/template_liquid.rb
Pistos-ramaze-2009.06.12 examples/templates/template_liquid.rb
manveru-ramaze-2009.04.01 examples/templates/template_liquid.rb
manveru-ramaze-2009.04.08 examples/templates/template_liquid.rb
manveru-ramaze-2009.04.18 examples/templates/template_liquid.rb
manveru-ramaze-2009.04.22 examples/templates/template_liquid.rb
manveru-ramaze-2009.04 examples/templates/template_liquid.rb
manveru-ramaze-2009.05.08 examples/templates/template_liquid.rb
manveru-ramaze-2009.05 examples/templates/template_liquid.rb
manveru-ramaze-2009.06.04 examples/templates/template_liquid.rb
manveru-ramaze-2009.06.12 examples/templates/template_liquid.rb
manveru-ramaze-2009.06 examples/templates/template_liquid.rb
manveru-ramaze-2009.07 examples/templates/template_liquid.rb
rjspotter-ramaze-2009.06.29 examples/templates/template_liquid.rb
rjspotter-ramaze-2009.06.31 examples/templates/template_liquid.rb
ramaze-2012.12.08 examples/templates/template_liquid.rb
ramaze-2012.12.08b examples/templates/template_liquid.rb
ramaze-2012.04.14 examples/templates/template_liquid.rb
ramaze-2012.03.07 examples/templates/template_liquid.rb