Repository URL to install this package:
|
Version:
0.5.0 ▾
|
module Blocks
module ViewHelper
def render_blocks_for(parent, **options)
build_row_set(parent.blocks).rows.each do |row|
concat render_blocks_row(row, options)
end
nil
end
def render_blocks_row(row, **options)
row_options = { class: 'row' }.merge(options.delete(:row_options) || {})
content_tag :div, row_options do
render row.primary_blocks,
floated_blocks: render(row.secondary_blocks, options)
end
end
def build_row_set(blocks)
Blocks::Layout::RowSet.new(blocks).build
end
def css_classes_for_block(block)
[
"block",
"block-#{block.block_name.dasherize}",
"margin-#{block.margin}",
"arrangement-#{block.arrangement}",
"text-#{block.content_alignment}"
]
end
end
end