module TwBootStrapHelper::ViewHelper

Extende os Helpers da Aplicação

Public Instance Methods

bootstrap_label(title, type, options={}) click to toggle source
# File lib/tw_bootstrap_helper/view_helper.rb, line 95
def bootstrap_label title, type, options={}
  options[:class] = "" unless options.has_key?(:class) 
  options[:class].insert(0, " label " + type.to_s)
  raw content_tag :span, " #{title} ", options
end
grid_col(cols, center=true,&block) click to toggle source

Bootstrap Col Grid

# File lib/tw_bootstrap_helper/view_helper.rb, line 154
def grid_col(cols, center=true,&block)
  content = capture(&block)
  cl = "span#{cols}"    
  content_tag(:div, content, :class => cl)
end
grid_row(&block) click to toggle source

Bootstrap Row Grid

# File lib/tw_bootstrap_helper/view_helper.rb, line 147
def grid_row(&block)
  content = capture(&block)
  raw content_tag(:div, content, :class => "grid row") 
end
label_back(title="<< Voltar") click to toggle source
# File lib/tw_bootstrap_helper/view_helper.rb, line 139
def label_back title="<< Voltar"
      label_default title
end
label_default(title, options={}) click to toggle source
# File lib/tw_bootstrap_helper/view_helper.rb, line 101
def label_default title, options={}
      bootstrap_label title, :default, options={}
end
label_details(title="+ Detalhes") click to toggle source
# File lib/tw_bootstrap_helper/view_helper.rb, line 135
def label_details title="+ Detalhes"
      label_notice title
end
label_error(title="Erro") click to toggle source
# File lib/tw_bootstrap_helper/view_helper.rb, line 127
def label_error title="Erro"
      label_important title
end
label_important(title, options={}) click to toggle source
# File lib/tw_bootstrap_helper/view_helper.rb, line 113
def label_important title, options={}
      bootstrap_label title, :important, options={}
end
label_incomplete(title="Incompleto") click to toggle source
# File lib/tw_bootstrap_helper/view_helper.rb, line 131
def label_incomplete title="Incompleto"
      label_warning title
end
label_new(title="Novo") click to toggle source

Commom Alias from Labels

# File lib/tw_bootstrap_helper/view_helper.rb, line 123
def label_new title="Novo"
      label_success title
end
label_notice(title, options={}) click to toggle source
# File lib/tw_bootstrap_helper/view_helper.rb, line 117
def label_notice title, options={}
      bootstrap_label title, :notice, options={}
end
label_success(title, options={}) click to toggle source
# File lib/tw_bootstrap_helper/view_helper.rb, line 105
def label_success title, options={}
      bootstrap_label title, :success, options={}
end
label_warning(title, options={}) click to toggle source
# File lib/tw_bootstrap_helper/view_helper.rb, line 109
def label_warning title, options={}
      bootstrap_label title, :warning, options={}
end
lorem_ipsum() click to toggle source
# File lib/tw_bootstrap_helper/view_helper.rb, line 214
  def lorem_ipsum
    <<-eos 
      Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris fermentum tempor arcu in mollis. 
      Aliquam erat volutpat. Sed malesuada lacinia nibh, eget posuere turpis accumsan vitae. Aliquam lacus massa, pellentesque auctor volutpat eu, luctus ac enim.
      Nullam venenatis tellus nec tortor dictum rutrum. Proin sed magna eu mauris posuere vulputate vel quis nunc. Donec at elit sapien, vitae mattis arcu. Maecenas sollicitudin auctor volutpat. Vivamus tincidunt interdum placerat.
      In mattis, metus vel pellentesque accumsan, neque nisi ornare lectus, et interdum lectus ipsum sed augue. Nullam sollicitudin placerat enim a lobortis.
      Curabitur id lorem turpis, sit amet euismod elit.
    eos
  end
nav_icon(title, link) click to toggle source

Bootstrap Row Grid

pill(&block) click to toggle source

Show a Pill Toolbar

# File lib/tw_bootstrap_helper/view_helper.rb, line 83
def pill(&block)
  content = capture(&block)
  content_tag(:div, content_tag(:ul, content, :class => "pills"))
end
pill_item(&block) click to toggle source

Show a Pill Toolbar Item

# File lib/tw_bootstrap_helper/view_helper.rb, line 89
def pill_item(&block)
  content = capture(&block)
  content_tag(:li, content)
end
table(opts={}, &block) click to toggle source
HTML HELPERS ================
# File lib/tw_bootstrap_helper/view_helper.rb, line 169
def table(opts={}, &block)
  content = capture(&block)
  
  opts[:class] = "zebra-striped"
  
  content_tag(:table, content, opts)
end
table_body(&block) click to toggle source
# File lib/tw_bootstrap_helper/view_helper.rb, line 194
def table_body(&block)
  content = capture(&block)
  content_tag(:tbody, content)
end
table_head(&block) click to toggle source
# File lib/tw_bootstrap_helper/view_helper.rb, line 178
def table_head(&block)
  content = capture(&block)
  content_tag(:thead, content_tag(:tr, content))
end
table_td(value="", options={}) click to toggle source
# File lib/tw_bootstrap_helper/view_helper.rb, line 210
def table_td(value="", options={})
  content_tag(:td, value, options)
end
table_td_block(options={}, &block) click to toggle source
# File lib/tw_bootstrap_helper/view_helper.rb, line 205
def table_td_block(options={}, &block)
  content = capture(&block)
  content_tag(:td, content, options)
end
table_th(value="", options={}) click to toggle source
# File lib/tw_bootstrap_helper/view_helper.rb, line 189
def table_th(value="", options={})
  content_tag(:th, value)
end
table_th_block(options={}, &block) click to toggle source
# File lib/tw_bootstrap_helper/view_helper.rb, line 184
def table_th_block(options={}, &block)
  content = capture(&block)
  content_tag(:th, content)
end
table_tr(&block) click to toggle source
# File lib/tw_bootstrap_helper/view_helper.rb, line 200
def table_tr(&block)
  content = capture(&block)
  content_tag(:tr, content)
end