]> git.openstreetmap.org Git - rails.git/blobdiff - app/helpers/application_helper.rb
Merge branch 'master' into notes
[rails.git] / app / helpers / application_helper.rb
index 81ff1e95be940612ef5ac7412e69cfada31739bc..18f233e506092d05d9e89ac302b8376ff2d021cb 100644 (file)
@@ -9,14 +9,6 @@ module ApplicationHelper
     end
   end
 
-  def html_escape_unicode(text)
-    chars = ActiveSupport::Multibyte::Unicode.u_unpack(text).map do |c|
-      c < 127 ? c.chr : "&##{c.to_s};"
-    end
-
-    return chars.join("")
-  end
-
   def rss_link_to(*args)
     return link_to(image_tag("RSS.gif", :size => "16x16", :border => 0), Hash[*args], { :class => "rsssmall" });
   end
@@ -95,4 +87,24 @@ module ApplicationHelper
       end
     end
   end
+
+  def dir
+    if dir = params[:dir]
+      dir == "rtl" ? "rtl" : "ltr"
+    else
+      I18n.t("html.dir")
+    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
 end