Sha256: a71155a06468d3bab60f49c40fd62df98139d12f58e637fc03194ba23d3898ba
Contents?: true
Size: 804 Bytes
Versions: 5
Compression:
Stored size: 804 Bytes
Contents
# frozen_string_literal: true module MicroCms module CmsBlockHelper def cms_block(path, default = nil, &block) content_block = content_block_for_path(path, default: capture_default(default, &block)) render partial: 'micro_cms/content_block', locals: { content_block: content_block } end def cms_content(path, default = nil, &block) content_block = content_block_for_path(path, default: capture_default(default, &block)) content_tag :div, content_block.content, nil, false end private def content_block_for_path(path, default:) MicroCms::ContentBlock.content_block_for_path path, content: default || '' end def capture_default(default) default = capture { yield } if block_given? && default.nil? default end end end
Version data entries
5 entries across 5 versions & 1 rubygems