Module: ContentBlock::BlockHelper

Defined in:
app/helpers/content_block/block_helper.rb

Instance Method Summary collapse

Instance Method Details

#rich_block(find_by) ⇒ Object



3
4
5
6
# File 'app/helpers/content_block/block_helper.rb', line 3

def rich_block(find_by)
  block = ContentBlock::RichBlock.where('id = ? OR name = ?', find_by, find_by).first
  block.try(:content).try(:html_safe)
end

#rich_block_with_title(find_by, wrapper) ⇒ Object



8
9
10
11
12
13
# File 'app/helpers/content_block/block_helper.rb', line 8

def rich_block_with_title(find_by, wrapper)
  block         = ContentBlock::RichBlock.where('id = ? OR name = ?', find_by, find_by).first
  return nil unless block.present?
  wrapped_title = "<#{wrapper}>#{block.title}</#{wrapper}>"
  "#{wrapped_title}#{block.content}".html_safe
end