Class: LayoutStrategy::HotGlue
- Inherits:
-
Base
- Object
- Base
- LayoutStrategy::HotGlue
show all
- Defined in:
- lib/generators/hot_glue/layout_strategy/hot_glue.rb
Instance Attribute Summary
Attributes inherited from Base
#builder
Instance Method Summary
collapse
Methods inherited from Base
#button_applied_classes, #button_classes, #column_classes_for_button_column, #each_col, #form_checkbox_input_class, #form_checkbox_label_class, #form_checkbox_wrapper_class, #form_input_class, #initialize, #magic_button_classes, #search_closing, #search_opening
Instance Method Details
2
3
4
|
# File 'lib/generators/hot_glue/layout_strategy/hot_glue.rb', line 2
def button_column_style
'style="flex-basis: 150px'
end
|
6
7
8
|
# File 'lib/generators/hot_glue/layout_strategy/hot_glue.rb', line 6
def button_style
'style="flex-basis: ' + (100 - (column_width * builder.columns.count)).floor.to_s + '%;"'
end
|
#col_width ⇒ Object
57
58
59
60
61
62
63
64
65
66
67
68
69
|
# File 'lib/generators/hot_glue/layout_strategy/hot_glue.rb', line 57
def col_width
downnest_size = case (builder.downnest_children.count)
when 0
downnest_size = 0
when 1
downnest_size = 40
else
downnest_size = 60
end
100 - downnest_size - 5
end
|
#column_classes_for_column_headings(size = nil) ⇒ Object
53
54
55
|
# File 'lib/generators/hot_glue/layout_strategy/hot_glue.rb', line 53
def column_classes_for_column_headings(size = nil)
"scaffold-cell"
end
|
42
43
44
|
# File 'lib/generators/hot_glue/layout_strategy/hot_glue.rb', line 42
def column_classes_for_form_fields(size = nil)
"scaffold-cell"
end
|
#column_classes_for_line_fields(size = nil) ⇒ Object
49
50
51
|
# File 'lib/generators/hot_glue/layout_strategy/hot_glue.rb', line 49
def column_classes_for_line_fields(size = nil)
"scaffold-cell"
end
|
#column_headings_col_style ⇒ Object
14
15
16
|
# File 'lib/generators/hot_glue/layout_strategy/hot_glue.rb', line 14
def column_headings_col_style
" style='flex-basis: #{column_width}%'"
end
|
#column_width ⇒ Object
10
11
12
|
# File 'lib/generators/hot_glue/layout_strategy/hot_glue.rb', line 10
def column_width
each_col * builder.columns.count
end
|
#container_name ⇒ Object
18
19
20
|
# File 'lib/generators/hot_glue/layout_strategy/hot_glue.rb', line 18
def container_name
"scaffold-container"
end
|
#downnest_column_style ⇒ Object
22
23
24
|
# File 'lib/generators/hot_glue/layout_strategy/hot_glue.rb', line 22
def downnest_column_style
'style="flex-basis: ' + each_downnest_width.to_s + '%;'
end
|
#downnest_style ⇒ Object
26
27
28
|
# File 'lib/generators/hot_glue/layout_strategy/hot_glue.rb', line 26
def downnest_style
'style="flex-basis: ' + each_downnest_width.to_s + '%"'
end
|
#each_downnest_width ⇒ Object
30
31
32
|
# File 'lib/generators/hot_glue/layout_strategy/hot_glue.rb', line 30
def each_downnest_width
builder.downnest_children.count == 1 ? 33 : (53/builder.downnest_children.count).floor
end
|
#list_classes ⇒ Object
34
35
36
|
# File 'lib/generators/hot_glue/layout_strategy/hot_glue.rb', line 34
def list_classes
"scaffold-list"
end
|
#page_begin ⇒ Object
71
72
73
|
# File 'lib/generators/hot_glue/layout_strategy/hot_glue.rb', line 71
def page_begin
'<div class=" scaffold-index-<%= plural %>">'
end
|
#page_end ⇒ Object
75
76
77
|
# File 'lib/generators/hot_glue/layout_strategy/hot_glue.rb', line 75
def page_end
'</div>'
end
|
#row_classes ⇒ Object
38
39
40
|
# File 'lib/generators/hot_glue/layout_strategy/hot_glue.rb', line 38
def row_classes
"scaffold-row"
end
|
#row_heading_classes ⇒ Object
46
47
48
|
# File 'lib/generators/hot_glue/layout_strategy/hot_glue.rb', line 46
def row_heading_classes
"scaffold-heading-row"
end
|
#style_with_flex_basis(perc_width) ⇒ Object
79
80
81
|
# File 'lib/generators/hot_glue/layout_strategy/hot_glue.rb', line 79
def style_with_flex_basis(perc_width)
" style='flex-basis: #{perc_width}%'"
end
|