Class: Katello::ContentViewHistory
- Includes:
- Authorization::ContentViewHistory
- Defined in:
- app/models/katello/content_view_history.rb
Constant Summary collapse
- IN_PROGRESS =
'in progress'.freeze
- FAILED =
'failed'.freeze
- SUCCESSFUL =
'successful'.freeze
- STATUSES =
[IN_PROGRESS, FAILED, SUCCESSFUL].freeze
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Model
Class Method Details
.in_organization(organization) ⇒ Object
43 44 45 46 47 48 49 |
# File 'app/models/katello/content_view_history.rb', line 43 def self.in_organization(organization) content_views = ContentView.where(:organization_id => organization.id) self.joins(:content_view_version => :content_view). where("#{ContentView.table_name}.id" => content_views). order("#{self.table_name}.updated_at DESC") end |
.in_organizations(organizations) ⇒ Object
51 52 53 54 55 56 57 |
# File 'app/models/katello/content_view_history.rb', line 51 def self.in_organizations(organizations) content_views = ContentView.where(:organization_id => organizations) self.joins(:content_view_version => :content_view). where("#{ContentView.table_name}.id" => content_views). order("#{self.table_name}.updated_at DESC") end |
Instance Method Details
#content_view ⇒ Object
39 40 41 |
# File 'app/models/katello/content_view_history.rb', line 39 def content_view self.content_view_version.try(:content_view) end |
#humanized_action ⇒ Object
59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'app/models/katello/content_view_history.rb', line 59 def humanized_action if export? _("Exported version") elsif publish? _("Published new version") elsif promotion? _("Promoted to %{environment}") % { :environment => self.environment.try(:name) || _('Unknown') } elsif removal? _("Deleted from %{environment}") % { :environment => self.environment.try(:name) || _('Unknown')} else _("Unknown Action") end end |
#humanized_status ⇒ Object
73 74 75 76 77 78 79 80 81 82 |
# File 'app/models/katello/content_view_history.rb', line 73 def humanized_status case self.status when ContentViewHistory::IN_PROGRESS _("In Progress") when ContentViewHistory::FAILED _("Failed") when ContentViewHistory::SUCCESSFUL _("Success") end end |