Sha256: 68718f79a6b68c3bf12bd1a1def67b435191175ccc64c3a706acac3402ec71bb
Contents?: true
Size: 1.25 KB
Versions: 13
Compression:
Stored size: 1.25 KB
Contents
module Kayessess # Helpers for building styleguides module StyleguideHelper def method_missing(name, *args) main_app.sign_out_path(*args) end 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 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 def reference_breadcrumb_links(node) content_tag :span, class: 'kayessess__breadcrumb' do node.parents.inject([]) {|crumbs, parent_node| crumbs << breadcrumb_crumb_for_node(parent_node) }.reverse.join('').html_safe end end private def breadcrumb_crumb_for_node(node) unless node.parent.nil? link_to("#{node.name}#{breadcrumb_divider}".html_safe, section_path(node.to_path)) else '' end end def breadcrumb_divider content_tag(:span, " > ", class: 'kayessess__breadcrumb__divider') end end end
Version data entries
13 entries across 13 versions & 1 rubygems