Sha256: 90ed96887832fd4e061efd85e000b7c90d5cad78307ab1286d1ebd151c946ac3

Contents?: true

Size: 598 Bytes

Versions: 10

Compression:

Stored size: 598 Bytes

Contents

module Tenon
  module BreadcrumbsHelper
    def breadcrumb_links
      links = []
      if controller_name != 'index'
        path = polymorphic_path(controller_name)
        links << make_link(controller_name.titleize, path)

        if %w( new edit ).include?(action_name)
          links << make_link(member_title, member_path)
        end
      end
      links
    end

    private

    def make_link(title, path)
      {
        title: title,
        path: path
      }
    end

    def member_path
      request.path
    end

    def member_title
      action_name.titleize
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
tenon-2.1.0 app/helpers/tenon/breadcrumbs_helper.rb
tenon-2.0.8 app/helpers/tenon/breadcrumbs_helper.rb
tenon-2.0.7 app/helpers/tenon/breadcrumbs_helper.rb
tenon-2.0.6 app/helpers/tenon/breadcrumbs_helper.rb
tenon-2.0.5 app/helpers/tenon/breadcrumbs_helper.rb
tenon-2.0.4 app/helpers/tenon/breadcrumbs_helper.rb
tenon-2.0.3 app/helpers/tenon/breadcrumbs_helper.rb
tenon-2.0.2 app/helpers/tenon/breadcrumbs_helper.rb
tenon-2.0.1 app/helpers/tenon/breadcrumbs_helper.rb
tenon-2.0.0 app/helpers/tenon/breadcrumbs_helper.rb