diff options
author | Jochen Topf <jochen@topf.org> | 2013-02-13 16:04:21 +0100 |
---|---|---|
committer | Jochen Topf <jochen@topf.org> | 2013-02-13 16:04:21 +0100 |
commit | 82eeb55f1e7a70336a15af2526b76321563f480c (patch) | |
tree | 53e430f003215c20e41ed9288031ef4d0d4b6e37 /web | |
parent | da1311e463ee6c27369be7e02a463114620c8a8f (diff) | |
download | taginfo-82eeb55f1e7a70336a15af2526b76321563f480c.tar taginfo-82eeb55f1e7a70336a15af2526b76321563f480c.tar.gz |
Add turbo link to tools
Diffstat (limited to 'web')
-rw-r--r-- | web/lib/utils.rb | 19 | ||||
-rw-r--r-- | web/public/css/taginfo.css | 2 | ||||
-rw-r--r-- | web/public/img/turbo.png | bin | 0 -> 351 bytes | |||
-rw-r--r-- | web/views/key.erb | 1 | ||||
-rw-r--r-- | web/views/relation.erb | 1 | ||||
-rw-r--r-- | web/views/tag.erb | 1 |
6 files changed, 23 insertions, 1 deletions
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 Binary files differnew file mode 100644 index 0000000..ad18cb0 --- /dev/null +++ b/web/public/img/turbo.png 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> |