summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJochen Topf <jochen@topf.org>2013-02-13 16:04:21 +0100
committerJochen Topf <jochen@topf.org>2013-02-13 16:04:21 +0100
commit82eeb55f1e7a70336a15af2526b76321563f480c (patch)
tree53e430f003215c20e41ed9288031ef4d0d4b6e37
parentda1311e463ee6c27369be7e02a463114620c8a8f (diff)
downloadtaginfo-82eeb55f1e7a70336a15af2526b76321563f480c.tar
taginfo-82eeb55f1e7a70336a15af2526b76321563f480c.tar.gz
Add turbo link to tools
-rw-r--r--taginfo-config-example.json3
-rw-r--r--web/lib/utils.rb19
-rw-r--r--web/public/css/taginfo.css2
-rw-r--r--web/public/img/turbo.pngbin0 -> 351 bytes
-rw-r--r--web/views/key.erb1
-rw-r--r--web/views/relation.erb1
-rw-r--r--web/views/tag.erb1
7 files changed, 26 insertions, 1 deletions
diff --git a/taginfo-config-example.json b/taginfo-config-example.json
index 69d5893..0e92424 100644
--- a/taginfo-config-example.json
+++ b/taginfo-config-example.json
@@ -35,6 +35,9 @@
// "url_prefix": "http://open.mapquestapi.com/xapi/api/0.6/"
"url_prefix": "http://overpass-api.de/api/xapi_meta?"
},
+ "turbo": {
+ "url_prefix": "http://overpass-turbo.eu/?"
+ },
"opensearch": {
// For the OpenSearchDescription. You have to change at least the shortname and the contact for your instance.
"shortname": "Taginfo Test Instance",
diff --git a/web/lib/utils.rb b/web/lib/utils.rb
index 599f5f8..da47f10 100644
--- a/web/lib/utils.rb
+++ b/web/lib/utils.rb
@@ -85,6 +85,25 @@ def josm_link(element, key, value=nil)
'<span class="button">' + external_link('josm_button', 'JOSM', 'http://localhost:8111/import?url=' + Rack::Utils::escape(xapi_url(element, key, value)), true) + '</span>'
end
+def turbo_link(filter, key, value=nil)
+ template = 'key';
+ parameters = { :key => Rack::Utils::escape(key) }
+
+ unless value.nil?
+ parameters[:value] = Rack::Utils::escape(value);
+ template += '-value'
+ end
+
+ if filter != 'all'
+ template += '-type'
+ parameters[:type] = filter.chop
+ end
+ parameters[:template] = template
+
+ url = TaginfoConfig.get('turbo.url_prefix', 'http://overpass-turbo.eu/?') + Rack::Utils::build_query(parameters)
+ return '<span class="button">' + external_link('turbo_button', '<img src="/img/turbo.png" title="Turbo"/>', url, true) + '</span>'
+end
+
def external_link(id, title, link, new_window=false)
target = new_window ? 'target="_blank" ' : ''
%Q{<a id="#{id}" #{target}rel="nofollow" class="extlink" href="#{link}">#{title}</a>}
diff --git a/web/public/css/taginfo.css b/web/public/css/taginfo.css
index 9a29e64..6de687c 100644
--- a/web/public/css/taginfo.css
+++ b/web/public/css/taginfo.css
@@ -21,7 +21,7 @@ img.map {
border: 1px solid #b8b8b0;
}
-td img {
+td img, span.button img {
position: relative;
top: 3px;
}
diff --git a/web/public/img/turbo.png b/web/public/img/turbo.png
new file mode 100644
index 0000000..ad18cb0
--- /dev/null
+++ b/web/public/img/turbo.png
Binary files differ
diff --git a/web/views/key.erb b/web/views/key.erb
index 465227d..375a88b 100644
--- a/web/views/key.erb
+++ b/web/views/key.erb
@@ -15,6 +15,7 @@
<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 %>
+ <%= turbo_link(@filter_type, @key) %>
</div>
<h1></h1>
<p><%= @desc %></p>
diff --git a/web/views/relation.erb b/web/views/relation.erb
index fdbf149..6c120bf 100644
--- a/web/views/relation.erb
+++ b/web/views/relation.erb
@@ -6,6 +6,7 @@
<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 %>
+ <%= turbo_link('relations', 'type', @rtype) %>
</div>
<h1></h1>
<p><%= @desc %></p>
diff --git a/web/views/tag.erb b/web/views/tag.erb
index 0d36332..2c4f62c 100644
--- a/web/views/tag.erb
+++ b/web/views/tag.erb
@@ -15,6 +15,7 @@
<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 %>
+ <%= turbo_link(@filter_type, @key, @value) %>
</div>
<h1></h1>
<p><%= @desc %></p>