summaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
authorJochen Topf <jochen@topf.org>2012-02-25 15:43:23 +0100
committerJochen Topf <jochen@topf.org>2012-02-25 15:43:23 +0100
commit88e1bb9f642048d6c8375751369cc62d34ac832d (patch)
treef39fcaa1e0fe86dfc1773ce2c38192e3c3c34352 /web
parentae678011030890b556d4f50814d3d8cbb8656f77 (diff)
downloadtaginfo-88e1bb9f642048d6c8375751369cc62d34ac832d.tar
taginfo-88e1bb9f642048d6c8375751369cc62d34ac832d.tar.gz
Make XAPI/JOSM button use filter setting
Diffstat (limited to 'web')
-rw-r--r--web/lib/ui/keys_tags.rb2
-rw-r--r--web/public/css/taginfo.css5
-rw-r--r--web/views/key.erb16
-rw-r--r--web/views/tag.erb16
4 files changed, 21 insertions, 18 deletions
diff --git a/web/lib/ui/keys_tags.rb b/web/lib/ui/keys_tags.rb
index 1412b50..c49b3d5 100644
--- a/web/lib/ui/keys_tags.rb
+++ b/web/lib/ui/keys_tags.rb
@@ -19,6 +19,7 @@ class Taginfo < Sinatra::Base
@filter_type = get_filter()
@sel = Hash.new('')
@sel[@filter_type] = ' selected="selected"'
+ @filter_xapi = { 'all' => '*', nil => '*', 'nodes' => 'node', 'ways' => 'way', 'relations' => 'relation' }[@filter_type];
@count_all_values = @db.select("SELECT count_#{@filter_type} FROM db.keys").condition('key = ?', @key).get_first_value().to_i
@@ -99,6 +100,7 @@ class Taginfo < Sinatra::Base
@filter_type = get_filter()
@sel = Hash.new('')
@sel[@filter_type] = ' selected="selected"'
+ @filter_xapi = { 'all' => '*', nil => '*', 'nodes' => 'node', 'ways' => 'way', 'relations' => 'relation' }[@filter_type];
@wiki_count = @db.count('wiki.wikipages').condition('key=?', @key).condition('value=?', @value).get_first_value().to_i
if @wiki_count == 0
diff --git a/web/public/css/taginfo.css b/web/public/css/taginfo.css
index 8ce7480..b8ddd71 100644
--- a/web/public/css/taginfo.css
+++ b/web/public/css/taginfo.css
@@ -298,9 +298,10 @@ div#tabs form {
/* ========== */
div#tools {
+ clear: both;
float: right;
font-size: 80%;
- margin-top: 2px;
+ margin-top: 4px;
}
span.lang {
@@ -327,7 +328,7 @@ span.char {
}
form#filter-form {
- margin-top: 10px;
+ margin-top: 0px;
clear: both;
float: right;
}
diff --git a/web/views/key.erb b/web/views/key.erb
index e8ed724..175e72c 100644
--- a/web/views/key.erb
+++ b/web/views/key.erb
@@ -1,12 +1,4 @@
<div class="pre">
- <div id="tools" class="no-print">
- <% if @count_all_values < 1000 %>
- <%= xapi_link('*', @key) %> <%= josm_link('*', @key) %>
- <% else %>
- <span class="button disabled" title="Button disabled, because there are too many objects with this key">XAPI</span>
- <span class="button disabled" title="Button disabled, because there are too many objects with this key">JOSM</span>
- <% end %>
- </div>
<form id="filter-form">
<label for="filter"><%= t.pages.key.filter.label %></label>
<select id="filter" name="filter">
@@ -16,6 +8,14 @@
<option value="relations"<%= @sel['relations'] %>><%= t.pages.key.filter.relations %></option>
</select>
</form>
+ <div id="tools" class="no-print">
+ <% if @count_all_values < 1000 %>
+ <%= xapi_link(@filter_xapi, @key) %> <%= josm_link(@filter_xapi, @key) %>
+ <% else %>
+ <span class="button disabled" title="Button disabled, because there are too many objects with this key">XAPI</span>
+ <span class="button disabled" title="Button disabled, because there are too many objects with this key">JOSM</span>
+ <% end %>
+ </div>
<h1><%= @key_pp %></h1>
<p><%= @desc %></p>
</div>
diff --git a/web/views/tag.erb b/web/views/tag.erb
index 4582606..c8c4f2a 100644
--- a/web/views/tag.erb
+++ b/web/views/tag.erb
@@ -1,12 +1,4 @@
<div class="pre">
- <div id="tools">
- <% if @count_all < 1000 %>
- <%= xapi_link('*', @key, @value) %> <%= josm_link('*', @key, @value) %>
- <% else %>
- <span class="button disabled" title="Button disabled, because there are too many objects with this key">XAPI</span>
- <span class="button disabled" title="Button disabled, because there are too many objects with this key">JOSM</span>
- <% end %>
- </div>
<form id="filter-form">
<label for="filter"><%= t.pages.key.filter.label %></label>
<select id="filter" name="filter">
@@ -16,6 +8,14 @@
<option value="relations"<%= @sel['relations'] %>><%= t.pages.key.filter.relations %></option>
</select>
</form>
+ <div id="tools">
+ <% if @count_all < 1000 %>
+ <%= xapi_link(@filter_xapi, @key, @value) %> <%= josm_link(@filter_xapi, @key, @value) %>
+ <% else %>
+ <span class="button disabled" title="Button disabled, because there are too many objects with this key">XAPI</span>
+ <span class="button disabled" title="Button disabled, because there are too many objects with this key">JOSM</span>
+ <% end %>
+ </div>
<h1><%= link_to_key(@key) %>=<%= @value_pp %></h1>
<p><%= @desc %></p>
</div>