module PhantomHelpers::ViewHelpers::TableHelper

Public Instance Methods

show_table(&block) click to toggle source
# File lib/phantom_helpers/view_helpers/table_helper.rb, line 31
def show_table(&block)
  content_tag :table, class: "table table-hover table-condensed"  do
    block.call
  end
end
show_table_for(id, &block) click to toggle source
# File lib/phantom_helpers/view_helpers/table_helper.rb, line 21
def show_table_for(id, &block)
  content_tag :div, class: "row" do
    content_tag :div, class: "col-md-12" do
      content_tag :table, class: "table", id: id do
        block.call
      end
    end
  end
end
sortable_table_for(id, &block) click to toggle source
# File lib/phantom_helpers/view_helpers/table_helper.rb, line 37
def sortable_table_for(id, &block)
  content_tag :table, class: "table table-striped table-bordered table-condensed", id: id do
    block.call
  end
end
table(&block) click to toggle source
# File lib/phantom_helpers/view_helpers/table_helper.rb, line 15
def table(&block)
  content_tag :table, class: "table table-striped table-bordered table-condensed" do
    block.call
  end
end
table_for(id, &block) click to toggle source
# File lib/phantom_helpers/view_helpers/table_helper.rb, line 5
def table_for(id, &block)
  content_tag :div, class: "row" do
    content_tag :div, class: "col-md-12" do
      content_tag :table, class: "table table-striped table-bordered table-condensed", id: id do
        block.call
      end
    end
  end
end
th(text) click to toggle source
# File lib/phantom_helpers/view_helpers/table_helper.rb, line 43
def th(text)
  content_tag(:th, class: "btn-inverse") { text }
end
th_actions(num) click to toggle source
# File lib/phantom_helpers/view_helpers/table_helper.rb, line 53
def th_actions(num)
  size = case num
  when 1 then 35
  when 2 then 64
  when 3 then 93
  else num
  end
  content_tag :th, class: "btn-inverse", style:"width:#{size}px" do
    content_tag :span, nil,  class: "glyphicon glyphicon-edit"
  end
end
th_icon(icon) click to toggle source
# File lib/phantom_helpers/view_helpers/table_helper.rb, line 47
def th_icon(icon)
  content_tag :th, class: "btn-inverse", style: "width:34px;" do
    content_tag :span, nil,  class: "glyphicon glyphicon-#{icon}"
  end
end
tr_for(resource, &block) click to toggle source
# File lib/phantom_helpers/view_helpers/table_helper.rb, line 65
def tr_for(resource, &block)
  content_tag :tr, id: "#{resource.class.to_s.demodulize.underscore.dasherize}-#{resource.id}" do
    block.call
  end
end