Sha256: a99b6f3a8b28da57126b234ab017a344c383b71c399bef1a56e90c74e4e28ba1

Contents?: true

Size: 952 Bytes

Versions: 3

Compression:

Stored size: 952 Bytes

Contents

module HomePage
  module LayoutHelper
    def breadcrumbs
      result = render_navigation context: :main, renderer: :breadcrumbs_without_method_links, join_with: ' > '
      result = result && result.scan('<a').length > 1 ? result : ''
      
      if respond_to?(:resource) && resource.respond_to?(:ancestors)
        breadcrumbs_with_ancestors(result)
      else
        result
      end
    end
    
    def breadcrumbs_with_ancestors(links)
      links = links.split(' &gt; ')
      current_resource_link = links.pop
      links += resource.ancestors.map {|ancestor| link_to ancestor.name, ancestor }
      links << current_resource_link
      raw links.join(' &gt; ')    
    end
    
    def sidenav(links_count = 2)
      links_count ||= 2
      result = render_navigation context: :main, renderer: :twitter_sidenav, level: @twitter_sidenav_level
      
      result && result.scan('<a').length >= links_count ? result : ''
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
home_page-0.0.6 app/helpers/home_page/layout_helper.rb
home_page-0.0.5 app/helpers/home_page/layout_helper.rb
home_page-0.0.4 app/helpers/home_page/layout_helper.rb