Module: PgqWeb::PgqHelper

Defined in:
app/helpers/pgq_web/pgq_helper.rb

Instance Method Summary collapse

Instance Method Details

#class_menu(act) ⇒ Object



3
4
5
# File 'app/helpers/pgq_web/pgq_helper.rb', line 3

def class_menu(act)
  act == params[:action] ? 'active' : ''
end

#human_time(str_time) ⇒ Object



18
19
20
# File 'app/helpers/pgq_web/pgq_helper.rb', line 18

def human_time(str_time)
  Time.parse(str_time).strftime("%d.%m.%Y %H:%M:%S") rescue '-'
end

#status_span(status = :ok) ⇒ Object



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

def status_span(status = :ok)
  case status
  when :ok then (:span, 'ok', :class => "label label-success")
  when :warn then (:span, 'warn', :class => "label label-warning")
  when :error then (:span, 'error', :class => "label label-important")
  when :stopped then (:span, 'stopped', :class => "label")
  else
    (:span, 'ok', :class => "label label-success")
  end
end