From d963aa30b7dc4b18fac35309e30a64c31e02d65d Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Mon, 14 Dec 2009 09:09:32 +0000 Subject: [PATCH] Add rel=nofollow to links in tags. Closes #2555. --- app/helpers/application_helper.rb | 6 +++++- app/views/browse/_common_details.html.erb | 2 +- app/views/browse/_tag.html.erb | 2 +- app/views/changeset/_changeset.html.erb | 26 +++++++++++------------ 4 files changed, 19 insertions(+), 17 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index e10650ada..d805e27ad 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,6 +1,10 @@ module ApplicationHelper def htmlize(text) - return auto_link(sanitize(simple_format(text)), :link => :urls, :html => { :rel => "nofollow" }) + return linkify(sanitize(simple_format(text))) + end + + def linkify(text) + return auto_link(text, :link => :urls, :html => { :rel => "nofollow" }) end def html_escape_unicode(text) diff --git a/app/views/browse/_common_details.html.erb b/app/views/browse/_common_details.html.erb index 0c486e0a7..b6960b9c4 100644 --- a/app/views/browse/_common_details.html.erb +++ b/app/views/browse/_common_details.html.erb @@ -23,7 +23,7 @@ <% if common_details.changeset.tags['comment'] %> <%= t 'browse.common_details.changeset_comment' %> - <%= auto_link(h(common_details.changeset.tags['comment'])) %> + <%= linkify(h(common_details.changeset.tags['comment'])) %> <% end %> diff --git a/app/views/browse/_tag.html.erb b/app/views/browse/_tag.html.erb index 5724b0646..ab5707f9e 100644 --- a/app/views/browse/_tag.html.erb +++ b/app/views/browse/_tag.html.erb @@ -1,3 +1,3 @@ - <%= h(tag[0]) %> = <%= auto_link(h(tag[1])) %> + <%= h(tag[0]) %> = <%= linkify(h(tag[1])) %> diff --git a/app/views/changeset/_changeset.html.erb b/app/views/changeset/_changeset.html.erb index 650030688..cbcfe7470 100644 --- a/app/views/changeset/_changeset.html.erb +++ b/app/views/changeset/_changeset.html.erb @@ -28,7 +28,7 @@ <% if changeset.tags['comment'] %> - <%= auto_link(h(changeset.tags['comment'])) %> + <%= linkify(h(changeset.tags['comment'])) %> <% else %> <%= t'changeset.changeset.no_comment' %> <% end %> @@ -37,20 +37,18 @@ <% if changeset.min_lat.nil? %> <%= t'changeset.changeset.no_edits' %> - <% else - minlon = changeset.min_lon/GeoRecord::SCALE.to_f - minlat = changeset.min_lat/GeoRecord::SCALE.to_f - maxlon = changeset.max_lon/GeoRecord::SCALE.to_f - maxlat = changeset.max_lat/GeoRecord::SCALE.to_f - %> + <% else %> + <% + minlon = changeset.min_lon/GeoRecord::SCALE.to_f + minlat = changeset.min_lat/GeoRecord::SCALE.to_f + maxlon = changeset.max_lon/GeoRecord::SCALE.to_f + maxlat = changeset.max_lat/GeoRecord::SCALE.to_f + %> '><%= format("%0.3f",minlon) -%>,<%= format("%0.3f",minlat) -%>,<%= format("%0.3f",maxlon) -%>,<%= format("%0.3f",maxlat) -%> - <% if changeset.area > 1500000000000 %> - <%= t'changeset.changeset.big_area' %> - <% - end - end - %> + <% if changeset.area > 1500000000000 %> + <%= t'changeset.changeset.big_area' %> + <% end %> + <% end %> - -- 2.43.2