Sha256: 1fdf4ecf0be3af2057dd8b8a7f6d1a217230493a48fdfbd293c26089f6ddfce9

Contents?: true

Size: 636 Bytes

Versions: 5

Compression:

Stored size: 636 Bytes

Contents

# frozen_string_literal: true
module Hyrax
  class ContextualPath
    include Rails.application.routes.url_helpers
    include ActionDispatch::Routing::PolymorphicRoutes
    attr_reader :presenter, :parent_presenter
    def initialize(presenter, parent_presenter)
      @presenter = presenter
      @parent_presenter = parent_presenter
    end

    def show
      if parent_presenter
        polymorphic_path([:hyrax, :parent, presenter.model_name.singular],
                         parent_id: parent_presenter.id,
                         id: presenter.id)
      else
        polymorphic_path([presenter])
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
hyrax-3.0.1 app/services/hyrax/contextual_path.rb
hyrax-3.0.0 app/services/hyrax/contextual_path.rb
hyrax-3.0.0.pre.rc4 app/services/hyrax/contextual_path.rb
hyrax-3.0.0.pre.rc3 app/services/hyrax/contextual_path.rb
hyrax-3.0.0.pre.rc2 app/services/hyrax/contextual_path.rb