Class: CertWatch::Views::CertificateState

Inherits:
Arbre::Component
  • Object
show all
Defined in:
lib/cert_watch/views/certificate_state.rb

Constant Summary collapse

STATE_MAPPING =
{
  'installed' => 'ok',
  'installing' => 'warn',
  'renewing' => 'warn',
  'installing_failed' => 'error',
  'renewing_failed' => 'error'
}.freeze

Instance Method Summary collapse

Instance Method Details

#build(certificate_or_domain, options = {}) ⇒ Object


17
18
19
20
21
22
23
24
25
# File 'lib/cert_watch/views/certificate_state.rb', line 17

def build(certificate_or_domain, options = {})
  state = get_state(certificate_or_domain)
  format = options.fetch(:format, 'short')

  add_class 'cert_watch_certificate_state'

  status_tag(t(state, scope: "cert_watch.states.#{format}"),
             [state, STATE_MAPPING[state]].compact.join(' '))
end