Sha256: 83db6afcb6504b77450f56a5eebd0cde501c4cd119251aab90f78f9533262f2f

Contents?: true

Size: 852 Bytes

Versions: 7

Compression:

Stored size: 852 Bytes

Contents

require 'slippers'

module Ramaze
  module View
    module Slippers
      def self.call(action, string)
        slippers = View.compile(string){|s| ::Slippers::Engine.new(s, :template_group => template_group(action)) }
        object_to_render = ::Slippers::BindingWrapper.new(action.instance.binding)
        html = slippers.render(object_to_render)
        return html, 'text/html'
      end
      
      private
        def self.template_group(action)
          subtemplates = action.instance.ancestral_trait[:slippers_options] || {}
          views = action.instance.options[:views].map{|view| "#{action.instance.options[:roots]}/#{view}" }
          super_group = ::Slippers::TemplateGroup.new(:templates => subtemplates)
          ::Slippers::TemplateGroupDirectory.new(views, :super_group => super_group)          
        end
    end
  end
end

Version data entries

7 entries across 7 versions & 3 rubygems

Version Path
starapor-slippers-0.0.9 lib/ramazeTemplates/slippers.rb
slippers-0.0.14 lib/ramazeTemplates/slippers.rb
slippers-0.0.13 lib/ramazeTemplates/slippers.rb
slippers-0.0.12 lib/ramazeTemplates/slippers.rb
ramaze-2009.10 lib/ramaze/view/slippers.rb
slippers-0.0.11 lib/ramazeTemplates/slippers.rb
slippers-0.0.10 lib/ramazeTemplates/slippers.rb