]> git.openstreetmap.org Git - rails.git/blob - app/views/site/id_iframe.html.erb
Fix edit links on browse and changeset pages
[rails.git] / app / views / site / id_iframe.html.erb
1 <!DOCTYPE html>
2 <html>
3 <head>
4   <meta charset='utf-8'>
5   <%= stylesheet_link_tag 'iD' %>
6   <!--[if !IE || gte IE 9]><!-->
7   <%= javascript_include_tag 'iD' %>
8   <!-- <![endif]-->
9 </head>
10 <body>
11 <div id='id-container'></div>
12 <script>
13   if (typeof iD == 'undefined') {
14     document.getElementById('id-container').innerHTML = 'This editor is supported ' +
15       'in Firefox, Chrome, Safari, Opera, and Internet Explorer 9 and above. ' +
16       'Please upgrade your browser or use Potlatch 2 to edit the map.';
17     document.getElementById('id-container').className = 'unsupported';
18   } else {
19     var id = iD()
20       .embed(true)
21       .imagePath("/assets/iD/img/")<%# Can't use asset_path('id/img/') in production. %>
22       .preauth({
23         <% token = @user.access_token(ID_KEY) %>
24         url: "<%= request.protocol + request.host_with_port %>",
25         oauth_consumer_key: "<%= token.client_application.key %>",
26         oauth_secret: "<%= token.client_application.secret %>",
27         oauth_token: "<%= token.token %>",
28         oauth_token_secret: "<%= token.secret %>"
29       });
30
31     d3.select('#id-container')
32       .call(id.ui());
33   }
34 </script>
35 </body>
36 </html>