Sha256: 540412dbca9b66189b86bd7e921f872e7567661e0ea7011f7ae37b3a29e39908

Contents?: true

Size: 791 Bytes

Versions: 16

Compression:

Stored size: 791 Bytes

Contents

module Sufia
  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('sufia.dashboard.title'), sufia.dashboard_index_path if user_signed_in?
    end

    def trail_from_referer
      case request.referer
      when /catalog/
        add_breadcrumb I18n.t('sufia.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

16 entries across 16 versions & 1 rubygems

Version Path
sufia-7.4.1 app/controllers/concerns/sufia/breadcrumbs.rb
sufia-7.4.0 app/controllers/concerns/sufia/breadcrumbs.rb
sufia-7.3.1 app/controllers/concerns/sufia/breadcrumbs.rb
sufia-7.3.0 app/controllers/concerns/sufia/breadcrumbs.rb
sufia-7.3.0.rc3 app/controllers/concerns/sufia/breadcrumbs.rb
sufia-7.3.0.rc2 app/controllers/concerns/sufia/breadcrumbs.rb
sufia-7.3.0.rc1 app/controllers/concerns/sufia/breadcrumbs.rb
sufia-7.2.0 app/controllers/concerns/sufia/breadcrumbs.rb
sufia-7.1.0 app/controllers/concerns/sufia/breadcrumbs.rb
sufia-7.0.0 app/controllers/concerns/sufia/breadcrumbs.rb
sufia-7.0.0.rc2 app/controllers/concerns/sufia/breadcrumbs.rb
sufia-7.0.0.rc1 app/controllers/concerns/sufia/breadcrumbs.rb
sufia-7.0.0.beta4 app/controllers/concerns/sufia/breadcrumbs.rb
sufia-7.0.0.beta3 app/controllers/concerns/sufia/breadcrumbs.rb
sufia-7.0.0.beta2 app/controllers/concerns/sufia/breadcrumbs.rb
sufia-7.0.0.beta1 app/controllers/concerns/sufia/breadcrumbs.rb