Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
blocks / app / helpers / blocks / view_helper.rb
Size: Mime:
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