Sha256: 513a001010b90eea3f7c08f9134190fdadcb456c75257f5f39f242b0fd98f142

Contents?: true

Size: 887 Bytes

Versions: 5

Compression:

Stored size: 887 Bytes

Contents

require 'rubygems'
require 'trellis'

include Trellis

module Simplest
  
  class Simplest < Application
    home :start
  end
  
  class Start < Page 
    attr_accessor :current_time 
    
    def initialize
      @current_time = Time.now
    end
    
    template do # using Markaby
      thtml { 
        head { title "Simplest Trellis Application" }
        body { 
          h1 "Simplest Trellis Application" 
          p "One Application, One Page, Two Components"
          p "The time below should change after each request."
          p {
            text "The current time is: "
            text %[<trellis:value name="current_time">${currentTime}.</trellis:value>]
          }
          p {
            text %[[<trellis:page_link tpage="start">refresh</trellis:page_link>]]
          }
        }
      } 
    end
  end
  
  Simplest.new.start if __FILE__ == $PROGRAM_NAME
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
trellis-0.1.1 examples/simplest/source/simplest.rb
trellis-0.1.0 examples/simplest/source/simplest.rb
trellis-0.0.9 examples/simplest/source/simplest.rb
trellis-0.0.8 examples/simplest/source/simplest.rb
trellis-0.0.7 examples/simplest/source/simplest.rb