Sha256: c25cc5c68fb8e3e5d062f6acb194efa0e65ce128d11be0c54d9ac8bee8825959

Contents?: true

Size: 799 Bytes

Versions: 34

Compression:

Stored size: 799 Bytes

Contents

module Katello
  class ProductContentPresenter < SimpleDelegator
    attr_accessor :product_content, :overrides

    def initialize(product_content, overrides)
      @product_content = product_content
      @overrides = overrides
      super(@product_content)
    end

    def override
      return 'default' if overrides.blank?
      override = overrides.find { |pc| pc.content_label == content.label && pc.name == "enabled" }
      override.nil? ? 'default' : override.value
    end

    def enabled_content_override
      return nil if overrides.blank?
      overrides.find { |pc| pc.content_label == content.label && pc.name == "enabled" }
    end

    def content_overrides
      return [] if overrides.blank?
      overrides.select { |pc| pc.content_label == content.label }
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
katello-4.4.2.2 app/presenters/katello/product_content_presenter.rb
katello-4.4.2.1 app/presenters/katello/product_content_presenter.rb
katello-4.4.2 app/presenters/katello/product_content_presenter.rb
katello-4.4.1 app/presenters/katello/product_content_presenter.rb
katello-4.4.0.2 app/presenters/katello/product_content_presenter.rb
katello-4.4.0.1 app/presenters/katello/product_content_presenter.rb
katello-4.3.1 app/presenters/katello/product_content_presenter.rb
katello-4.4.0 app/presenters/katello/product_content_presenter.rb
katello-4.4.0.rc2 app/presenters/katello/product_content_presenter.rb
katello-4.4.0.rc1 app/presenters/katello/product_content_presenter.rb
katello-4.2.2 app/presenters/katello/product_content_presenter.rb
katello-4.3.0 app/presenters/katello/product_content_presenter.rb
katello-4.3.0.rc4 app/presenters/katello/product_content_presenter.rb
katello-4.3.0.rc3 app/presenters/katello/product_content_presenter.rb
katello-4.3.0.rc2.1 app/presenters/katello/product_content_presenter.rb
katello-4.3.0.rc2 app/presenters/katello/product_content_presenter.rb
katello-4.3.0.rc1 app/presenters/katello/product_content_presenter.rb
katello-4.2.1 app/presenters/katello/product_content_presenter.rb
katello-4.2.0.1 app/presenters/katello/product_content_presenter.rb
katello-4.1.4 app/presenters/katello/product_content_presenter.rb