app/helpers/governor_helper.rb in governor-0.3.1 vs app/helpers/governor_helper.rb in governor-0.4.0
- old
+ new
@@ -1,8 +1,6 @@
module GovernorHelper
- @@months = %w(January February March April May June July August September October November December)
-
Governor::PluginManager.plugins.map{|p| p.helpers }.flatten.each do |mod|
include mod.constantize # FIXME this feels pretty dirty, there has to be a better way
end
def render_plugin_partial(where, options = {})
@@ -12,17 +10,11 @@
output << render(opts)
end
return output.html_safe
end
- def get_date_label
- if not params[:day].nil?
- "#{@@months[params[:month].to_i - 1]} #{params[:day]}, #{params[:year]}"
- elsif not params[:month].nil?
- "#{@@months[params[:month].to_i - 1]} #{params[:year]}"
- else
- params[:year]
- end
+ def get_date_label(year, month=nil, day=nil)
+ l Date.new(*[year, month, day].compact), :format => "#{'%B ' if month}#{'%d, ' if day}%Y"
end
def show_time_ago(date)
%{<acronym title="#{date.strftime '%A, %B %d, %Y at %I:%M %p'}">#{distance_of_time_in_words_to_now date}</acronym> ago}.html_safe
end