]> git.openstreetmap.org Git - rails.git/blobdiff - app/views/site/_id.html.erb
Fix rubocop warning
[rails.git] / app / views / site / _id.html.erb
index d94f871b7541ddeb389b85284be0922dceb084ab..0ba4200a8462ca86a245b57d26a9a6ecc8ebce56 100644 (file)
@@ -1,19 +1,10 @@
-<% if defined? ID_KEY %>
-  <iframe frameBorder="0" id="id-embed" class="id-embed"></iframe>
-  <script>
-    var coord = {};
-    <% if @lat && @lon && @zoom -%>
-    coord.lat = <%= @lat %>;
-    coord.lon = <%= @lon %>;
-    coord.zoom = <%= @zoom %>;
-    <% else -%>
-    var params = OSM.mapParams();
-    coord.lat = params.lat;
-    coord.lon = params.lon;
-    coord.zoom = params.zoom;
-    <% end -%>
-    $('#id-embed').attr('src', 'id_iframe#map=' + coord.zoom + '/' + coord.lon + '/' + coord.lat);
-  </script>
-<% else %>
-  <script type="text/javascript">alert("<%= t 'site.edit.id_not_configured' %>")</script>
-<% end %>
+<%= javascript_include_tag "edit/id" %>
+
+<div id="map" class="h-100 overflow-hidden">
+  <% data = { :configured => Settings.key?(:id_application) }
+     data[:lat] = @lat if @lat
+     data[:lon] = @lon if @lon
+     data[:gpx] = trace_data_url(params[:gpx], :format => :xml) if params[:gpx]
+     data[:url] = id_url(:locale => params[:locale]) %>
+  <%= tag.iframe "", :frameBorder => 0, :id => "id-embed", :class => "w-100 h-100", :allowfullscreen => "", :data => data %>
+</div>