From 82eeb55f1e7a70336a15af2526b76321563f480c Mon Sep 17 00:00:00 2001 From: Jochen Topf Date: Wed, 13 Feb 2013 16:04:21 +0100 Subject: Add turbo link to tools --- web/lib/utils.rb | 19 +++++++++++++++++++ web/public/css/taginfo.css | 2 +- web/public/img/turbo.png | Bin 0 -> 351 bytes web/views/key.erb | 1 + web/views/relation.erb | 1 + web/views/tag.erb | 1 + 6 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 web/public/img/turbo.png (limited to 'web') 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) '' + external_link('josm_button', 'JOSM', 'http://localhost:8111/import?url=' + Rack::Utils::escape(xapi_url(element, key, value)), true) + '' 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 '' + external_link('turbo_button', '', url, true) + '' +end + def external_link(id, title, link, new_window=false) target = new_window ? 'target="_blank" ' : '' %Q{#{title}} 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 Binary files /dev/null and b/web/public/img/turbo.png 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 @@ XAPI JOSM <% end %> + <%= turbo_link(@filter_type, @key) %>

<%= @desc %>

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 @@ XAPI JOSM <% end %> + <%= turbo_link('relations', 'type', @rtype) %>

<%= @desc %>

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 @@ XAPI JOSM <% end %> + <%= turbo_link(@filter_type, @key, @value) %>

<%= @desc %>

-- cgit v1.2.3