Module: GakuHelpers::ViewHelpers::TableHelper

Defined in:
lib/gaku_helpers/view_helpers/table_helper.rb

Instance Method Summary collapse

Instance Method Details

#show_table(&block) ⇒ Object



27
28
29
30
31
# File 'lib/gaku_helpers/view_helpers/table_helper.rb', line 27

def show_table(&block)
   :table, class: "table table-hover table-condensed"  do
    block.call
  end
end

#show_table_for(id, &block) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/gaku_helpers/view_helpers/table_helper.rb', line 19

def show_table_for(id, &block)
   :div, class: "row-fluid" do
     :table, class: "table table-hover  table-condensed", id: id do
      block.call
    end
  end
end

#sortable_table_for(id, &block) ⇒ Object



33
34
35
36
37
# File 'lib/gaku_helpers/view_helpers/table_helper.rb', line 33

def sortable_table_for(id, &block)
   :table, class: "table table-striped table-bordered table-condensed tablesorter", id: id do
    block.call
  end
end

#table(&block) ⇒ Object



13
14
15
16
17
# File 'lib/gaku_helpers/view_helpers/table_helper.rb', line 13

def table(&block)
   :table, class: "table table-striped table-bordered table-condensed" do
    block.call
  end
end

#table_for(id, &block) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/gaku_helpers/view_helpers/table_helper.rb', line 5

def table_for(id, &block)
   :div, class: "row-fluid" do
     :table, class: "table table-striped table-bordered table-condensed", id: id do
      block.call
    end
  end
end

#th(text) ⇒ Object



39
40
41
# File 'lib/gaku_helpers/view_helpers/table_helper.rb', line 39

def th(text)
  (:th, class: "btn-inverse") { text }
end

#th_actions(num) ⇒ Object



49
50
51
52
53
54
55
56
57
58
59
# File 'lib/gaku_helpers/view_helpers/table_helper.rb', line 49

def th_actions(num)
  size = case num
  when 1 then 40
  when 2 then 62
  when 3 then 99
  else num
  end
   :th, class: "btn-inverse", style:"width:#{size}px" do
     :i, nil,  class: "icon-edit icon-white"
  end
end

#th_icon(icon) ⇒ Object



43
44
45
46
47
# File 'lib/gaku_helpers/view_helpers/table_helper.rb', line 43

def th_icon(icon)
   :th, class: "btn-inverse", style: "width:24px;" do
     :i, nil,  class: "icon-#{icon} icon-white"
  end
end