Module: Katello::ErrataMailerHelper

Defined in:
app/helpers/katello/errata_mailer_helper.rb

Instance Method Summary collapse

Instance Method Details

#content_host_errata_path(host) ⇒ Object



3
4
5
# File 'app/helpers/katello/errata_mailer_helper.rb', line 3

def content_host_errata_path(host)
  "#{Setting[:foreman_url]}/content_hosts/#{host.id}/errata"
end

#content_view_environment_errata_path(content_view, environment) ⇒ Object



7
8
9
10
# File 'app/helpers/katello/errata_mailer_helper.rb', line 7

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

#content_view_path(content_view) ⇒ Object



12
13
14
# File 'app/helpers/katello/errata_mailer_helper.rb', line 12

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

#errata_count(host, errata_type) ⇒ Object



26
27
28
29
30
# File 'app/helpers/katello/errata_mailer_helper.rb', line 26

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

#erratum_path(erratum) ⇒ Object



16
17
18
# File 'app/helpers/katello/errata_mailer_helper.rb', line 16

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

#format_summary(summary) ⇒ Object



32
33
34
# File 'app/helpers/katello/errata_mailer_helper.rb', line 32

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

#host_count(hosts, errata_type) ⇒ Object



36
37
38
# File 'app/helpers/katello/errata_mailer_helper.rb', line 36

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

#repository_erratum_path(repository, type = nil) ⇒ Object



20
21
22
23
24
# File 'app/helpers/katello/errata_mailer_helper.rb', line 20

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