Module: Caffeinate::Webui::ApplicationHelper

Defined in:
app/helpers/caffeinate/webui/application_helper.rb

Instance Method Summary collapse

Instance Method Details



2
3
4
# File 'app/helpers/caffeinate/webui/application_helper.rb', line 2

def active_link_to(label, href, active: false)
  link_to(label, href, class: "nav-link #{'active' if active}")
end

#time(datetime) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'app/helpers/caffeinate/webui/application_helper.rb', line 6

def time(datetime)
  label = [time_ago_in_words(datetime)]
  if datetime.past?
    label << "ago"
  else
    label << "from now"
  end

  (:abbr, label.join(" "), title: datetime)
end