Module: Hyrax::Breadcrumbs

Instance Method Summary collapse

Instance Method Details

#add_breadcrumb_for_actionObject

Override these in your controller



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

def add_breadcrumb_for_action; end

#add_breadcrumb_for_controllerObject

Override these in your controller



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

def add_breadcrumb_for_controller; end

#build_breadcrumbsObject



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

def build_breadcrumbs
  if request.referer
    trail_from_referer
  else
    default_trail
    add_breadcrumb_for_controller if user_signed_in?
    add_breadcrumb_for_action
  end
end

#default_trailObject



16
17
18
19
# File 'app/controllers/concerns/hyrax/breadcrumbs.rb', line 16

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



21
22
23
24
25
26
27
28
29
30
31
# File 'app/controllers/concerns/hyrax/breadcrumbs.rb', line 21

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