From 607d23f6d63415b9eb653eb6a7eb2b1aa45300e9 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Fri, 30 Sep 2011 14:30:59 +0100 Subject: [PATCH] Fixup some string escaping issues in the data browser --- app/helpers/browse_helper.rb | 7 ++++++- app/views/browse/_changeset_details.html.erb | 6 +++--- app/views/browse/_containing_relation.html.erb | 4 ++-- app/views/browse/_node_details.html.erb | 2 +- app/views/browse/_relation_member.html.erb | 4 ++-- app/views/browse/_way_details.html.erb | 2 +- app/views/browse/node.html.erb | 6 +++--- app/views/browse/relation.html.erb | 4 ++-- 8 files changed, 20 insertions(+), 15 deletions(-) diff --git a/app/helpers/browse_helper.rb b/app/helpers/browse_helper.rb index a41b39a3d..ebcd58dd0 100644 --- a/app/helpers/browse_helper.rb +++ b/app/helpers/browse_helper.rb @@ -4,7 +4,12 @@ module BrowseHelper end def printable_name(object, version=false) - name = t 'printable_name.with_id', :id => object.id.to_s + if object.id.is_a?(Array) + id = object.id[0] + else + id = object.id + end + name = t 'printable_name.with_id', :id => id.to_s if version name = t 'printable_name.with_version', :id => name, :version => object.version.to_s end diff --git a/app/views/browse/_changeset_details.html.erb b/app/views/browse/_changeset_details.html.erb index 9fb9cb860..16f236ba7 100644 --- a/app/views/browse/_changeset_details.html.erb +++ b/app/views/browse/_changeset_details.html.erb @@ -53,7 +53,7 @@ <% @nodes.each do |node| %> - + <% end %>
<%= link_to h(printable_name(node, true)), { :action => "node", :id => node.id.to_s }, :class => link_class('node', node), :title => link_title(node) %>
<%= link_to h(printable_name(node, true)), { :action => "node", :id => node.node_id.to_s }, :class => link_class('node', node), :title => link_title(node) %>
@@ -67,7 +67,7 @@ <% @ways.each do |way| %> - + <% end %> <%= #render :partial => "containing_relation", :collection => changeset_details.containing_relation_members @@ -84,7 +84,7 @@ diff --git a/app/views/browse/_containing_relation.html.erb b/app/views/browse/_containing_relation.html.erb index 474e80f78..6cc0cce6e 100644 --- a/app/views/browse/_containing_relation.html.erb +++ b/app/views/browse/_containing_relation.html.erb @@ -3,9 +3,9 @@ linked_name = link_to h(printable_name(containing_relation.relation)), :action => "relation", :id => containing_relation.relation.id.to_s if containing_relation.member_role.blank? - t 'browse.containing_relation.entry', :relation_name => linked_name + raw t 'browse.containing_relation.entry', :relation_name => linked_name else - t 'browse.containing_relation.entry_role', :relation_name => linked_name, :relation_role => h(containing_relation.member_role) + raw t 'browse.containing_relation.entry_role', :relation_name => linked_name, :relation_role => h(containing_relation.member_role) end %> diff --git a/app/views/browse/_node_details.html.erb b/app/views/browse/_node_details.html.erb index 148a71dea..50188c934 100644 --- a/app/views/browse/_node_details.html.erb +++ b/app/views/browse/_node_details.html.erb @@ -4,7 +4,7 @@ - + <% unless node_details.ways.empty? and node_details.containing_relation_members.empty? %> diff --git a/app/views/browse/_relation_member.html.erb b/app/views/browse/_relation_member.html.erb index b797081da..71d283971 100644 --- a/app/views/browse/_relation_member.html.erb +++ b/app/views/browse/_relation_member.html.erb @@ -6,9 +6,9 @@ diff --git a/app/views/browse/_way_details.html.erb b/app/views/browse/_way_details.html.erb index ce5c86dda..8354ceaec 100644 --- a/app/views/browse/_way_details.html.erb +++ b/app/views/browse/_way_details.html.erb @@ -12,7 +12,7 @@ <%= link_to h(printable_name(wn.node)), { :action => "node", :id => wn.node_id.to_s }, :class => link_class('node', wn.node), :title => link_title(wn.node) %> <% related_ways = wn.node.ways.reject { |w| w.id == way_details.id } %> <% if related_ways.size > 0 then %> - (<%= t 'browse.way_details.also_part_of', :count => related_ways.size, :related_ways => related_ways.map { |w| link_to(h(printable_name(w)), { :action => "way", :id => w.id.to_s }, :class => link_class('way', w), :title => link_title(w) ) }.to_sentence %>) + (<%= raw t 'browse.way_details.also_part_of', :count => related_ways.size, :related_ways => related_ways.map { |w| link_to(h(printable_name(w)), { :action => "way", :id => w.id.to_s }, :class => link_class('way', w), :title => link_title(w) ) }.to_sentence %>) <% end %> <% end %> diff --git a/app/views/browse/node.html.erb b/app/views/browse/node.html.erb index e9a5482be..49d535b31 100644 --- a/app/views/browse/node.html.erb +++ b/app/views/browse/node.html.erb @@ -10,7 +10,7 @@ <%= render :partial => "map", :object => @node %> <%= render :partial => "node_details", :object => @node %>
-<%= t'browse.node.download', :download_xml_link => link_to(t('browse.node.download_xml'), :controller => "old_node", :action => "version", :version => @node.version), - :view_history_link => link_to(t('browse.node.view_history'), :action => "node_history"), - :edit_link => link_to(t('browse.node.edit'), :controller => "site", :action => "edit", :lat => @node.lat, :lon => @node.lon, :zoom => 18, :node => @node.id) +<%= raw t'browse.node.download', :download_xml_link => link_to(t('browse.node.download_xml'), :controller => "old_node", :action => "version", :version => @node.version), + :view_history_link => link_to(t('browse.node.view_history'), :action => "node_history"), + :edit_link => link_to(t('browse.node.edit'), :controller => "site", :action => "edit", :lat => @node.lat, :lon => @node.lon, :zoom => 18, :node => @node.id) %> diff --git a/app/views/browse/relation.html.erb b/app/views/browse/relation.html.erb index b8d0bc3b5..5b222396d 100644 --- a/app/views/browse/relation.html.erb +++ b/app/views/browse/relation.html.erb @@ -10,5 +10,5 @@ <%= render :partial => "map", :object => @relation %> <%= render :partial => "relation_details", :object => @relation %>
-<%= t'browse.relation.download', :download_xml_link => link_to(t('browse.relation.download_xml'), :controller => "relation", :action => "read"), - :view_history_link => link_to(t('browse.relation.view_history'), :action => "relation_history") %> +<%= raw t'browse.relation.download', :download_xml_link => link_to(t('browse.relation.download_xml'), :controller => "relation", :action => "read"), + :view_history_link => link_to(t('browse.relation.view_history'), :action => "relation_history") %> -- 2.39.5
<%= link_to h(printable_name(way, true)), { :action => "way", :id => way.id.to_s }, :class => link_class('way', way), :title => link_title(way) %>
<%= link_to h(printable_name(way, true)), { :action => "way", :id => way.way_id.to_s }, :class => link_class('way', way), :title => link_title(way) %>
<% @relations.each do |relation| %> - + <% end %>
<%= link_to h(printable_name(relation, true)), { :action => "relation", :id => relation.id.to_s }, :class => link_class('relation', relation), :title => link_title(relation) %>
<%= link_to h(printable_name(relation, true)), { :action => "relation", :id => relation.relation_id.to_s }, :class => link_class('relation', relation), :title => link_title(relation) %>
<%= t 'browse.node_details.coordinates' %>
<%= link_to ("#{number_with_delimiter(node_details.lat)}, #{number_with_delimiter(node_details.lon)}"), {:controller => 'site', :action => 'index', :lat => h(node_details.lat), :lon => h(node_details.lon), :zoom => "18"} %>
<%= link_to(content_tag(:span, number_with_delimiter(node_details.lat), :class => "latitude") + ", " + content_tag(:span, number_with_delimiter(node_details.lon), :class => "longitude"), {:controller => 'site', :action => 'index', :lat => h(node_details.lat), :lon => h(node_details.lon), :zoom => "18"}) %>
<%= if relation_member.member_role.blank? - t'browse.relation_member.entry', :type => type_str, :name => linked_name + raw t'browse.relation_member.entry', :type => type_str, :name => linked_name else - t'browse.relation_member.entry_role', :type => type_str, :name => linked_name, :role => h(relation_member.member_role) + raw t'browse.relation_member.entry_role', :type => type_str, :name => linked_name, :role => h(relation_member.member_role) end %>