Module: PuppetcaHelper

Defined in:
app/helpers/puppetca_helper.rb

Instance Method Summary collapse

Instance Method Details

#state_filterObject


2
3
4
5
# File 'app/helpers/puppetca_helper.rb', line 2

def state_filter
  select_tag "Filter", options_for_select(["", _("revoked"), _("pending"), _("valid")], params[:state]),
             :onchange => "window.location.href = '#{smart_proxy_puppetca_index_path(@proxy)}' + (this.value == '' ? '' : ('?state=' + this.value))"
end

#time_column(time, opts = {}) ⇒ Object


7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/helpers/puppetca_helper.rb', line 7

def time_column time, opts = {}
  return _("N/A") if time.blank?
  opts[:tense] ||= :past

  if opts[:tense] == :future
    _("in %s") % (time_ago_in_words time)
  elsif opts[:tense] == :past
    _("%s ago") % (time_ago_in_words time)
  else
    time_ago_in_words time
  end
end