summaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
Diffstat (limited to 'web')
-rw-r--r--web/i18n/fr.yml2
-rw-r--r--web/lib/api.rb4
-rw-r--r--web/public/css/taginfo.css11
-rwxr-xr-xweb/taginfo.rb7
-rw-r--r--web/views/layout.erb7
-rw-r--r--web/views/test-index.erb141
-rw-r--r--web/viewsjs/test-index.js.erb53
7 files changed, 217 insertions, 8 deletions
diff --git a/web/i18n/fr.yml b/web/i18n/fr.yml
index 48511a6..4da94a7 100644
--- a/web/i18n/fr.yml
+++ b/web/i18n/fr.yml
@@ -483,7 +483,7 @@ reports:
<p>Les clés contenant des symboles problématiques : <span
class="char">=+/&amp;&lt;&gt;;'"?%#@\,</span> ou les caractères
de contrôle. Ces caractères
- peuvent poser des problèmes, car ils sont utilisés pour délimiter les chaines de caratères dans
+ peuvent poser des problèmes, car ils sont utilisés pour délimiter les chaines de caractères dans
les langages de programmation. Ils ont une sens particulier en XML, HTML, dans les
URLs, et ailleurs aussi. Le signe égal (<span class="char">=</span>) est souvent utilisé comme séparateur
entre les clés et les valeurs des tags.<br/>
diff --git a/web/lib/api.rb b/web/lib/api.rb
index 9ad8c42..5c8cb5c 100644
--- a/web/lib/api.rb
+++ b/web/lib/api.rb
@@ -127,8 +127,8 @@ class APIParameters
if p[:rp] !~ /^[0-9]{1,3}$/
raise ArgumentError, 'results per page must be integer between 0 and 999'
end
- if p[:page] !~ /^[0-9]{1,4}$/
- raise ArgumentError, 'page must be integer between 0 and 9999'
+ if p[:page] !~ /^[0-9]{1,6}$/
+ raise ArgumentError, 'page must be integer between 0 and 999999'
end
@page = p[:page].to_i
@results_per_page = p[:rp].to_i
diff --git a/web/public/css/taginfo.css b/web/public/css/taginfo.css
index fd694e3..2cf231f 100644
--- a/web/public/css/taginfo.css
+++ b/web/public/css/taginfo.css
@@ -204,14 +204,17 @@ select#locale, select#lang {
border: none;
}
+div#header input#search {
+ height: 18px;
+ width: 228px;
+ padding: 2px;
+}
+
input#search, p.search {
background-image: url('/css/flexigrid/images/magnifier.png');
background-repeat: no-repeat;
- background-position: right 3px;
+ background-position: right center;
background-color: #ffffff;
- height: 18px;
- width: 228px;
- padding: 2px;
border: 1px solid #a0a0a0;
border-radius: 4px;
}
diff --git a/web/taginfo.rb b/web/taginfo.rb
index 7dcec2c..778602a 100755
--- a/web/taginfo.rb
+++ b/web/taginfo.rb
@@ -9,7 +9,7 @@
#
#------------------------------------------------------------------------------
#
-# Copyright (C) 2010-2014 Jochen Topf <jochen@remote.org>
+# Copyright (C) 2010-2015 Jochen Topf <jochen@remote.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -165,6 +165,11 @@ class Taginfo < Sinatra::Base
erb :index
end
+ get '/test-index' do
+ javascript "#{ r18n.locale.code }/test-index"
+ erb :'test-index'
+ end
+
#-------------------------------------
%w(about download sources).each do |page|
diff --git a/web/views/layout.erb b/web/views/layout.erb
index 6c3b98a..3320c15 100644
--- a/web/views/layout.erb
+++ b/web/views/layout.erb
@@ -8,6 +8,11 @@
<link rel="stylesheet" type="text/css" href="/css/smoothness/jquery-ui-1.8.10.custom-minified.css" />
<link rel="stylesheet" type="text/css" href="/css/flexigrid/flexigrid-minified.css" />
<link rel="search" type="application/opensearchdescription+xml" href="/search/opensearch.xml" title="<%= TaginfoConfig.get('opensearch.shortname') %>" />
+<% if @css %>
+ <style type="text/css"><!--
+<%= @css %>
+--></style>
+<% end %>
<%= javascript_tags %>
</head>
<body>
@@ -22,7 +27,9 @@
<% end %>
</select>
</form>
+<% unless @nosearch %>
<form id="search_form" action="/search"><input type="text" id="search" name="q" value="<%= h(params[:q]) %>"/></form>
+<% end %>
</div>
<div id="header_logo">
<a href="/"><img width="49" height="49" src="<%= TaginfoConfig.get('instance.icon', '/img/logo/world.png') %>" alt="taginfo"/></a>
diff --git a/web/views/test-index.erb b/web/views/test-index.erb
new file mode 100644
index 0000000..391efde
--- /dev/null
+++ b/web/views/test-index.erb
@@ -0,0 +1,141 @@
+<% @nosearch = true
+ @css = <<'CSS'
+div#menu {
+ position: relative;
+ margin: 0 auto;
+ width: 100%;
+ height: 30px;
+ border-bottom: 1px solid #a0a0a0;
+}
+
+div#menuitems {
+ position: absolute;
+ width: 100%;
+}
+
+div#menu .mitem {
+ position: relative;
+}
+
+div#menu h2 {
+ text-transform: uppercase;
+ font-weight: normal;
+ margin: 2px 40px 2px 0px;
+ height: 26px;
+ float: left;
+}
+
+div#menu h2:hover {
+ border-bottom: 3px solid #a0a0a0;
+}
+
+div#menu h2 a {
+ text-decoration: none;
+}
+
+div#menu div.mitem .mpop {
+ position: absolute;
+ visibility: hidden;
+ padding-top: 6px;
+ width: 100%;
+ height: 210px;
+ top: 31px;
+ background: -moz-linear-gradient(top, #ffffff, #f0f0f0);
+ border-radius: 4px;
+}
+
+div#menu div.mitem .mpop p {
+ padding: 8px 16px;
+ max-width: 40em;
+}
+
+div#menu div.mitem .mpop div {
+ padding: 8px 16px;
+}
+
+div#menu div.mitem:hover .mpop {
+ visibility: visible;
+}
+
+div#search_box {
+ text-align: center;
+}
+
+div#search_box p {
+ max-width: 100%;
+ font-size: 80%;
+}
+
+div#main input#search {
+ font-size: 140%;
+ padding: 2px 6px;
+}
+CSS
+%>
+<div class="resize">
+ <div id="menu"><div id="menuitems">
+ <div class="mitem"><h2><a href="/keys"><%= h(t.osm.keys) %></a></h2>
+ <div class="mpop">
+ <p>All tag keys that exist in the database or in any of the other sources.</p>
+ <div id="key_list"></div>
+ <p class="emphasis"><a href="/keys"><%= h(t.pages.index.keys.listkeys) %></a></p>
+ </div>
+ </div>
+ <div class="mitem"><h2><a href="/tags"><%= h(t.osm.tags) %></a></h2>
+ <div class="mpop">
+ <p>The most common tags in the database.</p>
+ <div id="tag_list"></div>
+ <p class="emphasis"><a href="/tags"><%= h(t.pages.index.tags.listtags) %></a></p>
+ </div>
+ </div>
+ <div class="mitem"><h2><a href="/relations"><%= h(t.osm.relation_types) %></a></h2>
+ <div class="mpop">
+ <p>The different types of relations (indicated by the type tag).</p>
+ <div id="relation_list"></div>
+ <p class="emphasis"><a href="/relations"><%= h(t.pages.index.relations.listrelations) %></a></p>
+ </div>
+ </div>
+ <div class="mitem"><h2><a href="/projects"><%= h(t.taginfo.projects) %></a></h2>
+ <div class="mpop">
+ <p>Projects that use OSM data in some way.</p>
+ <div>
+<% @db.select('SELECT id, name, icon_url FROM projects.projects').execute().each do |project| %>
+ <a href="/projects/<%= project['id'] %>"><img width="20" height="20" src="<%= project['icon_url'] %>" alt="" title="<%= project['name'] %>"/></a>
+<% end %>
+ </div>
+ <p class="emphasis"><a href="/projects">Show all projects...</a></p>
+ </div>
+ </div>
+ <div class="mitem"><h2><a href="/reports"><%= h(t.taginfo.reports) %></a></h2>
+ <div class="mpop">
+ <p>Reports show the tag data from different angles. They often
+ bring together data from several sources in interesting ways.
+ Some of the reports can help with finding specific errors.</p>
+ <div>
+ <a href="/reports/characters_in_keys">Characters in keys</a> &bull;
+ <a href="/reports/database_statistics">Database statistics</a> &bull;
+ <a href="/reports/historic_development">Historic development</a> &bull;
+ <a href="/reports/key_lengths">Key lengths</a> &bull;
+ <a href="/reports/similar_keys">Similar keys</a>
+ </div>
+ <p class="emphasis"><a href="/reports"><%= h(t.pages.index.reports.listreports) %></a></p>
+ </div>
+ </div>
+ <div class="mitem"><h2><a href="/about"><%= h(t.taginfo.about) %></a></h2>
+ <div class="mpop">
+ <p>OpenStreetMap uses tags to add meaning to geographic
+ objects. There is no fixed list of those tags. New tags can be
+ invented and used as needed. Taginfo tries to bring together
+ all information about tags to help you understand how they are
+ used and what they mean.</p>
+ <p class="emphasis"><a href="/about">More...</a></p>
+ </div>
+ </div>
+ </div></div>
+ <div style="clear: both; height: 240px;"></div>
+ <div id="search_box">
+ <form id="search_form" action="/search"><input type="text" id="search" name="q" value="<%= h(params[:q]) %>"/></form>
+ <p>Search the taginfo database.<br/>
+ Formats: KEY, KEY=VALUE, =VALUE, ...</p>
+ </div>
+</div>
diff --git a/web/viewsjs/test-index.js.erb b/web/viewsjs/test-index.js.erb
new file mode 100644
index 0000000..8920c3c
--- /dev/null
+++ b/web/viewsjs/test-index.js.erb
@@ -0,0 +1,53 @@
+<%
+# This is the maximum number of keys/tags/relations in the lists. Javascript
+# code will only show as many of them as will fit in the window.
+tagcloud_number_of_keys = 100
+tagcloud_number_of_tags = 100
+tagcloud_number_of_rels = 100
+keys = @db.select("SELECT key FROM popular_keys ORDER BY scale1 DESC LIMIT #{ tagcloud_number_of_keys }").execute()
+tags = @db.select("SELECT skey, svalue FROM top_tags WHERE skey NOT IN ('source', 'source_ref', 'attribution') ORDER BY count_all DESC LIMIT #{ tagcloud_number_of_tags }").execute()
+rels = @db.select("SELECT rtype FROM db.relation_types WHERE count >= 1000 ORDER BY count DESC LIMIT #{ tagcloud_number_of_rels }").execute()
+%>
+
+var data = {
+ 'keys': <%= keys.map{ |tag| tag['key'] }.to_json %>,
+ 'tags': <%= tags.map{ |entry| [ entry['skey'], entry['svalue'] ] }.to_json %>,
+ 'rels': <%= rels.map{ |row| row['rtype'] }.to_json %>
+};
+
+up = function() {};
+
+function create_list(element, max_height, data, decrease, func) {
+ var i = 0,
+ size = 160;
+
+ while (element.innerHeight() < max_height && data[i]) {
+ element.append(func(data[i], size));
+ element.append('<span style="font-size: ' + size + '%;"> &bull; </span>');
+ i++;
+ size -= decrease;
+ }
+
+ element.append('...');
+}
+
+function resize_home() {
+
+ create_list(jQuery('#key_list').empty(), 120, data.keys, 1, function(d, size) {
+ return link_to_key(d, { 'style': 'font-size: ' + size + "%;" });
+ });
+
+ create_list(jQuery('#tag_list').empty(), 120, data.tags, 2, function(d, size) {
+ return '<span style="font-size: ' + size + '%;"> ' + link_to_tag(d[0], d[1]) + ' </span>'
+ });
+
+ create_list(jQuery('#relation_list').empty(), 120, data.rels, 5, function(d, size) {
+ return link_to_rtype(d, { 'style': 'font-size: ' + size + "%;" });
+ });
+
+}
+
+function page_init() {
+ jQuery(window).resize(resize_home);
+ resize_home();
+}