Sha256: 8c1e30d16012b407dd933553b0795a2853f31f7d2dff2429c89bbb1015927bac

Contents?: true

Size: 936 Bytes

Versions: 33

Compression:

Stored size: 936 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.controls.home'), hyrax.root_path
      add_breadcrumb I18n.t('hyrax.dashboard.title'), hyrax.dashboard_path if user_signed_in?
    end

    def trail_from_referer
      case request.referer
      when /catalog/
        add_breadcrumb I18n.t('hyrax.controls.home'), hyrax.root_path
        add_breadcrumb I18n.t('hyrax.bread_crumb.search_results'), request.referer
      else
        default_trail
        add_breadcrumb_for_controller if user_signed_in?
        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

33 entries across 33 versions & 1 rubygems

Version Path
hyrax-2.9.6 app/controllers/concerns/hyrax/breadcrumbs.rb
hyrax-2.9.5 app/controllers/concerns/hyrax/breadcrumbs.rb
hyrax-2.9.4 app/controllers/concerns/hyrax/breadcrumbs.rb
hyrax-2.9.3 app/controllers/concerns/hyrax/breadcrumbs.rb
hyrax-2.9.2 app/controllers/concerns/hyrax/breadcrumbs.rb
hyrax-2.9.1 app/controllers/concerns/hyrax/breadcrumbs.rb
hyrax-2.9.0 app/controllers/concerns/hyrax/breadcrumbs.rb
hyrax-2.8.0 app/controllers/concerns/hyrax/breadcrumbs.rb
hyrax-2.7.2 app/controllers/concerns/hyrax/breadcrumbs.rb
hyrax-2.7.1 app/controllers/concerns/hyrax/breadcrumbs.rb
hyrax-2.7.0 app/controllers/concerns/hyrax/breadcrumbs.rb
hyrax-2.6.0 app/controllers/concerns/hyrax/breadcrumbs.rb
hyrax-2.5.1 app/controllers/concerns/hyrax/breadcrumbs.rb
hyrax-2.5.0 app/controllers/concerns/hyrax/breadcrumbs.rb
hyrax-3.0.0.pre.beta2 app/controllers/concerns/hyrax/breadcrumbs.rb
hyrax-2.4.1 app/controllers/concerns/hyrax/breadcrumbs.rb
hyrax-3.0.0.pre.beta1 app/controllers/concerns/hyrax/breadcrumbs.rb
hyrax-2.4.0 app/controllers/concerns/hyrax/breadcrumbs.rb
hyrax-2.3.3 app/controllers/concerns/hyrax/breadcrumbs.rb
hyrax-2.3.2 app/controllers/concerns/hyrax/breadcrumbs.rb