Sha256: c6bb481e97275d680f09b63c307cab87c4e54daad95a596cde950137c552a87d

Contents?: true

Size: 873 Bytes

Versions: 111

Compression:

Stored size: 873 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
      override = overrides.find { |pc| pc.content_label == content.label && pc.name == "enabled" }
      override.nil? ? 'default' : override.value
    end

    def enabled_content_override
      overrides.find { |pc| pc.content_label == content.label && pc.name == "enabled" }
    end

    def content_overrides
      overrides.select { |pc| pc.content_label == content.label }
    end

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

Version data entries

111 entries across 111 versions & 1 rubygems

Version Path
katello-4.0.3 app/presenters/katello/product_content_presenter.rb
katello-3.18.5 app/presenters/katello/product_content_presenter.rb
katello-4.0.2.1 app/presenters/katello/product_content_presenter.rb
katello-4.0.2 app/presenters/katello/product_content_presenter.rb
katello-3.18.4 app/presenters/katello/product_content_presenter.rb
katello-4.0.1.2 app/presenters/katello/product_content_presenter.rb
katello-3.18.3.1 app/presenters/katello/product_content_presenter.rb
katello-4.0.1.1 app/presenters/katello/product_content_presenter.rb
katello-3.18.3 app/presenters/katello/product_content_presenter.rb
katello-4.0.1 app/presenters/katello/product_content_presenter.rb
katello-4.0.0 app/presenters/katello/product_content_presenter.rb
katello-4.0.0.rc3.1 app/presenters/katello/product_content_presenter.rb
katello-4.0.0.rc3 app/presenters/katello/product_content_presenter.rb
katello-3.18.2.1 app/presenters/katello/product_content_presenter.rb
katello-3.18.2 app/presenters/katello/product_content_presenter.rb
katello-3.17.3 app/presenters/katello/product_content_presenter.rb
katello-4.0.0.rc2 app/presenters/katello/product_content_presenter.rb
katello-3.18.1.1 app/presenters/katello/product_content_presenter.rb
katello-3.17.2 app/presenters/katello/product_content_presenter.rb
katello-4.0.0.rc1 app/presenters/katello/product_content_presenter.rb