Sha256: 2ad788600434ec3b6aa3e92fe134745eaef13f6a6caf4b629f96728ab928edcf

Contents?: true

Size: 1.02 KB

Versions: 7

Compression:

Stored size: 1.02 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_DIR}/#{current_theme.name}/#{resource}"
    end
    
    def themed_partial partial
      themed_partial = "/#{THEMES_DIR}/#{current_theme.name}/#{partial}"
      if Crystal::Template.exist? themed_partial
        themed_partial
      else
        "/#{THEMES_DIR}/default/#{partial}"
      end
    end
    
    def current_theme
      controller.current_theme
    end

    # TODO1
    # 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

7 entries across 7 versions & 2 rubygems

Version Path
abstract_interface-0.1.7 lib/abstract_interface/view_helper.rb
abstract_interface-0.1.6 lib/abstract_interface/view_helper.rb
abstract_interface-0.1.5 lib/abstract_interface/view_helper.rb
abstract_interface-0.1.3 lib/abstract_interface/view_helper.rb
abstract_interface-0.1.1 lib/abstract_interface/view_helper.rb
abstract_interface-0.1.0 lib/abstract_interface/view_helper.rb
abstract-interface-0.0.3 lib/abstract_interface/view_helper.rb