Module: Spyro::ActionViewExtension::HeadersHelper

Included in:
WidgetsHelper
Defined in:
lib/spyro/helpers/action_view_extension.rb

Instance Method Summary collapse

Instance Method Details

#box_header(name, &block) ⇒ Object



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/spyro/helpers/action_view_extension.rb', line 104

def box_header name, &block
  @has_group = false

  capture_haml do
    haml_tag :div, :class => ["panel-heading"] do
      haml_tag :div, :class => "row" do
        haml_tag :div, :class => "col-lg-12" do
          haml_tag :h2, :class => ["panel-title", 'col-sm-8'], :style => "padding: 8px 0px;" do
            haml_concat name
          end
          if block_given?
            haml_tag :div, :class => ['controls', 'col-sm-4', 'text-right'] do
              content = capture(&block)
              haml_concat (@has_group ? content : group { content })
            end
            haml_tag :div, :class => ['clear']
          end
        end
      end
    end
  end
end

#header(name = "", &block) ⇒ Object



75
76
77
78
79
80
81
# File 'lib/spyro/helpers/action_view_extension.rb', line 75

def header name = "", &block
  if @inside_box
    box_header name, &block
  else
    page_header name, &block
  end
end

#page_header(name, &block) ⇒ Object



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/spyro/helpers/action_view_extension.rb', line 83

def page_header name, &block
  @has_group = false

  content_for :title do
    name
  end

  capture_haml do
    haml_tag :h1, :class => ['page-header'] do
      haml_concat name
      if block_given?
        haml_tag :div, :class => ['pull-right'] do
          content = capture(&block)
          haml_concat (@has_group ? content : group { content })
        end
        haml_tag :div, :class => ['clear']
      end
    end
  end
end