Sha256: 03dc6bcebd2999a0a96b09ff6fde4d1c13bf4bde2f056c7bd74d7c09603917de

Contents?: true

Size: 1.01 KB

Versions: 2

Compression:

Stored size: 1.01 KB

Contents

module AbstractInterface
  module ViewHelper
    def b
      @b ||= AbstractInterface::ViewBuilder.new self
    end
    alias_method :builder, :b

    def themed_resource resource
      "/#{AbstractInterface.plugin_name.must_not_be.blank}/themes/#{current_theme.name}/#{resource}"
    end
    
    def themed_partial partial
      themed_partial = "/themes/#{current_theme.name}/#{partial}"
      if Template.exist? themed_partial
        themed_partial
      else
        "/themes/default/#{partial}"
      end
    end
    
    def current_theme
      @current_theme ||= AbstractInterface::Theme.new
    end
    
    
    # def build_layout layout = nil
    #   # Configuring
    #   current_theme.layout = layout
    # 
    #   #  Rendering
    #   current_theme.layout_definition['slots'].each do |slot_name, slots|
    #     slots = Array(slots)
    #     slots.each do |partial|
    #       content_for slot_name do
    #         render :partial => partial
    #       end
    #     end
    #   end
    # end  
      
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
crystal-ext-0.0.3 lib/abstract_interface/view_helper.rb
crystal-ext-0.0.2 lib/abstract_interface/view_helper.rb