app/helpers/trestle/grid_helper.rb in trestle-0.8.13 vs app/helpers/trestle/grid_helper.rb in trestle-0.9.0
- old
+ new
@@ -2,11 +2,20 @@
module GridHelper
def row
content_tag(:div, class: "row") { yield }
end
- def col(columns)
- content_tag(:div, class: columns.map { |breakpoint, span| "col-#{breakpoint}-#{span}" }) { yield }
+ def col(columns=nil, breakpoints={})
+ if columns.is_a?(Hash)
+ breakpoints = columns
+ columns = breakpoints.delete("xs") || breakpoints.delete(:xs)
+ end
+
+ classes = []
+ classes << (columns ? "col-#{columns}" : "col")
+ classes += breakpoints.map { |breakpoint, span| "col-#{breakpoint}-#{span}" }
+
+ content_tag(:div, class: classes) { yield }
end
def divider
content_tag(:hr)
end