Sha256: 709377dcb534e5a3f953bd113a778edee7872a06662655a1816a882bc9c1fb95

Contents?: true

Size: 785 Bytes

Versions: 10

Compression:

Stored size: 785 Bytes

Contents

module Hyrax
  module Breadcrumbs
    extend ActiveSupport::Concern

    def build_breadcrumbs
      if request.referer
        trail_from_referer
      else
        default_trail
      end
    end

    def default_trail
      add_breadcrumb I18n.t('hyrax.dashboard.title'), hyrax.dashboard_index_path if user_signed_in?
    end

    def trail_from_referer
      case request.referer
      when /catalog/
        add_breadcrumb I18n.t('hyrax.bread_crumb.search_results'), request.referer
      else
        default_trail
        add_breadcrumb_for_controller
        add_breadcrumb_for_action
      end
    end

    # Override these in your controller
    def add_breadcrumb_for_controller; end

    # Override these in your controller
    def add_breadcrumb_for_action; end
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
hyrax-1.1.1 app/controllers/concerns/hyrax/breadcrumbs.rb
hyrax-1.1.0 app/controllers/concerns/hyrax/breadcrumbs.rb
hyrax-1.0.5 app/controllers/concerns/hyrax/breadcrumbs.rb
hyrax-1.0.4 app/controllers/concerns/hyrax/breadcrumbs.rb
hyrax-1.0.3 app/controllers/concerns/hyrax/breadcrumbs.rb
hyrax-1.0.2 app/controllers/concerns/hyrax/breadcrumbs.rb
hyrax-1.0.1 app/controllers/concerns/hyrax/breadcrumbs.rb
hyrax-1.0.0.rc2 app/controllers/concerns/hyrax/breadcrumbs.rb
hyrax-1.0.0.rc1 app/controllers/concerns/hyrax/breadcrumbs.rb
test_hyrax-0.0.1.alpha app/controllers/concerns/hyrax/breadcrumbs.rb