Sha256: 54f469716f3cf6f9964fde6c91238019206e83aeadd0d7f09c45294b54a47d4a

Contents?: true

Size: 1.12 KB

Versions: 2

Compression:

Stored size: 1.12 KB

Contents

module StyleusRepresenterHelper
  def _option_bar(component, helper)
    _render_styleus('option_bar', locals: { component: component, helper: helper })
  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

2 entries across 2 versions & 1 rubygems

Version Path
styleus-0.0.12 app/helpers/styleus_representer_helper.rb
styleus-0.0.11 app/helpers/styleus_representer_helper.rb