Sha256: d24efe77766afa0b63545a0c51852e3cee34b072500bd6f9e552b994f53de048

Contents?: true

Size: 971 Bytes

Versions: 1

Compression:

Stored size: 971 Bytes

Contents

module AppFrame
  module BootstrapHelper
    def alert(message, type = nil)
      message = close_button + message
      content_tag(:div, message, :class => "alert alert-#{alert_type_map(type)}")
    end
    
    def close_button
      content_tag(:a, "×".html_safe, :class => 'close', :data => { :dismiss => "alert" })
    end
    
    def alert_type_map(type)
      map = {
        :alert => 'error',
        :notice => 'success'
      }
      
      map[type.to_sym] || type
    end
    
    def icon(key, options = {})
      css_class = "icon-#{key}"
      css_class += " icon-white" if options[:invert]
      content_tag(:i, '', :class => css_class).html_safe
    end
    
    def page_header(title, &block)
      content = "".html_safe
      content += content_tag(:div, capture(&block), :class => 'page-actions') if block_given?
      content += content_tag(:h1, title)
      
      content_tag(:div, content, :class => 'page-header')
    end
    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
app_frame-0.5.5 app/helpers/app_frame/bootstrap_helper.rb