Module: Blot::Helpers::Grid

Included in:
Blot::Helpers
Defined in:
lib/blot/helpers/grid.rb

Instance Method Summary collapse

Instance Method Details

#block_grid(options = {}) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/blot/helpers/grid.rb', line 4

def block_grid(options={})
  options[:class] = "block-grid #{options[:up]}-up #{options[:class]}".strip
   :table, class: options[:class] do
     :tr do
      yield if block_given?
    end
  end
end

#columns(width, options = {}) ⇒ Object Also known as: column



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/blot/helpers/grid.rb', line 39

def columns(width, options={})
   :table, class: "#{width} columns" do
     :tr do
      content = if options[:sub_columns]
        block_given? ? yield : nil
      elsif !options.empty? || block_given?
        wrapper(options) { yield if block_given? }
      else
        nil
      end

      [content, expander].join('').html_safe
    end
  end
end

#container(options = {}) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/blot/helpers/grid.rb', line 13

def container(options={})
   :table, class: 'container' do
     :tr do
      wrapper(options) { yield if block_given? }
    end
  end
end

#panel_sub_gridObject



29
30
31
32
33
34
35
36
37
# File 'lib/blot/helpers/grid.rb', line 29

def panel_sub_grid
   :td, class: 'panel sub-grid' do
     :table do
       :tr do
        yield if block_given?
      end
    end
  end
end

#rowObject



21
22
23
24
25
26
27
# File 'lib/blot/helpers/grid.rb', line 21

def row
   :table, class: 'row' do
     :tr do
      yield if block_given?
    end
  end
end

#sub_columns(width, options = {}) ⇒ Object Also known as: sub_column



56
57
58
59
# File 'lib/blot/helpers/grid.rb', line 56

def sub_columns(width, options={})
  options[:class] = "#{width} sub-columns #{options[:class]}".strip
  wrapper(options) { yield if block_given? }
end

#wrapper(options = {}, &block) ⇒ Object



62
63
64
65
66
# File 'lib/blot/helpers/grid.rb', line 62

def wrapper(options={}, &block)
   :td, options do
    optional_content(options) { yield if block_given? }
  end
end