Module: StyleusRepresenterHelper

Defined in:
app/helpers/styleus_representer_helper.rb

Instance Method Summary collapse

Instance Method Details

#_article(component, &block) ⇒ Object



10
11
12
# File 'app/helpers/styleus_representer_helper.rb', line 10

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

#_code(code, type) ⇒ Object



22
23
24
# File 'app/helpers/styleus_representer_helper.rb', line 22

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

#_code_note(note) ⇒ Object



18
19
20
# File 'app/helpers/styleus_representer_helper.rb', line 18

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

#_component(classes, partial_path, &block) ⇒ Object



14
15
16
# File 'app/helpers/styleus_representer_helper.rb', line 14

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

#_component_index(headline, components) ⇒ Object



6
7
8
# File 'app/helpers/styleus_representer_helper.rb', line 6

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

#_option_bar(component, helper) ⇒ Object



2
3
4
# File 'app/helpers/styleus_representer_helper.rb', line 2

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

#_render_styleus(styleus_partial, options = { }, &block) ⇒ Object



26
27
28
29
30
31
# File 'app/helpers/styleus_representer_helper.rb', line 26

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

#_safe_emptyObject



33
34
35
# File 'app/helpers/styleus_representer_helper.rb', line 33

def _safe_empty
  ''.html_safe
end