Sha256: 738610e72b56a3dafdc5f123775adddaa97747046ea4d9508cc97d51e217e9b3

Contents?: true

Size: 770 Bytes

Versions: 1

Compression:

Stored size: 770 Bytes

Contents

module HamlLayouts
  module Models
    module Layout
      
      def self.included(base)
        base.class_eval do
          
          # Will render html from haml if necessary
          def rendered_content
            if is_haml?
              Haml::Engine.new(content).render 
            else
              content
            end
          end
          
          # Returns 'text/html' to the browser (if haml)           
          def content_type
            self[:content_type] == 'haml' ? 'text/html' : self[:content_type]
          end

          # Overwrites the standard Radiant Render and pumps out haml if necessary
          def is_haml?
            self[:content_type] == 'haml'
          end
          
        end
      end
      
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
radiant-layouts-extension-1.1.0 lib/haml_layouts/models/layout.rb