Module: Hyrax::Breadcrumbs

Extended by:
ActiveSupport::Concern
Included in:
BatchEditsController, BreadcrumbsForCollections, BreadcrumbsForWorks, CitationsController, DashboardController, FileSetsController, StatsController
Defined in:
app/controllers/concerns/hyrax/breadcrumbs.rb

Instance Method Summary collapse

Instance Method Details

#add_breadcrumb_for_actionObject

Override these in your controller


34
# File 'app/controllers/concerns/hyrax/breadcrumbs.rb', line 34

def add_breadcrumb_for_action; end

#add_breadcrumb_for_controllerObject

Override these in your controller


31
# File 'app/controllers/concerns/hyrax/breadcrumbs.rb', line 31

def add_breadcrumb_for_controller; end

#build_breadcrumbsObject


5
6
7
8
9
10
11
# File 'app/controllers/concerns/hyrax/breadcrumbs.rb', line 5

def build_breadcrumbs
  if request.referer
    trail_from_referer
  else
    default_trail
  end
end

#default_trailObject


13
14
15
16
# File 'app/controllers/concerns/hyrax/breadcrumbs.rb', line 13

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

#trail_from_refererObject


18
19
20
21
22
23
24
25
26
27
28
# File 'app/controllers/concerns/hyrax/breadcrumbs.rb', line 18

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