app/helpers/application_helper.rb in moneyrail-0.1.4 vs app/helpers/application_helper.rb in moneyrail-0.1.5
- old
+ new
@@ -6,10 +6,14 @@
def format_month(d)
d.strftime("%Y-%m")
end
+ def format_year(d)
+ d.strftime("%Y")
+ end
+
# (str, date) or (date)
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)
@@ -19,13 +23,19 @@
str, date = str_and_date(a, b)
link_to str, show_logs_path(:year => date.year, :month => date.month)
end
- def link_to_show_stats(a, b=nil)
+ def link_to_show_month_stats(a, b=nil)
str, date = str_and_date(a, b)
- link_to str, show_stats_path(:year => date.year, :month => date.month)
+ link_to str, show_month_stats_path(:year => date.year, :month => date.month)
+ end
+
+ 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
private
def str_and_date(a, b)