aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--web/lib/ui/relation.rb2
-rw-r--r--web/views/relation.erb9
-rw-r--r--web/viewsjs/relation.js.erb5
3 files changed, 16 insertions, 0 deletions
diff --git a/web/lib/ui/relation.rb b/web/lib/ui/relation.rb
index e55d02b..1e1fe71 100644
--- a/web/lib/ui/relation.rb
+++ b/web/lib/ui/relation.rb
@@ -11,6 +11,8 @@ class Taginfo < Sinatra::Base
@title = [escape_html(@rtype), t.osm.relations]
section :relations
+ @count_all_values = @db.select("SELECT count_relations FROM db.keys").condition('key = ?', @rtype).get_first_value().to_i
+
@desc = h(@db.select("SELECT description FROM wiki.relation_pages WHERE lang=? AND rtype=?", r18n.locale.code, @rtype).get_first_value())
@desc = h(@db.select("SELECT description FROM wiki.relation_pages WHERE lang='en' AND rtype=?", @rtype).get_first_value()) if @desc == ''
if @desc == ''
diff --git a/web/views/relation.erb b/web/views/relation.erb
index bf0044b..d1aea0d 100644
--- a/web/views/relation.erb
+++ b/web/views/relation.erb
@@ -1,4 +1,12 @@
<div class="pre">
+ <div id="tools" class="no-print">
+ <% if @count_all_values < TaginfoConfig.get('xapi.max_results', 1000) %>
+ <%= xapi_link('relation', 'type', @rtype) %> <%= josm_link('relation', 'type', @rtype) %>
+ <% 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></h1>
<p><%= @desc %></p>
</div>
@@ -23,6 +31,7 @@
<% end %>
</div>
</div>
+<iframe id="josmiframe" name="josmiframe"></iframe>
<% javascript do
JS.raw(<<"JAVASCRIPT")
function page_init2() {
diff --git a/web/viewsjs/relation.js.erb b/web/viewsjs/relation.js.erb
index 931f33c..6c4ad7e 100644
--- a/web/viewsjs/relation.js.erb
+++ b/web/viewsjs/relation.js.erb
@@ -58,6 +58,11 @@ var create_flexigrid_for = {
};
function page_init() {
+ jQuery('#josm_button').bind('click', function() {
+ jQuery('#josmiframe')[0].src = jQuery('#josm_button')[0].href;
+ return false;
+ });
+
up = function() { window.location = '/relations'; };
page_init2();
}