Sha256: 8578e8ba9e9625e1cfd66982703dd2a0f5c48ddf500d84ccbc372a14256ad64b
Contents?: true
Size: 1.19 KB
Versions: 1
Compression:
Stored size: 1.19 KB
Contents
module Kayessess require 'pry' # Helpers for building styleguides module StyleguideHelper 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.id, 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
kayessess-0.1.2 | app/helpers/kayessess/styleguide_helper.rb |