]> git.openstreetmap.org Git - rails.git/blobdiff - app/helpers/browse_helper.rb
Merge remote-tracking branch 'upstream/pull/4178'
[rails.git] / app / helpers / browse_helper.rb
index cf2bc64742dc6faebb72e511a7c9ebb958b537e2..0f533770b8042165245e0d036b066626c4b97a30 100644 (file)
@@ -1,5 +1,5 @@
 module BrowseHelper
 module BrowseHelper
-  def printable_name(object, version = false)
+  def printable_name(object, version: false)
     id = if object.id.is_a?(Array)
            object.id[0]
          else
     id = if object.id.is_a?(Array)
            object.id[0]
          else
@@ -13,7 +13,7 @@ module BrowseHelper
     unless object.redacted?
       available_locales = Locale.list(name_locales(object))
 
     unless object.redacted?
       available_locales = Locale.list(name_locales(object))
 
-      locale = available_locales.preferred(preferred_languages)
+      locale = available_locales.preferred(preferred_languages, :default => nil)
 
       if object.tags.include? "name:#{locale}"
         name = t "printable_name.with_name_html", :name => tag.bdi(object.tags["name:#{locale}"].to_s), :id => tag.bdi(name)
 
       if object.tags.include? "name:#{locale}"
         name = t "printable_name.with_name_html", :name => tag.bdi(object.tags["name:#{locale}"].to_s), :id => tag.bdi(name)
@@ -44,7 +44,7 @@ module BrowseHelper
     if object.redacted?
       ""
     else
     if object.redacted?
       ""
     else
-      h(icon_tags(object).map { |k, v| k + "=" + v }.to_sentence)
+      h(icon_tags(object).map { |k, v| "#{k}=#{v}" }.to_sentence)
     end
   end
 
     end
   end