Wrap the ID in <bdi> tags for RTL locales
authorTom Hughes <tom@compton.nu>
Sun, 18 May 2014 23:16:48 +0000 (00:16 +0100)
committerTom Hughes <tom@compton.nu>
Sun, 18 May 2014 23:29:08 +0000 (00:29 +0100)
app/helpers/browse_helper.rb
test/helpers/browse_helper_test.rb

index 7562535..2b9cb6f 100644 (file)
@@ -14,9 +14,9 @@ module BrowseHelper
     # away redacted version tag information.
     unless object.redacted?
       if object.tags.include? "name:#{I18n.locale}"
     # away redacted version tag information.
     unless object.redacted?
       if object.tags.include? "name:#{I18n.locale}"
-        name = t 'printable_name.with_name_html', :name => content_tag(:bdi, object.tags["name:#{I18n.locale}"].to_s ), :id => name
+        name = t 'printable_name.with_name_html', :name => content_tag(:bdi, object.tags["name:#{I18n.locale}"].to_s ), :id => content_tag(:bdi, name)
       elsif object.tags.include? 'name'
       elsif object.tags.include? 'name'
-        name = t 'printable_name.with_name_html', :name => content_tag(:bdi, object.tags['name'].to_s ), :id => name
+        name = t 'printable_name.with_name_html', :name => content_tag(:bdi, object.tags['name'].to_s ), :id => content_tag(:bdi, name)
       end
     end
 
       end
     end
 
index 0abcd6d..38d8c2d 100644 (file)
@@ -14,28 +14,28 @@ class BrowseHelperTest < ActionView::TestCase
 
   def test_printable_name
     assert_equal "17", printable_name(current_nodes(:redacted_node))
 
   def test_printable_name
     assert_equal "17", printable_name(current_nodes(:redacted_node))
-    assert_equal "<bdi>Test Node</bdi> (18)", printable_name(current_nodes(:node_with_name))
-    assert_equal "<bdi>Test Node</bdi> (18)", printable_name(nodes(:node_with_name_current_version))
+    assert_equal "<bdi>Test Node</bdi> (<bdi>18</bdi>)", printable_name(current_nodes(:node_with_name))
+    assert_equal "<bdi>Test Node</bdi> (<bdi>18</bdi>)", printable_name(nodes(:node_with_name_current_version))
     assert_equal "18", printable_name(nodes(:node_with_name_redacted_version))
     assert_equal "18", printable_name(nodes(:node_with_name_redacted_version))
-    assert_equal "<bdi>Test Node</bdi> (18, v2)", printable_name(nodes(:node_with_name_current_version), true)
+    assert_equal "<bdi>Test Node</bdi> (<bdi>18, v2</bdi>)", printable_name(nodes(:node_with_name_current_version), true)
     assert_equal "18, v1", printable_name(nodes(:node_with_name_redacted_version), true)
 
     I18n.locale = "ru"
 
     assert_equal "17", printable_name(current_nodes(:redacted_node))
     assert_equal "18, v1", printable_name(nodes(:node_with_name_redacted_version), true)
 
     I18n.locale = "ru"
 
     assert_equal "17", printable_name(current_nodes(:redacted_node))
-    assert_equal "<bdi>проверки узла</bdi> (18)", printable_name(current_nodes(:node_with_name))
-    assert_equal "<bdi>проверки узла</bdi> (18)", printable_name(nodes(:node_with_name_current_version))
+    assert_equal "<bdi>проверки узла</bdi> (<bdi>18</bdi>)", printable_name(current_nodes(:node_with_name))
+    assert_equal "<bdi>проверки узла</bdi> (<bdi>18</bdi>)", printable_name(nodes(:node_with_name_current_version))
     assert_equal "18", printable_name(nodes(:node_with_name_redacted_version))
     assert_equal "18", printable_name(nodes(:node_with_name_redacted_version))
-    assert_equal "<bdi>проверки узла</bdi> (18, v2)", printable_name(nodes(:node_with_name_current_version), true)
+    assert_equal "<bdi>проверки узла</bdi> (<bdi>18, v2</bdi>)", printable_name(nodes(:node_with_name_current_version), true)
     assert_equal "18, v1", printable_name(nodes(:node_with_name_redacted_version), true)
 
     I18n.locale = "de"
 
     assert_equal "17", printable_name(current_nodes(:redacted_node))
     assert_equal "18, v1", printable_name(nodes(:node_with_name_redacted_version), true)
 
     I18n.locale = "de"
 
     assert_equal "17", printable_name(current_nodes(:redacted_node))
-    assert_equal "<bdi>Test Node</bdi> (18)", printable_name(current_nodes(:node_with_name))
-    assert_equal "<bdi>Test Node</bdi> (18)", printable_name(nodes(:node_with_name_current_version))
+    assert_equal "<bdi>Test Node</bdi> (<bdi>18</bdi>)", printable_name(current_nodes(:node_with_name))
+    assert_equal "<bdi>Test Node</bdi> (<bdi>18</bdi>)", printable_name(nodes(:node_with_name_current_version))
     assert_equal "18", printable_name(nodes(:node_with_name_redacted_version))
     assert_equal "18", printable_name(nodes(:node_with_name_redacted_version))
-    assert_equal "<bdi>Test Node</bdi> (18, v2)", printable_name(nodes(:node_with_name_current_version), true)
+    assert_equal "<bdi>Test Node</bdi> (<bdi>18, v2</bdi>)", printable_name(nodes(:node_with_name_current_version), true)
     assert_equal "18, v1", printable_name(nodes(:node_with_name_redacted_version), true)
   end
 
     assert_equal "18, v1", printable_name(nodes(:node_with_name_redacted_version), true)
   end