Sha256: 8d882fcc7d8660e679307ddd4f94ce1c443f23c968b5c79464952f723f90126b

Contents?: true

Size: 1.44 KB

Versions: 9

Compression:

Stored size: 1.44 KB

Contents

module Katello
  module ErrataMailerHelper
    def content_host_errata_path(content_host)
      uuid = Katello::System.find(content_host).uuid
      "#{Setting[:foreman_url]}/content_hosts/#{uuid}/errata"
    end

    def content_view_environment_errata_path(content_view, environment)
      version = Katello::ContentViewEnvironment.find_by_content_view_id_and_environment_id(content_view.id, environment.id).content_view_version_id
      "#{Setting[:foreman_url]}/content_views/#{content_view.id}/versions/#{version}/errata"
    end

    def content_view_path(content_view)
      "#{Setting[:foreman_url]}/content_views/#{content_view.id}/versions"
    end

    def erratum_path(erratum)
      "#{Setting[:foreman_url]}/errata/#{erratum.uuid}/info"
    end

    def repository_erratum_path(repository, type = nil)
      url = "#{Setting[:foreman_url]}/errata?repositoryId=#{repository.id}"
      url += "&search=type%3D#{type}" if type
      url
    end

    def errata_count(host, errata_type)
      available = host.installable_errata.send(errata_type.to_sym).count
      applicable = host.applicable_errata.send(errata_type.to_sym).count - available
      "#{available} (#{applicable})"
    end

    def format_summary(summary)
      summary.blank? ? summary : summary.gsub(/\n\n/, '<p>').gsub(/\n/, ' ').html_safe
    end

    def host_count(hosts, errata_type)
      hosts.to_a.count { |host| host.installable_errata.send(errata_type.to_sym).any? }
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
katello-2.4.5 app/helpers/katello/errata_mailer_helper.rb
katello-2.4.4 app/helpers/katello/errata_mailer_helper.rb
katello-2.4.3 app/helpers/katello/errata_mailer_helper.rb
katello-2.4.2 app/helpers/katello/errata_mailer_helper.rb
katello-2.4.1 app/helpers/katello/errata_mailer_helper.rb
katello-2.4.0 app/helpers/katello/errata_mailer_helper.rb
katello-2.4.0.rc3 app/helpers/katello/errata_mailer_helper.rb
katello-2.4.0.rc2 app/helpers/katello/errata_mailer_helper.rb
katello-2.4.0.rc1 app/helpers/katello/errata_mailer_helper.rb