Sha256: f51ac37d26a8a4424f87043929411e92fb641f5d8f91cb5d93f66a0166ebd215

Contents?: true

Size: 1.09 KB

Versions: 1

Compression:

Stored size: 1.09 KB

Contents

module StyleusRepresenterHelper
  def _option_bar(component)
    _render_styleus('option_bar', locals: { component: component })
  end

  def _component_index(headline, components)
    _render_styleus('component_index', locals: { headline: headline, components: components })
  end

  def _article(component, &block)
    _render_styleus('article', locals: { headline: component.headline, id: component.id, component: component }, &block)
  end

  def _component(classes, partial_path, &block)
    _render_styleus('component', locals: { classes: classes, partial_path: partial_path }, &block)
  end

  def _code_note(note)
    note ? _render_styleus('code_note', object: note) : _safe_empty
  end

  def _code(code, type)
    _render_styleus 'code', object: code, locals: { type: type }
  end

  def _render_styleus(styleus_partial, options = { }, &block)
    render_type    = block_given? ? 'layout' : 'partial'
    partial_path   = "styleus/#{styleus_partial}"
    render_options = { :"#{render_type}" => partial_path }.merge options
    render render_options, &block
  end

  def _safe_empty
    ''.html_safe
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
styleus-0.0.10 app/helpers/styleus_representer_helper.rb