Class: Actions::Katello::ContentView::Presenters::IncrementalUpdatesPresenter

Inherits:
Helpers::Presenter::Base show all
Defined in:
app/lib/actions/katello/content_view/presenters/incremental_updates_presenter.rb

Constant Summary collapse

HUMANIZED_TYPES =
{
  ::Katello::Erratum::CONTENT_TYPE => "Errata",
  ::Katello::Rpm::CONTENT_TYPE => "Packages",
  ::Katello::PuppetModule::CONTENT_TYPE => "Puppet Modules"
}

Instance Attribute Summary

Attributes inherited from Helpers::Presenter::Base

#action

Instance Method Summary collapse

Methods inherited from Helpers::Presenter::Base

#initialize

Constructor Details

This class inherits a constructor from Actions::Helpers::Presenter::Base

Instance Method Details

#humanized_contentObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'app/lib/actions/katello/content_view/presenters/incremental_updates_presenter.rb', line 20

def humanized_content
  humanized_lines = []

  action.output[:changed_content].each do |output|
    cvv = ::Katello::ContentViewVersion.find_by(:id => output[:content_view_version][:id])
    if cvv
      humanized_lines << "Content View: #{cvv.content_view.name} version #{cvv.version}"
      humanized_lines << _("Added Content:")
      [::Katello::Erratum, ::Katello::Rpm, ::Katello::PuppetModule].each do |content_type|
        unless output[:added_units][content_type::CONTENT_TYPE].blank?
          humanized_lines << "  #{HUMANIZED_TYPES[content_type::CONTENT_TYPE]}:"
          humanized_lines += output[:added_units][content_type::CONTENT_TYPE].sort.map { |unit| "        #{unit}" }
        end
      end
      humanized_lines << ''
    end
  end
  humanized_lines.join("\n")
end

#humanized_outputObject



12
13
14
15
16
17
18
# File 'app/lib/actions/katello/content_view/presenters/incremental_updates_presenter.rb', line 12

def humanized_output
  if action.output[:changed_content]
    humanized_content
  else
    _("Incremental Update incomplete.")
  end
end