Module: Exo::BlockHelper

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

Instance Method Summary collapse

Instance Method Details

#exo_block_tag(id, options = nil, &default_content) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/helpers/exo/block_helper.rb', line 2

def exo_block_tag id, options=nil, &default_content
  options ||= {}
  options['contenteditable'] = "true" if params[:preview]
  options[:id] = id
  options[:class] = "#{options[:class]} _block"
  block = tick.route.block id

  if block
     'div', options do
      raw block.content
    end
  elsif default_content
     'div', options, &default_content
  else
     'div', options do
      "Lorem ipsum"
    end
  end
end