Module: PhantomHelpers::ViewHelpers::HtmlHelper

Defined in:
lib/phantom_helpers/view_helpers/html_helper.rb

Instance Method Summary collapse

Instance Method Details



98
99
100
# File 'lib/phantom_helpers/view_helpers/html_helper.rb', line 98

def footer(&block)
  (:div, class: "row mt-l") { block.call }
end

#hrObject



11
12
13
14
15
16
17
# File 'lib/phantom_helpers/view_helpers/html_helper.rb', line 11

def hr
   :div, class: "row" do
     :div, class: "col-md-12" do
       :hr
    end
  end
end

#index_body(&block) ⇒ Object



82
83
84
85
86
87
88
# File 'lib/phantom_helpers/view_helpers/html_helper.rb', line 82

def index_body(&block)
   :div, class: "row" do
     :div, class: "col-md-12" do
      block.call
    end
  end
end

#index_header(&block) ⇒ Object



90
91
92
93
94
95
96
# File 'lib/phantom_helpers/view_helpers/html_helper.rb', line 90

def index_header(&block)
   :div, class: "row index-header" do
     :div, class: "col-md-12" do
      block.call
    end
  end
end

#panel_div(type: "default", color: "default", title: nil, footer: nil, &block) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/phantom_helpers/view_helpers/html_helper.rb', line 29

def panel_div(type: "default", color: "default", title: nil, footer: nil, &block)
   :div, class: "row" do
     :div, class: "col-md-12" do
       :div, class: "panel panel-#{color}" do

        case type
        when "default"
          [
            if title
               :div, class: "panel-heading" do
                 :h3, class: "panel-title" do
                  title
                end
              end
            end,
            (:div, class: "panel-body") do
              block.call
            end,
            if footer
               :div, class: "panel-footer" do
                footer
              end
            end
          ].join.html_safe

        when "custom"
          [
            if title
               :div, class: "panel-heading" do
                 :h3, class: "panel-title" do
                  title
                end
              end
            end,
            capture do
              block.call
            end,
            if footer
               :div, class: "panel-footer" do
                footer
              end
            end
          ].join.html_safe

        when "full_custom"
          block.call
        end

      end
    end
  end
end

#title(text) ⇒ Object



5
6
7
8
9
# File 'lib/phantom_helpers/view_helpers/html_helper.rb', line 5

def title(text)
  content_for(:title) do
    text
  end
end

#well_div(&block) ⇒ Object



19
20
21
22
23
24
25
26
27
# File 'lib/phantom_helpers/view_helpers/html_helper.rb', line 19

def well_div(&block)
   :div, class: "row" do
     :div, class: "col-md-12" do
       :div, class: "well" do
        block.call
      end
    end
  end
end