]> git.openstreetmap.org Git - rails.git/blobdiff - app/helpers/application_helper.rb
Ensure that urls are only valid if the entire string is a url
[rails.git] / app / helpers / application_helper.rb
index c78c3ea46423227e62db5a69b01633c714f0cb68..79c6e6134a007843d0ca5e2b04d1138855dc47f6 100644 (file)
@@ -5,7 +5,7 @@ module ApplicationHelper
     if text.html_safe?
       Rinku.auto_link(text, :urls, tag_builder.tag_options(:rel => "nofollow")).html_safe
     else
-      Rinku.auto_link(text, :urls, tag_builder.tag_options(:rel => "nofollow"))
+      Rinku.auto_link(ERB::Util.h(text), :urls, tag_builder.tag_options(:rel => "nofollow")).html_safe
     end
   end
 
@@ -49,6 +49,10 @@ module ApplicationHelper
     content_tag(:span, time_ago_in_words(date), :title => l(date, :format => :friendly))
   end
 
+  def friendly_date_ago(date)
+    content_tag(:span, time_ago_in_words(date, :scope => :'datetime.distance_in_words_ago'), :title => l(date, :format => :friendly))
+  end
+
   def body_class
     if content_for? :body_class
       content_for :body_class