Sha256: 3865c77c1ce96005063274bfe5a1ad6d5f9502045c31cab684da7a3769cb3dad

Contents?: true

Size: 920 Bytes

Versions: 3

Compression:

Stored size: 920 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
    end
    
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
app_frame-0.5.8 app/helpers/app_frame/bootstrap_helper.rb
app_frame-0.5.7 app/helpers/app_frame/bootstrap_helper.rb
app_frame-0.5.6 app/helpers/app_frame/bootstrap_helper.rb