Sha256: 2f31005e049df7821ba678d7ddc97e675ad8c5187f50ab745b46dc7fe02115d9

Contents?: true

Size: 1.34 KB

Versions: 3

Compression:

Stored size: 1.34 KB

Contents

module RobinsHtmlHelpers
  
  # TODO: Document the options argument
  def boxed_content(options = {},  &block)
    # Default class names
    options[:bottom_left_class] ||= 'box_bottom_left'
    options[:bottom_right_class] ||= 'box_bottom_right'
    options[:top_left_class] ||= 'box_top_left'
    options[:top_right_class] ||= 'box_top_right'
    
    if options[:inner_class]
      options[:inner_class] = options[:inner_class] + " " + options[:top_right_class]
    else 
      options[:inner_class] = options[:top_right_class]
    end 
    
    if options[:outer_class]
      options[:outer_class] = options[:outer_class] + " " + options[:bottom_left_class]
    else 
      options[:outer_class] = options[:bottom_left_class]
    end 
    
    concat(
      
      content_tag(:div, :style => "padding-top: 1px;") do # Extra div to fix margin problems in IE 6
      content_tag(:div, :class => options[:outer_class], :id => options[:outer_id] ) do   
        content_tag(:div, :class => options[:bottom_right_class]) do 
          content_tag(:div, :class => options[:top_left_class]) do
            content_tag(:div, :class => options[:inner_class], :id => options[:inner_id]) do
              capture(&block)
            end
          end
          
        end 
      end
      end
    )
  end
end


ActionView::Base.class_eval do
  include RobinsHtmlHelpers
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
robinsp-robins_html_helpers-0.1.0 lib/robins_html_helpers.rb
robinsp-robins_html_helpers-0.1.1 lib/robins_html_helpers.rb
robinsp-robinsp-robins_html_helpers-0.1.0 lib/robins_html_helpers.rb