]> git.openstreetmap.org Git - rails.git/commitdiff
Show ref of object when no name is present
authorSimon Legner <Simon.Legner@gmail.com>
Wed, 9 Mar 2016 18:46:03 +0000 (18:46 +0000)
committerTom Hughes <tom@compton.nu>
Wed, 9 Mar 2016 18:47:54 +0000 (18:47 +0000)
.rubocop_todo.yml
app/helpers/browse_helper.rb
test/fixtures/current_node_tags.yml
test/fixtures/current_nodes.yml
test/helpers/browse_helper_test.rb
test/models/node_tag_test.rb
test/models/node_test.rb

index b317054b6f6bbd7b77c8105a18da46467c41dd08..651691b848fff48c9a6792a96f3324cfb585f8f1 100644 (file)
@@ -85,7 +85,7 @@ Metrics/MethodLength:
 # Offense count: 1
 # Configuration parameters: CountComments.
 Metrics/ModuleLength:
-  Max: 129
+  Max: 131
 
 # Offense count: 4
 # Configuration parameters: CountKeywordArgs.
index 8f2ce5da7bad6d34f7abf692b50c21ba29ecad1b..494232744e3447feb079e31dd256db66fdf81413 100644 (file)
@@ -25,6 +25,8 @@ module BrowseHelper
         name = t "printable_name.with_name_html", :name => content_tag(:bdi, object.tags["name:#{locale}"].to_s), :id => content_tag(:bdi, name)
       elsif object.tags.include? "name"
         name = t "printable_name.with_name_html", :name => content_tag(:bdi, object.tags["name"].to_s), :id => content_tag(:bdi, name)
+      elsif object.tags.include? "ref"
+        name = t "printable_name.with_name_html", :name => content_tag(:bdi, object.tags["ref"].to_s), :id => content_tag(:bdi, name)
       end
     end
 
index 38b941e3c85dfece8bea5fd1a38dd3a3b4795c7a..d299998b5018ab295e08a084ccb5886a578c79f4 100644 (file)
@@ -57,3 +57,8 @@ nwn_shop:
   node_id: 18
   k: 'shop'
   v: 'gift'
+
+nwrwn_ref:
+  node_id: 19
+  k: 'ref'
+  v: '3.1415926'
index af6ea01d51384fa643b4fe2a3aa7d1eba5fc5c4a..8389f67bbd7275e92ea693992b9e0c25cf0a2b17 100644 (file)
@@ -180,3 +180,13 @@ node_with_name:
   version: 2
   tile: <%= QuadTile.tile_for_point(1,1) %>
   timestamp: 2007-01-01 00:00:00
+
+node_with_ref_without_name:
+  id: 19
+  latitude: <%= 1*SCALE %>
+  longitude: <%= 1*SCALE %>
+  changeset_id: 2
+  visible: true
+  version: 1
+  tile: <%= QuadTile.tile_for_point(1,1) %>
+  timestamp: 2007-01-01 00:00:00
index 7878d10e082eddef78f32f4a3990a77cfde61284..e34af093083005f6643f95808809c8a637793b4d 100644 (file)
@@ -23,6 +23,7 @@ class BrowseHelperTest < ActionView::TestCase
     assert_dom_equal "18", printable_name(nodes(:node_with_name_redacted_version))
     assert_dom_equal "<bdi>Test Node</bdi> (<bdi>18, v2</bdi>)", printable_name(nodes(:node_with_name_current_version), true)
     assert_dom_equal "18, v1", printable_name(nodes(:node_with_name_redacted_version), true)
+    assert_dom_equal "<bdi>3.1415926</bdi> (<bdi>19</bdi>)", printable_name(current_nodes(:node_with_ref_without_name))
 
     I18n.locale = "pt"
 
@@ -32,6 +33,7 @@ class BrowseHelperTest < ActionView::TestCase
     assert_dom_equal "18", printable_name(nodes(:node_with_name_redacted_version))
     assert_dom_equal "<bdi>Nó teste</bdi> (<bdi>18, v2</bdi>)", printable_name(nodes(:node_with_name_current_version), true)
     assert_dom_equal "18, v1", printable_name(nodes(:node_with_name_redacted_version), true)
+    assert_dom_equal "<bdi>3.1415926</bdi> (<bdi>19</bdi>)", printable_name(current_nodes(:node_with_ref_without_name))
 
     I18n.locale = "pt-BR"
 
@@ -41,6 +43,7 @@ class BrowseHelperTest < ActionView::TestCase
     assert_dom_equal "18", printable_name(nodes(:node_with_name_redacted_version))
     assert_dom_equal "<bdi>Nó teste</bdi> (<bdi>18, v2</bdi>)", printable_name(nodes(:node_with_name_current_version), true)
     assert_dom_equal "18, v1", printable_name(nodes(:node_with_name_redacted_version), true)
+    assert_dom_equal "<bdi>3.1415926</bdi> (<bdi>19</bdi>)", printable_name(current_nodes(:node_with_ref_without_name))
 
     I18n.locale = "de"
 
@@ -50,6 +53,7 @@ class BrowseHelperTest < ActionView::TestCase
     assert_dom_equal "18", printable_name(nodes(:node_with_name_redacted_version))
     assert_dom_equal "<bdi>Test Node</bdi> (<bdi>18, v2</bdi>)", printable_name(nodes(:node_with_name_current_version), true)
     assert_dom_equal "18, v1", printable_name(nodes(:node_with_name_redacted_version), true)
+    assert_dom_equal "<bdi>3.1415926</bdi> (<bdi>19</bdi>)", printable_name(current_nodes(:node_with_ref_without_name))
   end
 
   def test_link_class
index d9bce855215d9a57480454baef7f23dc7c88ecd3..0196b6fefb59af25955d0ca7bf5e99979e758aa8 100644 (file)
@@ -4,7 +4,7 @@ class NodeTagTest < ActiveSupport::TestCase
   api_fixtures
 
   def test_tag_count
-    assert_equal 12, NodeTag.count
+    assert_equal 13, NodeTag.count
     node_tag_count(:visible_node, 1)
     node_tag_count(:invisible_node, 1)
     node_tag_count(:used_node_1, 1)
index c9a8977968af6e5415910e01073069ebc229d1e0..ff833d0ed262ef56c8c3ec4b083fb3dd94f3a88c 100644 (file)
@@ -4,7 +4,7 @@ class NodeTest < ActiveSupport::TestCase
   api_fixtures
 
   def test_node_count
-    assert_equal 18, Node.count
+    assert_equal 19, Node.count
   end
 
   def test_node_too_far_north