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

[View source]

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

#center(&block) ⇒ Object

[View source]

77
78
79
80
81
82
83
# File 'lib/blot/helpers/grid.rb', line 77

def center(&block)
   :td, class: 'center', align: 'center' do
     :center do
      yield if block_given?
    end
  end
end

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

[View source]

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

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?
         :td, options do
          optional_content(options) { yield if block_given? }
        end
      else
        nil
      end

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

#container(options = {}) ⇒ Object

[View source]

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

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

#panel_sub_gridObject

[View source]

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

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

#rowObject

[View source]

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

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

[View source]

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

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

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

[View source]

68
69
70
71
72
73
74
75
# File 'lib/blot/helpers/grid.rb', line 68

def wrapper(options={}, &block)
  unless options.delete(:wrapper).is_a?(FalseClass) || options[:class] && options[:class].split(' ').include?('wrapper')
    options[:class] = "wrapper #{options[:class]}".squish
  end
   :td, options do
    optional_content(options) { yield if block_given? }
  end
end