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
- #format_date(d) ⇒ Object
- #format_month(d) ⇒ Object
- #format_year(d) ⇒ Object
-
#link_to_edit_logs(a, b = nil) ⇒ Object
(str, date) or (date).
- #link_to_show_logs(a, b = nil) ⇒ Object
- #link_to_show_month_stats(a, b = nil) ⇒ Object
- #link_to_show_year_stats(a, b = nil) ⇒ Object
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 |
#link_to_edit_logs(a, b = nil) ⇒ Object
(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 |
#link_to_show_logs(a, b = nil) ⇒ Object
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 |
#link_to_show_month_stats(a, b = nil) ⇒ Object
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 |
#link_to_show_year_stats(a, b = nil) ⇒ Object
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 |