summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJochen Topf <jochen@topf.org>2015-03-14 11:07:38 +0100
committerJochen Topf <jochen@topf.org>2015-03-14 11:07:38 +0100
commit5ee19155669c1248d5ea9a2613cbd2eb5e478b3d (patch)
tree83114ba7200e6a8cea5b878f59180e21a7bcb4a0
parent14fa8471fd8de5655e4259507e091fde46f4d971 (diff)
downloadtaginfo-5ee19155669c1248d5ea9a2613cbd2eb5e478b3d.tar
taginfo-5ee19155669c1248d5ea9a2613cbd2eb5e478b3d.tar.gz
Extend "Characters in keys" report.
Now has tabs for all classifications.
-rw-r--r--web/i18n/de.yml80
-rw-r--r--web/i18n/en.yml74
-rw-r--r--web/i18n/es.yml4
-rw-r--r--web/i18n/fr.yml4
-rw-r--r--web/i18n/hu.yml4
-rw-r--r--web/i18n/pl.yml4
-rw-r--r--web/i18n/pt-BR.yml4
-rw-r--r--web/i18n/pt.yml4
-rw-r--r--web/i18n/ru.yml4
-rw-r--r--web/i18n/uk.yml4
-rw-r--r--web/i18n/vi.yml4
-rw-r--r--web/lib/api/v4/keys.rb8
-rw-r--r--web/views/reports/characters_in_keys.erb51
-rw-r--r--web/viewsjs/reports/characters_in_keys.js.erb45
14 files changed, 174 insertions, 120 deletions
diff --git a/web/i18n/de.yml b/web/i18n/de.yml
index 9659510..7060ecd 100644
--- a/web/i18n/de.yml
+++ b/web/i18n/de.yml
@@ -479,9 +479,11 @@ reports:
characters_in_keys:
name: Zeichen in Keys
intro: |
- Alle gültigen Unicode-Zeichen dürfen in OSM-Keys vorkommen. Typischerweise
- werden aber nur Kleinbuchstaben (a-z) und der Unterstrich (_) benutzt. Manchmal
- kommt dazu der Doppelpunkt (:) als Trennzeichen.
+ Alle gültigen Unicode-Zeichen dürfen in OSM-Keys vorkommen.
+ Typischerweise werden aber nur Kleinbuchstaben (a-z) und der
+ Unterstrich (_) benutzt. Manchmal kommt dazu der Doppelpunkt (:)
+ als Trennzeichen. Dieser Report teilt alle Keys nach den Zeichen,
+ die darin benutzt werden, in Kategorien ein.
statistics:
tab: Statistik
title: Statistik-Übersicht
@@ -491,32 +493,70 @@ reports:
plain: Nur lateinische Kleinbuchstaben (<span class="char">a</span> bis <span class="char">z</span>) und Unterstrich (<span class="char">_</span>), erstes und letztes Zeichen sind Buchstaben.
colon: Wie A, aber mit einem oder mehreren Doppelpunkten (<span class="char">:</span>).
letters: Wie B, aber mit Großbuchstaben oder Buchstaben aus anderen Alphabeten.
- space: Wie C, aber mit mindestens einem Whitespace-Zeichen (Leerzeichen, Tabulator, Neue Zeile, Wagenrücklauf, oder aus anderen Alphabeten)
- problem: Wie C, enthält aber die möglicherweise problematischen Zeichen <span class="char">=+/&amp;&lt;&gt;;'"?%#@\,</span>.
+ space: Key mit mindestens einem Whitespace-Zeichen (Leerzeichen, Tabulator, Neue Zeile, Wagenrücklauf, oder aus anderen Alphabeten).
+ problem: Key enthält möglicherweise problematische Zeichen <span class="char">=+/&amp;&lt;&gt;;'"?%#@\,</span>.
rest: Alles andere.
total: Summe
- whitespace:
+ plain:
+ tab: Einfach
+ title: Einfache keys
+ intro: |
+ <p>Keys, die nur lateinische Kleinbuchstaben (<span
+ class="char">a</span> bis <span class="char">z</span>) und
+ den Unterstrich (<span class="char">_</span>) enthalten. Das
+ erste und letzte Zeichen müssen Buchstaben sein. Die meisten
+ einfachen Keys sollten in diese Kategorie fallen.</p>
+ colon:
+ tab: Doppelpunkt
+ title: Keys mit Doppelpunkt
+ intro: |
+ <p>Keys, die einen oder mehrere Doppelpunkte (<span
+ class="char">:</span>) enthalten zusätzlich zu lateinischen
+ Kleinbuchstaben (<span class="char">a</span> bis <span
+ class="char">z</span>) und dem Unterstrich (<span
+ class="char">_</span>). Der Doppelpunkt wird oft als
+ Trennzeichen für eine Hierarchie von "Unter-Keys" verwendet.</p>
+ letters:
+ tab: Buchstaben
+ title: Keys mit Großbuchstaben und Buchstaben aus anderen Alphabeten.
+ intro: |
+ <p>Kleinbuchstaben aus dem lateinischen Alphabet werden für
+ Keys üblicherweise vorgezogen. Manchmal werden aber auch
+ Großbuchstaben benutzt (z.B. für bekannte Abkürzungen) oder
+ Buchstaben aus anderen Alphabeten (z.B. für Keys, die nur in
+ einem Gebiet relevant sind, wo dieses Alphabet üblicherweise
+ benutzt wird).</p>
+ space:
tab: Leerzeichen
title: Keys mit Leerzeichen
intro: |
- <p>Keys, die Whitespace-Zeichen (Leerzeichen, Tabulator, Neue Zeile,
- Wagenrücklauf, oder aus anderen Alphabeten) enthalten.<br/>
- Leerräume in Keys können (da sie nicht sichtbar sind) verwirrend sein,
- besonders am Anfang und am Ende der Keys. Normalerweise sollte
- stattdessen ein Unterstrich (_) verwenden werden.</p>
- problematic:
+ <p>Keys, die Whitespace-Zeichen (Leerzeichen, Tabulator, Neue
+ Zeile, Wagenrücklauf, oder aus anderen Alphabeten) enthalten.
+ Leerräume in Keys können (da sie nicht sichtbar sind)
+ verwirrend sein, besonders am Anfang und am Ende der Keys.
+ Normalerweise sollte das Whitespace entfernt oder stattdessen
+ ein Unterstrich (<span class="char">_</span>) verwenden
+ werden.</p>
+ problem:
tab: Problematisch
title: Keys mit möglicherweise problematischen Zeichen
intro: |
<p>Keys mit möglicherweise problematischen Zeichen: <span
- class="char">=+/&amp;&lt;&gt;;'"?%#@\,</span> und Control-Zeichen. Diese Zeichen
- können problematisch sein, weil sie in verschiedenen Programmiersprachen
- zum "Zitieren" von Zeichenketten verwendet werden oder weil sie in
- XML, HTML, URLs oder anderen Zusammenhängen besondere Bedeutung
- haben. Das Gleichheitszeichen (=) wird bei OSM häufig als Trennzeichen
- zwischen Tag Keys und Values benutzt.<br/>
- Keys, die in dieser Liste erscheinen, sind nicht unbedingt falsch. In
- vielen Fällen sind sie aber das Ergebnis eines Fehlers.</p>
+ class="char">=+/&amp;&lt;&gt;;'"?%#@\,</span> und
+ Control-Zeichen. Diese Zeichen können problematisch sein, weil
+ sie in verschiedenen Programmiersprachen zum "Zitieren" von
+ Zeichenketten verwendet werden oder weil sie in XML, HTML, URLs
+ oder anderen Zusammenhängen besondere Bedeutung haben. Das
+ Gleichheitszeichen (<span class="char">=</span>) wird bei OSM
+ häufig als Trennzeichen zwischen Tag Keys und Values
+ benutzt.<br/> Keys, die in dieser Liste erscheinen, sind nicht
+ unbedingt falsch. In vielen Fällen sind sie aber das Ergebnis
+ eines Fehlers.</p>
+ rest:
+ tab: Sonstige
+ title: Alle anderen Keys
+ intro: |
+ <p>Keys, die in keine der anderen Kategorien passen.</p>
database_statistics:
name: Datenbank-Statistik
objects_in_db: Anzahl Objekte in der Datenbank
diff --git a/web/i18n/en.yml b/web/i18n/en.yml
index 74d1fee..9536e49 100644
--- a/web/i18n/en.yml
+++ b/web/i18n/en.yml
@@ -459,9 +459,10 @@ reports:
characters_in_keys:
name: Characters in keys
intro: |
- Any valid Unicode character can appear in an OSM key but usually only lower
- case latin letters (a-z) and the underscore (_) are used. Sometimes the colon
- (:) is added as a separator character.
+ Any valid Unicode character can appear in an OSM key but usually
+ only lower case latin letters (a-z) and the underscore (_) are
+ used. The colon (:) is often used as a separator character. This
+ report categorizes all keys according the the characters they use.
statistics:
tab: Statistics
title: Statistics overview
@@ -471,33 +472,66 @@ reports:
plain: Only latin lowercase letters (<span class="char">a</span> to <span class="char">z</span>) and underscore (<span class="char">_</span>), first and last characters are letters.
colon: Like A but with one or more colons (<span class="char">:</span>) inside.
letters: Like B but with uppercase latin letters or letters from other alphabets.
- space: Like C but contains at least one whitespace character (space, tab, new line, carriage return, or from other alphabets).
- problem: Like C but contains possibly problematic characters <span class="char">=+/&amp;&lt;&gt;;'"?%#@\,</span>.
+ space: At least one whitespace character (space, tab, new line, carriage return, or from other alphabets).
+ problem: Contains possibly problematic characters <span class="char">=+/&amp;&lt;&gt;;'"?%#@\,</span>.
rest: Everything else.
total: Total
- whitespace:
+ plain:
+ tab: Plain
+ title: Plain keys
+ intro: |
+ <p>Keys containing only lowercase latin letters (<span
+ class="char">a</span> to <span class="char">z</span>) and the
+ underscore (<span class="char">_</span>). First and last
+ characters must be letters. Most simple keys should fall into
+ this category.</p>
+ colon:
+ tab: Colon
+ title: Keys with colon
+ intro: |
+ <p>Keys that have one or more colon (<span
+ class="char">:</span>) characters inside in addition to the
+ letters (<span class="char">a</span> to <span
+ class="char">z</span>) and underscores (<span
+ class="char">_</span>). The colon is often used as a hierarchy
+ separator character.</p>
+ letters:
+ tab: Letters
+ title: Keys with uppercase letters or letters from other scripts
+ intro: |
+ <p>Lowercase letters from the latin script are usually
+ preferred for keys, but sometimes uppercase letters are used
+ (for instance for known abbreviations) or letters from other
+ scripts (for instance for keys only relevant to an area where
+ that script is used predominantly).</p>
+ space:
tab: Whitespace
title: Keys with whitespace
intro: |
- <p>Keys that contain whitespace characters such as space, tab, new
- line, carriage return, or whitespace characters from other
- alphabets.<br/>
- Whitespace in keys can be confusing, especially at the
- beginning or end of the key, because they are invisible. Generally
- the underscore (_) should be used instead.</p>
- problematic:
+ <p>Keys that contain whitespace characters such as space, tab,
+ new line, carriage return, or whitespace characters from other
+ alphabets. Whitespace in keys can be confusing, especially at
+ the beginning or end of the key, because they are invisible.
+ Generally the whitespace should be removed or the underscore
+ (<span class="char">_</span>) used instead.</p>
+ problem:
tab: Problematic
title: Keys with possibly problematic characters
intro: |
<p>Keys that contain possibly problematic characters: <span
class="char">=+/&amp;&lt;&gt;;'"?%#@\,</span> or control
- characters. These characters
- can be problematic, because they are used to quote strings in
- different programming languages or have special meanings in XML, HTML,
- URLs, and other places. The equal sign is used often as separator
- between tag keys and values.<br/>
- Keys that appear in this list are not necessarily wrong though. But
- in many cases they are just results of some error.</p>
+ characters. These characters can be problematic, because they
+ are used to quote strings in different programming languages or
+ have special meanings in XML, HTML, URLs, and other places. The
+ equal sign is used often as separator between tag keys and
+ values. Keys that appear in this list are not necessarily wrong
+ though. But in many cases they are just results of some error
+ and should be fixed.</p>
+ rest:
+ tab: Rest
+ title: All other keys
+ intro: |
+ <p>Keys that don't fit in any of the other categories.</p>
database_statistics:
name: Database statistics
objects_in_db: Number of objects in the database
diff --git a/web/i18n/es.yml b/web/i18n/es.yml
index 3dc39e7..1faa1ba 100644
--- a/web/i18n/es.yml
+++ b/web/i18n/es.yml
@@ -465,7 +465,7 @@ reports:
problem: Como C pero contiene caracteres posiblemente problemáticos <span class="char">=+/&amp;&lt;&gt;;'"?%#@\,</span>.
rest: Todo lo demás.
total: Total
- whitespace:
+ space:
tab: Whitespace
title: Claves con espacios en blanco
intro: |
@@ -475,7 +475,7 @@ reports:
Espacio en blanco en las claves pueden ser confusos, especialmente al
principio o al final de la clave, porque son invisibles. Generalmente
puede usarse el guión abajo (_) en su lugar.</p>
- problematic:
+ problem:
tab: Problemático
title: Claves con caracteres posiblemente problemáticos
intro: |
diff --git a/web/i18n/fr.yml b/web/i18n/fr.yml
index 80b2b3d..48511a6 100644
--- a/web/i18n/fr.yml
+++ b/web/i18n/fr.yml
@@ -466,7 +466,7 @@ reports:
problem: Comme la règle C mais peut contenir des caractères problématiques <span class="char">=+/&amp;&lt;&gt;;'"?%#@\,</span>.
rest: Toutes les autres possibilités.
total: Total
- whitespace:
+ space:
tab: Espaces
title: Clés contenant des espaces
intro: |
@@ -476,7 +476,7 @@ reports:
Les espaces dans les clés sont sources d'erreur, en particulier au
début ou la fin de la clé, car ils sont invisibles. Généralement
le caractère de soulignement (<span class="char">_</span>) devrait être utilisé à la place.</p>
- problematic:
+ problem:
tab: Problématiques
title: Clés avec des caractères potentiellement problématiques
intro: |
diff --git a/web/i18n/hu.yml b/web/i18n/hu.yml
index 4ef92f1..ead6998 100644
--- a/web/i18n/hu.yml
+++ b/web/i18n/hu.yml
@@ -347,9 +347,9 @@ reports:
problem: Mint C, de tartalmaz olyan karaktereket, amik problémát okozhatnak <span class="char">=+/&amp;&lt;&gt;;'"?%#@\,</span>.
rest: Bármi más.
total: Összes
- whitespace:
+ space:
tab: Szököz
title: Szóközt tartalmazó kulcsok
- problematic:
+ problem:
tab: Problémásak
title: Problémás karaktereket tartalmazó kulcsok
diff --git a/web/i18n/pl.yml b/web/i18n/pl.yml
index d7e78b8..97c5e9c 100644
--- a/web/i18n/pl.yml
+++ b/web/i18n/pl.yml
@@ -349,13 +349,13 @@ reports:
problem: Jak w C, ale zawierające problematyczne znaki <span class="char">=+/&amp;&lt;&gt;;'"?%#@\,</span>.
rest: Wszystko pozostałe.
total: Razem
- whitespace:
+ space:
tab: Znaki niedrukowalne
title: Klucze ze znakami niedrukowalnymi
intro: |
<p>Klucze zawierające znaki niedrukowalne takie jak spacje, tabulacje, nowe linie, znak powrotu do początku linii, albo z innych alfabetów.<br/>
Znaki niedrukowalne w kluczach mogą być dezorientujące, zwłaszcza jeśli znajdują się na początku albo na końcu, gdyż są niewidoczne. Generalnie powinno się używać zamiast nich podkreślnika (_).</p>
- problematic:
+ problem:
tab: Problematyczne
title: Klucze z potencjalnie problematycznymi znakami
intro: |
diff --git a/web/i18n/pt-BR.yml b/web/i18n/pt-BR.yml
index f6e0386..e9be434 100644
--- a/web/i18n/pt-BR.yml
+++ b/web/i18n/pt-BR.yml
@@ -393,10 +393,10 @@ reports:
characters_in_keys:
rest: Todo o resto.
total: Total
- whitespace:
+ space:
tab: Espaço em branco
title: Chaves com espaços em branco
- problematic:
+ problem:
tab: Problemático
title: Chaves com caracteres possivelmente problemáticos
database_statistics:
diff --git a/web/i18n/pt.yml b/web/i18n/pt.yml
index 8773cf2..41ccec4 100644
--- a/web/i18n/pt.yml
+++ b/web/i18n/pt.yml
@@ -393,10 +393,10 @@ reports:
characters_in_keys:
rest: Todo o resto.
total: Total
- whitespace:
+ space:
tab: Espaço em branco
title: Chaves com espaços em branco
- problematic:
+ problem:
tab: Problemático
title: Chaves com caracteres possivelmente problemáticos
database_statistics:
diff --git a/web/i18n/ru.yml b/web/i18n/ru.yml
index 97cfbfb..358a377 100644
--- a/web/i18n/ru.yml
+++ b/web/i18n/ru.yml
@@ -327,7 +327,7 @@ reports:
problem: Как в C, но содержит потенциально проблемные символы <span class="char">=+/&amp;&lt;&gt;;'"?%#@\,</span>.
rest: Все остальные.
total: Всего
- whitespace:
+ space:
tab: Пробелы
title: Ключи с пробелами и прочим
intro: |
@@ -336,7 +336,7 @@ reports:
Такие разделители могут приводить к путанице, особенно если они
находятся в начале или конце ключа и фактически невидимы.
Обычно в качестве разделителя используют символ подчёркивания (_).</p>
- problematic:
+ problem:
tab: Проблемные
title: Ключи с возможно проблемными символами
intro: |
diff --git a/web/i18n/uk.yml b/web/i18n/uk.yml
index 59b0a31..3e74113 100644
--- a/web/i18n/uk.yml
+++ b/web/i18n/uk.yml
@@ -327,7 +327,7 @@ reports:
problem: Як в C, але містить потенційно проблемні символи <span class="char">=+/&amp;&lt;&gt;;'"?%#@\,</span>.
rest: Усі інші.
total: Всього
- whitespace:
+ space:
tab: Пробіли
title: Ключі з пробілами та іншим
intro: |
@@ -336,7 +336,7 @@ reports:
Такі роздільники можуть призводити до плутанини, особливо якщо вони
знаходяться на початку або кінці ключа і фактично невидимі.
Зазвичай як роздільник використовують символ підкреслення (_).</p>
- problematic:
+ problem:
tab: Проблемні
title: Ключі з можливо проблемними символами
intro: |
diff --git a/web/i18n/vi.yml b/web/i18n/vi.yml
index 17947a5..a242ec6 100644
--- a/web/i18n/vi.yml
+++ b/web/i18n/vi.yml
@@ -344,7 +344,7 @@ reports:
problem: Giống C nhưng có các ký tự có thể gây vấn đề <span class="char">=+/&amp;&lt;&gt;;'"?%#@\,</span>.
rest: Những cái gì khác.
total: Tổng số
- whitespace:
+ space:
tab: Khoảng cách
title: Chìa khóa có khoảng cách
intro: |
@@ -353,7 +353,7 @@ reports:
Khoảng cách trong chìa khóa có thể gây nhầm lẫn, nhất là tại
đầu hoặc cuối chìa khóa, vì không nhìn thấy nó được. Nói chung,
dấu gạch dưới (_) nên được dùng thay thế.</p>
- problematic:
+ problem:
tab: Gây vấn đề
title: Chìa khóa có ký tự có thể gây vấn đề
intro: |
diff --git a/web/lib/api/v4/keys.rb b/web/lib/api/v4/keys.rb
index e4f4c99..f628a5b 100644
--- a/web/lib/api/v4/keys.rb
+++ b/web/lib/api/v4/keys.rb
@@ -2,8 +2,12 @@
class Taginfo < Sinatra::Base
@@filters = {
- :characters_space => { :expr => "characters='space'", :doc => 'Only show keys with spaces.' },
- :characters_problematic => { :expr => "characters='problem'", :doc => 'Only show keys with problematic characters.' },
+ :characters_plain => { :expr => "characters='plain'", :doc => 'Category A: Only show keys with latin lowercase letters (a to z) or underscore (_), first and last characters must be letters.' },
+ :characters_colon => { :expr => "characters='colon'", :doc => 'Category B: Only show keys like category A but with one ore more colons (:) inside.' },
+ :characters_letters => { :expr => "characters='letters'", :doc => 'Category C: Only show keys like category B but with uppercase latin letters or letters from other scripts.' },
+ :characters_space => { :expr => "characters='space'", :doc => 'Category D: Only show keys with at least one whitespace character (space, tab, new line, carriage return, or from other scripts).' },
+ :characters_problem => { :expr => "characters='problem'", :doc => 'Category E: Only show keys with problematic characters.' },
+ :characters_rest => { :expr => "characters='rest'", :doc => 'Category F: Only show keys not fitting in category A through E.' },
:in_wiki => { :expr => "in_wiki=1", :doc => 'Only show keys that appear in the wiki.' },
:not_in_db => { :expr => "count_all=0", :doc => 'Only show keys that do not appear in the database.' }
}
diff --git a/web/views/reports/characters_in_keys.erb b/web/views/reports/characters_in_keys.erb
index 7d8eaf3..87349bf 100644
--- a/web/views/reports/characters_in_keys.erb
+++ b/web/views/reports/characters_in_keys.erb
@@ -1,3 +1,14 @@
+<%
+categories = [
+ { category: 'A', name: 'plain', color: '#2ca02c' },
+ { category: 'B', name: 'colon', color: '#98df8a' },
+ { category: 'C', name: 'letters', color: '#dbdb8d' },
+ { category: 'D', name: 'space', color: '#d62727' },
+ { category: 'E', name: 'problem', color: '#ff9896' },
+ { category: 'F', name: 'rest', color: '#aec7e8' },
+]
+%>
+
<div class="pre">
<h1><%= h(t.reports.characters_in_keys.name) %></h1>
<p><%= h(t.reports.characters_in_keys.intro) %></p>
@@ -5,8 +16,10 @@
<div id="tabs">
<ul>
<li><a href="#statistics"><%= h(t.reports.characters_in_keys.statistics.tab) %></a></li>
- <li><a href="#whitespace"><span style="background-color: #d62727;">&nbsp;&nbsp;&nbsp;</span> <%= h(t.reports.characters_in_keys.whitespace.tab) %></a></li>
- <li><a href="#problematic"><span style="background-color: #ff9896;">&nbsp;&nbsp;&nbsp;</span> <%= h(t.reports.characters_in_keys.problematic.tab) %></a></li>
+<% categories.each do |c| %>
+ <li><a href="#<%= c[:name] %>"><span style="background-color: <%= c[:color] %>; border: 1px solid #ffffff;">&nbsp;<%= c[:category] %>&nbsp;</span>
+ <%= h(t.reports.characters_in_keys[c[:name]].tab) %></a></li>
+<% end %>
</ul>
<div id="statistics">
<h2><%= h(t.reports.characters_in_keys.statistics.title) %></h2>
@@ -18,39 +31,31 @@
<th class="tr"><%= h(t.reports.characters_in_keys.statistics.fraction) %></th>
<th class="tl"><%= h(t.reports.characters_in_keys.statistics.characters) %></th>
</tr>
-<% letter='A'
- colors = { :A => '#2ca02c', :B => '#98df8a', :C => '#dbdb8d', :D => '#d62728', :E => '#ff9896', :F => '#aec7e8' }
- %w(plain colon letters space problem rest).each_with_index do |type, n| c = (n%2!=0) ? ' even' : '' %>
+<% categories.each_with_index do |category, n| c = (n%2!=0) ? ' even' : '' %>
<tr>
- <td class="tc<%= c %>" style="background-color: <%= colors[letter.to_sym] %>;"><%= letter %></td>
- <td class="tr<%= c %>"><%= @db.stats('characters_in_keys_' + type) %></td>
- <td class="tr<%= c %>"><%= sprintf '%.2f', @db.stats('characters_in_keys_' + type) * 100.0 / @db.stats('num_keys') %>%</td>
- <td class="tl<%= c %>"><%= t.reports.characters_in_keys.statistics.characters_in_keys[type] %></td>
+ <td class="tc<%= c %>" style="background-color: <%= category[:color] %>;"><%= category[:category] %></td>
+ <td class="tr<%= c %>"><%= @db.stats('characters_in_keys_' + category[:name]) %></td>
+ <td class="tr<%= c %>"><%= sprintf '%.2f', @db.stats('characters_in_keys_' + category[:name]) * 100.0 / @db.stats('num_keys') %>%</td>
+ <td class="tl<%= c %>"><%= t.reports.characters_in_keys.statistics.characters_in_keys[category[:name]] %></td>
</tr>
-<% letter = letter.succ; end %>
+<% end %>
<tr>
<td class="tc" style="border-top: 1px solid #000000;"></td>
<td class="tr" style="border-top: 1px solid #000000;"><%= @db.stats('num_keys') %></td>
<td class="tr" style="border-top: 1px solid #000000;">100%</td>
- <td class="tl" style="border-top: 1px solid #000000;"><%= t.reports.characters_in_keys.statistics.characters_in_keys.total %></td>
+ <td class="tl" style="border-top: 1px solid #000000;"><%= h(t.reports.characters_in_keys.statistics.characters_in_keys.total) %></td>
</tr>
</table>
</div>
- <div id="whitespace">
- <h2><%= h(t.reports.characters_in_keys.whitespace.title) %></h2>
+<% categories.map{ |c| c[:name] }.each do |category| %>
+ <div id="<%= category %>">
+ <h2><%= h(t.reports.characters_in_keys[category].title) %></h2>
<div class="boxpre">
- <%= t.reports.characters_in_keys.whitespace.intro %>
+ <%= t.reports.characters_in_keys[category].intro %>
</div>
- <table id="grid-whitespace">
- </table>
- </div>
- <div id="problematic">
- <h2><%= h(t.reports.characters_in_keys.problematic.title) %></h2>
- <div class="boxpre">
- <%= t.reports.characters_in_keys.problematic.intro %>
- </div>
- <table id="grid-problematic">
+ <table id="grid-<%= category %>">
</table>
</div>
+<% end %>
</div>
<% javascript_for(:d3) %>
diff --git a/web/viewsjs/reports/characters_in_keys.js.erb b/web/viewsjs/reports/characters_in_keys.js.erb
index 3dbc7c0..4d65201 100644
--- a/web/viewsjs/reports/characters_in_keys.js.erb
+++ b/web/viewsjs/reports/characters_in_keys.js.erb
@@ -2,41 +2,12 @@
osm = @trans.t.osm
misc = @trans.t.misc
%>
-var create_flexigrid_for = {
- whitespace: function() {
- create_flexigrid('grid-whitespace', {
- url: '/api/4/keys/all?filter=characters_space&include=prevalent_values',
- colModel: [
- { display: '<%= h(osm.key) %>', name: 'key', width: 250, sortable: true },
- { display: '<span title="<%= h(misc.objects_tooltip) %>"><img src="/img/types/all.16.png" width="16" height="16" alt=""/> <%= h(osm.objects) %></span>', name: 'count_all', width: 150, sortable: true, align: 'center' },
- { display: '<span title="<%= h(misc.users_tooltip) %>"><%= h(osm.users) %></span>', name: 'users_all', width: 44, sortable: true, align: 'right' },
- { display: '<img src="/img/sources/wiki.16.png" width="16" height="16" alt="Wiki" title="<%= h(misc.in_wiki_tooltip) %>"/>', name: 'in_wiki', width: 20, sortable: true, align: 'center' },
- { display: '<span title="<%= h(misc.values_tooltip) %>"><%= h(osm.values) %></span>', name: 'values_all', width: 70, sortable: true, align: 'right' },
- { display: '<span title="<%= h(misc.prevalent_values_tooltip) %>"><%= h(misc.prevalent_values) %></span>', name: 'prevalent_values', width: 600, sortable: true }
- ],
- searchitems: [
- { display: '<%= h(osm.key) %>', name: 'key' }
- ],
- sortname: 'count_all',
- sortorder: 'desc',
- preProcess: function(data) {
- data.rows = jQuery.map(data.data, function(row, i) {
- return { 'cell': [
- link_to_key(row.key),
- fmt_value_with_percent(row.count_all, row.count_all_fraction),
- fmt_with_ts(row.users_all),
- fmt_checkmark(row.in_wiki),
- fmt_with_ts(row.values_all),
- fmt_prevalent_value_list(row.key, row.prevalent_values)
- ] };
- });
- return data;
- }
- });
- },
- problematic: function() {
- create_flexigrid('grid-problematic', {
- url: '/api/4/keys/all?filter=characters_problematic&include=prevalent_values',
+var create_flexigrid_for = {};
+
+['plain', 'colon', 'letters', 'space', 'problem', 'rest'].forEach(function(category) {
+ create_flexigrid_for[category] = function() {
+ create_flexigrid('grid-' + category, {
+ url: '/api/4/keys/all?filter=characters_' + category + '&include=prevalent_values',
colModel: [
{ display: '<%= h(osm.key) %>', name: 'key', width: 250, sortable: true },
{ display: '<span title="<%= h(misc.objects_tooltip) %>"><img src="/img/types/all.16.png" width="16" height="16" alt=""/> <%= h(osm.objects) %></span>', name: 'count_all', width: 150, sortable: true, align: 'center' },
@@ -64,8 +35,8 @@ var create_flexigrid_for = {
return data;
}
});
- }
-};
+ };
+});
function page_init() {
up = function() { window.location = '/reports'; };