Sha256: a54b9280cbed578a4c86aa9e25573beb67b29b2de44ef357adce472a2090ccd6

Contents?: true

Size: 779 Bytes

Versions: 13

Compression:

Stored size: 779 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_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

13 entries across 13 versions & 1 rubygems

Version Path
hyrax-2.0.3 app/controllers/concerns/hyrax/breadcrumbs.rb
hyrax-2.0.2 app/controllers/concerns/hyrax/breadcrumbs.rb
hyrax-2.1.0.beta1 app/controllers/concerns/hyrax/breadcrumbs.rb
hyrax-2.0.1 app/controllers/concerns/hyrax/breadcrumbs.rb
hyrax-2.0.0 app/controllers/concerns/hyrax/breadcrumbs.rb
hyrax-2.0.0.rc3 app/controllers/concerns/hyrax/breadcrumbs.rb
hyrax-2.0.0.rc2 app/controllers/concerns/hyrax/breadcrumbs.rb
hyrax-2.0.0.rc1 app/controllers/concerns/hyrax/breadcrumbs.rb
hyrax-2.0.0.beta5 app/controllers/concerns/hyrax/breadcrumbs.rb
hyrax-2.0.0.beta4 app/controllers/concerns/hyrax/breadcrumbs.rb
hyrax-2.0.0.beta3 app/controllers/concerns/hyrax/breadcrumbs.rb
hyrax-2.0.0.beta2 app/controllers/concerns/hyrax/breadcrumbs.rb
hyrax-2.0.0.beta1 app/controllers/concerns/hyrax/breadcrumbs.rb