Sha256: 6c49d7cd0bcffc67d8a2d7f6753ad911b9274d93db5bb68d7ca3edf7f859e736

Contents?: true

Size: 756 Bytes

Versions: 25

Compression:

Stored size: 756 Bytes

Contents

# frozen_string_literal: true
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'
        add_breadcrumb I18n.t("hyrax.collection.edit_view"), collection_path(params["id"]), mark_active_action
      when 'show'
        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

25 entries across 25 versions & 1 rubygems

Version Path
hyrax-5.0.1 app/controllers/concerns/hyrax/breadcrumbs_for_collections.rb
hyrax-5.0.0 app/controllers/concerns/hyrax/breadcrumbs_for_collections.rb
hyrax-5.0.0.rc3 app/controllers/concerns/hyrax/breadcrumbs_for_collections.rb
hyrax-5.0.0.rc2 app/controllers/concerns/hyrax/breadcrumbs_for_collections.rb
hyrax-5.0.0.rc1 app/controllers/concerns/hyrax/breadcrumbs_for_collections.rb
hyrax-3.6.0 app/controllers/concerns/hyrax/breadcrumbs_for_collections.rb
hyrax-4.0.0 app/controllers/concerns/hyrax/breadcrumbs_for_collections.rb
hyrax-4.0.0.rc3 app/controllers/concerns/hyrax/breadcrumbs_for_collections.rb
hyrax-4.0.0.rc2 app/controllers/concerns/hyrax/breadcrumbs_for_collections.rb
hyrax-4.0.0.rc1 app/controllers/concerns/hyrax/breadcrumbs_for_collections.rb
hyrax-3.5.0 app/controllers/concerns/hyrax/breadcrumbs_for_collections.rb
hyrax-4.0.0.beta2 app/controllers/concerns/hyrax/breadcrumbs_for_collections.rb
hyrax-3.4.2 app/controllers/concerns/hyrax/breadcrumbs_for_collections.rb
hyrax-4.0.0.beta1 app/controllers/concerns/hyrax/breadcrumbs_for_collections.rb
hyrax-3.4.1 app/controllers/concerns/hyrax/breadcrumbs_for_collections.rb
hyrax-3.4.0 app/controllers/concerns/hyrax/breadcrumbs_for_collections.rb
hyrax-3.3.0 app/controllers/concerns/hyrax/breadcrumbs_for_collections.rb
hyrax-3.2.0 app/controllers/concerns/hyrax/breadcrumbs_for_collections.rb
hyrax-3.1.0 app/controllers/concerns/hyrax/breadcrumbs_for_collections.rb
hyrax-3.0.2 app/controllers/concerns/hyrax/breadcrumbs_for_collections.rb