X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/c7ffb35e8b07255796e62e52a6a23950f88ae093..82eedbf6511faf136293fce5ffc394ee0bf3511a:/app/helpers/application_helper.rb diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 6e2ecd323..ec6c455b3 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -129,6 +129,26 @@ module ApplicationHelper end end + def friendly_date(date) + content_tag(:span, time_ago_in_words(date), :title => l(date, :format => :friendly)) + end + + def note_author(object, link_options = {}) + if object.author.nil? + h(object.author_name) + else + link_to h(object.author_name), link_options.merge({:controller => "user", :action => "view", :display_name => object.author_name}) + end + end + + def with_format(format, &block) + old_format = @template_format + @template_format = format + result = block.call + @template_format = old_format + return result + end + private def javascript_strings_for_key(key)