Sha256: d919503e639b7f4044e1f326572ba53c1286f481c0cb9c1ef507f4805716b32c

Contents?: true

Size: 1006 Bytes

Versions: 3

Compression:

Stored size: 1006 Bytes

Contents

module Sufia
  module CollectionsControllerBehavior
    extend ActiveSupport::Concern
    include Sufia::Breadcrumbs

    included do
      before_action :has_access?, except: :show
      before_action :build_breadcrumbs, only: [:edit, :show]
      layout "sufia-one-column"
      # include the link_to_remove_from_collection view helper methods
      helper CurationConcerns::CollectionsHelper
      self.presenter_class = Sufia::CollectionPresenter
      self.form_class = Sufia::Forms::CollectionForm
    end

    protected

      def add_breadcrumb_for_controller
        add_breadcrumb I18n.t('sufia.dashboard.my.collections'), sufia.dashboard_collections_path
      end

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sufia-7.0.0.beta3 app/controllers/concerns/sufia/collections_controller_behavior.rb
sufia-7.0.0.beta2 app/controllers/concerns/sufia/collections_controller_behavior.rb
sufia-7.0.0.beta1 app/controllers/concerns/sufia/collections_controller_behavior.rb