]> git.openstreetmap.org Git - rails.git/commitdiff
Fixup some string escaping issues in the data browser
authorTom Hughes <tom@compton.nu>
Fri, 30 Sep 2011 13:30:59 +0000 (14:30 +0100)
committerTom Hughes <tom@compton.nu>
Mon, 14 Nov 2011 09:42:55 +0000 (09:42 +0000)
app/helpers/browse_helper.rb
app/views/browse/_changeset_details.html.erb
app/views/browse/_containing_relation.html.erb
app/views/browse/_node_details.html.erb
app/views/browse/_relation_member.html.erb
app/views/browse/_way_details.html.erb
app/views/browse/node.html.erb
app/views/browse/relation.html.erb

index a41b39a3deac07a9c7165648b1946a885b1bae18..ebcd58dd042b7671ed5f8e9dfd462189899deb07 100644 (file)
@@ -4,7 +4,12 @@ module BrowseHelper
   end
 
   def printable_name(object, version=false)
   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
     if version
       name = t 'printable_name.with_version', :id => name, :version => object.version.to_s
     end
index 9fb9cb860b1f0bc0e3e5a3ebda62c97884b85aa6..16f236ba740b5d906382e85fb509d934a6daefae 100644 (file)
@@ -53,7 +53,7 @@
       <td>
         <table cellpadding="0">
           <% @nodes.each do |node| %>
       <td>
         <table cellpadding="0">
           <% @nodes.each do |node| %>
-            <tr><td><%= link_to h(printable_name(node, true)), { :action => "node", :id => node.id.to_s }, :class => link_class('node', node), :title => link_title(node) %></td></tr>
+            <tr><td><%= link_to h(printable_name(node, true)), { :action => "node", :id => node.node_id.to_s }, :class => link_class('node', node), :title => link_title(node) %></td></tr>
           <% end %>
         </table>
       </td>
           <% end %>
         </table>
       </td>
@@ -67,7 +67,7 @@
       <td>
         <table cellpadding="0">
           <% @ways.each do |way| %>
       <td>
         <table cellpadding="0">
           <% @ways.each do |way| %>
-          <tr><td><%= link_to h(printable_name(way, true)), { :action => "way", :id => way.id.to_s }, :class => link_class('way', way), :title => link_title(way) %></td></tr>
+          <tr><td><%= link_to h(printable_name(way, true)), { :action => "way", :id => way.way_id.to_s }, :class => link_class('way', way), :title => link_title(way) %></td></tr>
           <% end %>
           <%=
           #render :partial => "containing_relation", :collection => changeset_details.containing_relation_members 
           <% end %>
           <%=
           #render :partial => "containing_relation", :collection => changeset_details.containing_relation_members 
@@ -84,7 +84,7 @@
       <td>
         <table cellpadding="0">
           <% @relations.each do |relation| %>
       <td>
         <table cellpadding="0">
           <% @relations.each do |relation| %>
-          <tr><td><%= link_to h(printable_name(relation, true)), { :action => "relation", :id => relation.id.to_s }, :class => link_class('relation', relation), :title => link_title(relation) %></td></tr>
+          <tr><td><%= link_to h(printable_name(relation, true)), { :action => "relation", :id => relation.relation_id.to_s }, :class => link_class('relation', relation), :title => link_title(relation) %></td></tr>
           <% end %>
         </table>
       </td>
           <% end %>
         </table>
       </td>
index 474e80f788f316800f54b7b6c67ce9ee3b96a3d6..6cc0cce6e04c00c5f21dd3d3ac6e0475823f1dbc 100644 (file)
@@ -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?
     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
     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
   %></td>
 </tr>
     end
   %></td>
 </tr>
index 148a71dea9ae1f3aa48da2d36b338756cd650bdb..50188c934c4b4d0bba2a60b76824cf94589369f9 100644 (file)
@@ -4,7 +4,7 @@
 
   <tr>
     <th><%= t 'browse.node_details.coordinates' %></th>
 
   <tr>
     <th><%= t 'browse.node_details.coordinates' %></th>
-    <td><div class="geo"><%= link_to ("<span class='latitude'>#{number_with_delimiter(node_details.lat)}</span>, <span class='longitude'>#{number_with_delimiter(node_details.lon)}</span>"), {:controller => 'site', :action => 'index', :lat => h(node_details.lat), :lon => h(node_details.lon), :zoom => "18"} %></div></td>
+    <td><div class="geo"><%= 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"}) %></div></td>
   </tr>
 
   <% unless node_details.ways.empty? and node_details.containing_relation_members.empty? %>
   </tr>
 
   <% unless node_details.ways.empty? and node_details.containing_relation_members.empty? %>
index b797081da679d71e7f49233e7df91c4f9f9d69b3..71d28397170560976a05abfc75f55169ec10bf8e 100644 (file)
@@ -6,9 +6,9 @@
 <tr>
   <td class="<%= member_class %>"><%=
     if relation_member.member_role.blank?
 <tr>
   <td class="<%= member_class %>"><%=
     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
     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
   %></td>
 </tr> 
     end
   %></td>
 </tr> 
index ce5c86dda601fdfec9a8058df1ba53b25a5672b2..8354ceaec2973a23d0eeddf1c6f57c7e570665db 100644 (file)
@@ -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 %>
               <%= 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 %>
             </td></tr>
           <% end %>
               <% end %>
             </td></tr>
           <% end %>
index e9a5482bebbf31bfd898979dd1f171009de72beb..49d535b314b5ed8489b087dbb24d51b50274ae85 100644 (file)
@@ -10,7 +10,7 @@
 <%= render :partial => "map", :object => @node %>
 <%= render :partial => "node_details", :object => @node %>
 <hr />
 <%= render :partial => "map", :object => @node %>
 <%= render :partial => "node_details", :object => @node %>
 <hr />
-<%= 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)
 %>
 %>
index b8d0bc3b527ae9af04619265115e984051b2d4f3..5b222396db1eff45c6d7ea2f76f7f0d9b7339a47 100644 (file)
@@ -10,5 +10,5 @@
 <%= render :partial => "map", :object => @relation %>
 <%= render :partial => "relation_details", :object => @relation %>
 <hr />
 <%= render :partial => "map", :object => @relation %>
 <%= render :partial => "relation_details", :object => @relation %>
 <hr />
-<%= 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") %>