Class: ContentRowDecorator
Instance Method Summary
collapse
collection_decorator_class
Instance Method Details
#classes ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'app/decorators/content_row_decorator.rb', line 10
def classes
list = []
list << 'no-gutters' if no_gutters?
if horizontal_alignment.to_s == 'center'
list << 'justify-content-center'
elsif horizontal_alignment.to_s == 'right'
list << 'justify-content-end'
end
if vertical_alignment.to_s == 'center'
list << 'align-items-center'
elsif vertical_alignment.to_s == 'bottom'
list << 'align-items-end'
end
list
end
|
#column_limit_reached? ⇒ Boolean
If the max. column count for the biggest screen medium is met, we can safely assume no more additional columns are needed.
6
7
8
|
# File 'app/decorators/content_row_decorator.rb', line 6
def column_limit_reached?
column_width_calculator.total(:width_xl) >= 12
end
|
#styles ⇒ Object
31
32
33
34
35
36
37
38
39
40
41
|
# File 'app/decorators/content_row_decorator.rb', line 31
def styles
list = {}
list['background-color'.to_sym] = background_color if background_color.present?
%w(margin_top margin_bottom padding_top padding_bottom).each do |s|
str = s.split('_')
list["#{str.first}-#{str.last}".to_sym] = "#{send(s)}rem" if send(s).present?
end
list
end
|