Sha256: 8bded83d9a18939e4a7d2fdbc7498ec93820650d0550cf137255e4779b72cfd9

Contents?: true

Size: 1020 Bytes

Versions: 1

Compression:

Stored size: 1020 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, options = {}, &block)
      title += "<small> #{options[:small]}</small>" if options[:small]
      content = "".html_safe
      content += content_tag(:div, capture(&block), :class => 'page-actions') if block_given?
      content += content_tag(:h1, title.to_s.html_safe)
      content
    end
    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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