Module: Activist::BlockHelpers

Defined in:
lib/activist/block_helpers.rb

Instance Method Summary collapse

Instance Method Details

#notice_block(title, &block) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/activist/block_helpers.rb', line 4

def notice_block(title, &block)
  content = capture(&block)
  content_for(:sidebar) do
    (:div, :class => [:block, :notice]) do
      (:h4, title) + (:p, content)
    end
  end
end

#section_block(title, options = {}) {|builder| ... } ⇒ Object

:block_class : a class applied to the outermost div

Yields:

  • (builder)


14
15
16
17
18
19
20
21
22
23
24
# File 'lib/activist/block_helpers.rb', line 14

def section_block(title, options = {})
  builder = Builder.new(self)
  yield builder
  (:div, 
    (:div, 
      (:div, builder.control, :class => :control) + 
      (:h2, title, :class => :title) + 
      (:div, builder.content, :class => :inner), 
    :class => :content), 
  :class => [:block, options[:block_class]])
end


26
27
28
29
30
31
32
33
# File 'lib/activist/block_helpers.rb', line 26

def sidebar_block(title, &block)
  content = capture(&block)
  content_for(:sidebar) do
    (:div, :class => ['sidebar-block']) do
      (:h4, title) + (:p, content)
    end
  end
end