diff options
author | Jochen Topf <jochen@topf.org> | 2014-05-14 15:58:59 +0200 |
---|---|---|
committer | Jochen Topf <jochen@topf.org> | 2014-05-14 15:58:59 +0200 |
commit | 90255cc4e9044f821f23d6881e883908c45eb6bb (patch) | |
tree | 4965b73f8fe28a56bf55b814de949ba5ecf12281 /web/views/tag.erb | |
parent | f91e3bdce425be9a839687a2f13c3c10a2e96838 (diff) | |
download | taginfo-90255cc4e9044f821f23d6881e883908c45eb6bb.tar taginfo-90255cc4e9044f821f23d6881e883908c45eb6bb.tar.gz |
Add "Level0 Editor" button to key and tag pages.
This allows easy editing of tags, for instance when there are typos. If you
click on this link an Overpass API call will be made to find the object IDs for
the objects with this key/tag and then the Level0 editor will be opened in a
new window with those objects. To not overwhelm the Overpass API or the Level0
editor, the link will only be active if there are less then a configurable
number of objects with the given key/tags.
Diffstat (limited to 'web/views/tag.erb')
-rw-r--r-- | web/views/tag.erb | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/web/views/tag.erb b/web/views/tag.erb index 0e1cf76..ad74217 100644 --- a/web/views/tag.erb +++ b/web/views/tag.erb @@ -16,6 +16,11 @@ <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) %> + <% if @count_all <= TaginfoConfig.get('level0.max_results', 10) %> + <%= level0_link() %> + <% else %> + <span class="button disabled" title="Button disabled, because there are too many objects with this key">Level0 Editor</span> + <% end %> </div> <h1></h1> <p><%= @desc %></p> @@ -102,13 +107,18 @@ <% javascript do JS.raw(<<"JAVASCRIPT") function page_init2() { - var key = #{ @key.to_json }, + var filter = #{ @filter_type.to_json }, + key = #{ @key.to_json }, value = #{ @value.to_json }; up = function() { window.location = url_for_key(key); }; jQuery('h1').html(link_to_key(key) + '=' + fmt_value(value)); jQuery('span#keylink').html(link_to_key(key)); jQuery('span#relationlink').html(link_to_rtype(value)); - init_tabs([key, value, #{ @filter_type.to_json }]); + jQuery('#level0_button').bind('click', function() { + level0_editor('#{ TaginfoConfig.get('level0.overpass_url_prefix') }', '#{ TaginfoConfig.get('level0.level0_url_prefix') }', filter, key, undefined); + }); + + init_tabs([key, value, filter]); } JAVASCRIPT end |