diff options
-rw-r--r-- | web/lib/ui/key_comparison.rb | 3 | ||||
-rw-r--r-- | web/views/key_comparison.erb | 2 |
2 files changed, 5 insertions, 0 deletions
diff --git a/web/lib/ui/key_comparison.rb b/web/lib/ui/key_comparison.rb index c0ba7f0..5a0fcfa 100644 --- a/web/lib/ui/key_comparison.rb +++ b/web/lib/ui/key_comparison.rb @@ -11,6 +11,7 @@ class Taginfo < Sinatra::Base @desc = [] @prevalent_values = [] @wiki_pages = [] + @has_map = [] @keys.each_with_index do |key, num| @count_all << @db.select("SELECT count_all FROM db.keys").condition('key = ?', key).get_first_value().to_i @@ -32,6 +33,8 @@ class Taginfo < Sinatra::Base execute().map{ |row| row['lang'] } @wiki_pages << wiki_pages + @has_map << (@db.count('tag_distributions').condition('key = ?', key).get_first_value().to_i > 0) + end @img_width = TaginfoConfig.get('geodistribution.width') diff --git a/web/views/key_comparison.erb b/web/views/key_comparison.erb index 649e4a0..a113c42 100644 --- a/web/views/key_comparison.erb +++ b/web/views/key_comparison.erb @@ -61,10 +61,12 @@ <tr> <% @keys.each_with_index do |key, num| %> <td class="data key<%= num %>"> + <% if @has_map[num] %> <div style="background-image: url(<%= TaginfoConfig.get('geodistribution.background_image') %>); background-repeat: no-repeat; background-position: center 4px; background-size: <%= @img_width %>px <%= @img_height %>px; position: relative;"/> <img class="map" src="/api/4/key/distribution/nodes?key=<%= key %>" alt="" width="<%= @img_width %>" height="<%= @img_height %>" style="position: absolute;"/> <img class="map" src="/api/4/key/distribution/ways?key=<%= key %>" alt="" width="<%= @img_width %>" height="<%= @img_height %>"/> </div> + <% end %> </td> <% end %> </tr> |