From 2dc4ec2bbf90fe1708f9f8a5acf2205fedfd8d0b Mon Sep 17 00:00:00 2001 From: Jochen Topf Date: Fri, 16 May 2014 14:50:42 +0200 Subject: Extent key comparison to also work for tags. --- web/views/key_comparison.erb | 74 ++++++++++++++++++++++++-------------------- 1 file changed, 40 insertions(+), 34 deletions(-) (limited to 'web/views') diff --git a/web/views/key_comparison.erb b/web/views/key_comparison.erb index a113c42..6bce915 100644 --- a/web/views/key_comparison.erb +++ b/web/views/key_comparison.erb @@ -1,41 +1,41 @@
-

<%= h(t.taginfo.key_comparison) %>

+

<%= h(t.taginfo.comparison) %>

- <% (0..@keys.size-1).each do |num| %> - <% end %> - <% @keys.each_with_index do |key, num| %> - - <% @keys.each_with_index do |key, num| %> - <% end %> - <% @keys.each_with_index do |key, num| %> - <% end %> - <% @keys.each_with_index do |key, num| %> - <% end %> - <% @keys.each do |key| %> + <% @data.each_with_index do |data, num| %> <% end %> @@ -79,13 +80,18 @@ <% javascript do JS.raw(<<"JAVASCRIPT") function page_init2() { - var keys = #{ @keys.to_json }, - prevalent_values = #{ @prevalent_values.to_json }; - jQuery.each(keys, function(index, key) { - jQuery('.key' + index + ' h2').html(link_to_key(key)); - jQuery('.key' + index + ' div.prevalent_values').html(fmt_prevalent_value_list(key, prevalent_values[index])); + var data = #{ @data.to_json }; + jQuery.each(data, function(index, data) { + if (data.value) { + jQuery('.item' + index + ' h2').html(link_to_tag(data.key, data.value)); + } else { + jQuery('.item' + index + ' h2').html(link_to_key(data.key)); + jQuery('.item' + index + '.prevalent_values p b').html('#{ h(t.misc.prevalent_values)}:'); + jQuery('.item' + index + '.prevalent_values div').html(fmt_prevalent_value_list(data.key, data.prevalent_values)); + } }); - jQuery('div.prevalent_values a').tipsy({ opacity: 1, delayIn: 500, gravity: 'e' }); + jQuery('div.prevalent_values a').tipsy({ opacity: 1, delayIn: 500, gravity: 'w' }); + jQuery('span.lang').tipsy({ opacity: 1, delayIn: 500, gravity: 'n' }); } JAVASCRIPT end -- cgit v1.2.3
+ <% @data.each_with_index do |data, num| %> +

-

<%= @desc[num] %>

+

<%= data[:desc] %>

+ <% @data.each_with_index do |data, num| %> + - - + + - - + + - - + + - - + +
<%= h(t.osm.all) %><%= @count_all[num].to_s_with_ts %> <%= h(t.osm.all) %><%= data[:count_all].to_s_with_ts %>
<%= h(t.osm.nodes) %><%= @count_nodes[num].to_s_with_ts %> <%= h(t.osm.nodes) %><%= data[:count_nodes].to_s_with_ts %>
<%= h(t.osm.ways) %><%= @count_ways[num].to_s_with_ts %> <%= h(t.osm.ways) %><%= data[:count_ways].to_s_with_ts %>
<%= h(t.osm.relations) %><%= @count_relations[num].to_s_with_ts %> <%= h(t.osm.relations) %><%= data[:count_relations].to_s_with_ts %>
@@ -43,35 +43,36 @@ <% end %>
-

<%= h(t.misc.prevalent_values) %>:

-
+ <% @data.each_with_index do |data, num| %> +
+

+
-

<%= h(t.pages.key.wiki_pages.title) %>:

- <%= @wiki_pages[num].map{ |lang| '' + lang + '' }.join(' ') %> + <% @data.each_with_index do |data, num| %> +
+

<%= data[:value].nil? ? h(t.pages.key.wiki_pages.title) : h(t.pages.tag.wiki_pages.title) %>:

+ <%= data[:wiki_pages].map{ |lang| '' + lang + '' }.join(' ') %>
- <% if @has_map[num] %> + <% @data.each_with_index do |data, num| %> + + <% if data[:has_map] %>
- - + <% key_or_tag = data[:value].nil? ? 'key' : 'tag' %> + +
<% end %>