4 def printable_name(object, version = false)
5 id = if object.id.is_a?(Array)
10 name = t "printable_name.with_id", :id => id.to_s
11 name = t "printable_name.with_version", :id => name, :version => object.version.to_s if version
13 # don't look at object tags if redacted, so as to avoid giving
14 # away redacted version tag information.
15 unless object.redacted?
16 locale = I18n.locale.to_s
18 locale = locale.sub(/-[^-]+/, "") while locale =~ /-[^-]+/ && !object.tags.include?("name:#{I18n.locale}")
20 if object.tags.include? "name:#{locale}"
21 name = t "printable_name.with_name_html", :name => content_tag(:bdi, object.tags["name:#{locale}"].to_s), :id => content_tag(:bdi, name)
22 elsif object.tags.include? "name"
23 name = t "printable_name.with_name_html", :name => content_tag(:bdi, object.tags["name"].to_s), :id => content_tag(:bdi, name)
24 elsif object.tags.include? "ref"
25 name = t "printable_name.with_name_html", :name => content_tag(:bdi, object.tags["ref"].to_s), :id => content_tag(:bdi, name)
32 def link_class(type, object)
38 classes += icon_tags(object).flatten.map { |t| h(t) }
39 classes << "deleted" unless object.visible?
45 def link_title(object)
49 h(icon_tags(object).map { |k, v| k + "=" + v }.to_sentence)
53 def link_follow(object)
54 "nofollow" if object.tags.empty?
57 def type_and_paginated_count(type, pages)
58 if pages.page_count == 1
59 t "browse.changeset.#{type}",
60 :count => pages.item_count
62 t "browse.changeset.#{type}_paginated",
63 :x => pages.current_page.first_item,
64 :y => pages.current_page.last_item,
65 :count => pages.item_count
71 ICON_TAGS = %w[aeroway amenity barrier building highway historic landuse leisure man_made natural railway shop tourism waterway].freeze
74 object.tags.find_all { |k, _v| ICON_TAGS.include? k }.sort