Sha256: a5ce672e7687a7a71843a526feb335a0acaed84f08949b0925814b36a1a0b4d6

Contents?: true

Size: 742 Bytes

Versions: 29

Compression:

Stored size: 742 Bytes

Contents

module Hyrax
  module BreadcrumbsForCollections
    extend ActiveSupport::Concern
    include Hyrax::Breadcrumbs

    included do
      before_action :build_breadcrumbs, only: [:edit, :show]
    end

    def add_breadcrumb_for_controller
      add_breadcrumb I18n.t('hyrax.dashboard.my.collections'), hyrax.my_collections_path
    end

    def add_breadcrumb_for_action
      case action_name
      when 'edit'.freeze
        add_breadcrumb I18n.t("hyrax.collection.browse_view"), collection_path(params["id"]), mark_active_action
      when 'show'.freeze
        add_breadcrumb presenter.to_s, polymorphic_path(presenter), mark_active_action
      end
    end

    def mark_active_action
      { "aria-current" => "page" }
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

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