Module: Kayessess::StyleguideHelper

Defined in:
app/helpers/kayessess/styleguide_helper.rb

Overview

Helpers for building styleguides

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object



5
6
7
# File 'app/helpers/kayessess/styleguide_helper.rb', line 5

def method_missing(name, *args)
  main_app.sign_out_path(*args)
end

Instance Method Details



23
24
25
26
27
28
29
# File 'app/helpers/kayessess/styleguide_helper.rb', line 23

def reference_breadcrumb_links(node)
   :span, class: 'kayessess__breadcrumb' do
    node.parents.inject([]) {|crumbs, parent_node|
      crumbs << breadcrumb_crumb_for_node(parent_node)
    }.reverse.join('').html_safe
  end
end

#section_navigationObject



16
17
18
19
20
21
# File 'app/helpers/kayessess/styleguide_helper.rb', line 16

def section_navigation
  @styleguide.root_sections.inject([]){|nav, node|
    nav << link_to(node.name, section_path(node.to_path), class: 'kayessess__navigation__item')
    nav
  }.join('').html_safe
end

#styleguide_example_for(section, options = {}, &block) ⇒ Object



9
10
11
12
13
14
# File 'app/helpers/kayessess/styleguide_helper.rb', line 9

def styleguide_example_for(section, options = {}, &block)
  html = capture(&block)
  section_example = Kayessess::SectionExample.new(section, html, options)
  render(partial: 'kayessess/common/section_example', locals: {
    section_example: section_example})
end