Sha256: 332c40d1276c22aab2ce8010ce61fd55e2e693643fb18c5b62d60d5e27c168b1

Contents?: true

Size: 1.17 KB

Versions: 3

Compression:

Stored size: 1.17 KB

Contents

#          Copyright (c) 2006 Michael Fellinger m.fellinger@gmail.com
# All files in this distribution are subject to the terms of the Ruby license.

require 'ramaze'

class MainController < Ramaze::Controller
  template_root File.expand_path((File.dirname(__FILE__)/'template'))
  trait :engine => Ramaze::Template::Haml

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

  def internal *args
    @args = args
    @place = :internal
    @title = "The #@place Template for Haml"

    %q{
%html
  %head
    %title= "Template::Haml #@place"
  %body
    %h1= @title
    = 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/one/two/three")
      %br/
      = A("#@place/one?foo=bar")
    %div 
      The arguments you have passed to this action are:
      - if @args.empty?
        none
      - else
        - @args.each do |arg|
          %span= arg
    %div= request.params.inspect
    }
  end

  def external *args
    @args = args
    @place = :external
    @title = "The #@place Template for Haml"
  end
end

Ramaze.start

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ramaze-0.1.2 examples/templates/template_haml.rb
ramaze-0.1.1 examples/templates/template_haml.rb
ramaze-0.1.3 examples/templates/template_haml.rb