Module: ApplicationHelper

Defined in:
app/helpers/application_helper.rb

Overview

Methods added to this helper will be available to all templates in the application.

Instance Method Summary collapse

Instance Method Details

#format_date(d) ⇒ Object



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

def format_date(d)
  d.strftime("%Y-%m-%d (%a)")
end

#format_month(d) ⇒ Object



7
8
9
# File 'app/helpers/application_helper.rb', line 7

def format_month(d)
  d.strftime("%Y-%m")
end

#format_year(d) ⇒ Object



11
12
13
# File 'app/helpers/application_helper.rb', line 11

def format_year(d)
  d.strftime("%Y")
end

(str, date) or (date)



16
17
18
19
20
# File 'app/helpers/application_helper.rb', line 16

def link_to_edit_logs(a, b=nil)
  str, date = str_and_date(a, b)

  link_to str, edit_logs_path(:year => date.year, :month => date.month)
end


22
23
24
25
26
# File 'app/helpers/application_helper.rb', line 22

def link_to_show_logs(a, b=nil)
  str, date = str_and_date(a, b)

  link_to str, show_logs_path(:year => date.year, :month => date.month)
end


28
29
30
31
32
# File 'app/helpers/application_helper.rb', line 28

def link_to_show_month_stats(a, b=nil)
  str, date = str_and_date(a, b)

  link_to str, show_month_stats_path(:year => date.year, :month => date.month)
end


34
35
36
37
38
# File 'app/helpers/application_helper.rb', line 34

def link_to_show_year_stats(a, b=nil)
  str, date = b ? [a, b] : [format_year(a), a]

  link_to str, show_year_stats_path(:year => date.year)
end