Sha256: cb10e385f5120a984d96ad1eb37ebdfc0cd0546752f8ce355013caef3f74c875
Contents?: true
Size: 1.35 KB
Versions: 3
Compression:
Stored size: 1.35 KB
Contents
require 'rubygems' require 'ramaze' class MainController < Ramaze::Controller template_root __DIR__/:template engine :Liquid def index %{ #{A 'Home', :href => :/} | #{A(:internal)} | #{A(:external)} } end def liquid_hash(place, *args) { 'header' => "The #{place} Template for Liquid", 'link_home' => A('Home', :href => :/), '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 def internal *args @hash = liquid_hash(: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 @hash = liquid_hash(:external, *args) end end Ramaze.start
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ramaze-0.3.5 | examples/templates/template_liquid.rb |
ramaze-0.3.9 | examples/templates/template_liquid.rb |
ramaze-0.3.9.1 | examples/templates/template_liquid.rb |