5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/bs3_helpers/helpers/layout_helper.rb', line 5
def grid(opts={},&block)
@grids = %w{ col offset pull push }
@sizes = %w{ xs sm md lg xl }
index = 13
@sizes.each do |s|
index.times do |i|
instance_variable_set "@col_#{s}_#{i}", "#{@grids.fetch(0)}-#{s}-#{i}"
instance_variable_set "@col_#{s}_#{@grids.fetch(1)}_#{i}", "#{@grids.fetch(0)}-#{s}-#{@grids.fetch(1)}-#{i}"
instance_variable_set "@col_#{s}_#{@grids.fetch(2)}_#{i}", "#{@grids.fetch(0)}-#{s}-#{@grids.fetch(2)}-#{i}"
instance_variable_set "@col_#{s}_#{@grids.fetch(3)}_#{i}", "#{@grids.fetch(0)}-#{s}-#{@grids.fetch(3)}-#{i}"
end
end
@classes = []
if opts[:full]
@classes << instance_variable_get("@col_#{s}_#{i}") if opts[:size] == @sizes.fetch(i).to_sym
@classes << @col_sm_12
@classes << @col_md_12
@classes << @col_lg_12
@classes << @col_xl_12
content_tag :div,'',class: @classes.join(' '),&block
end
end
|