-
Notifications
You must be signed in to change notification settings - Fork 206
/
Copy path_cloud_exports.html.erb
32 lines (29 loc) · 1.91 KB
/
_cloud_exports.html.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<p><a href="https://publiclab.org/wiki/mapknitter-cloud-exporter">Using the Cloud Exporter »</a></p>
<div class="mapknitter-cloud-exports" id="cloud-exports">
<% exports.order(created_at: :desc).each_with_index do |export, i| %>
<p class="export mapknitter-cloud-export" style="font-size:11px;">
<b>Export <%= exports.count - i %>:</b>
(<a href="<%= export.export_url %>">status</a>)
</p>
<% end %>
</div>
<script>
(function() {
$('.mapknitter-cloud-exports .mapknitter-cloud-export').each(function collectExportUrls() {
var export_el = $(this);
var export_url = export_el.find('a').attr('href');
$.ajax(export_url).done(function displayExportStatus(response) {
response = JSON.parse(response);
console.log(response, response.status);
if (response.status) export_el.append(' <i class="status">' + response.status + '</i>');
if (response.jpg) export_el.append(' <span class="file"><a href="https://mapknitter-exports-warps.storage.googleapis.com/' + response.jpg.split('public/warps/')[1] + '">JPG</span>');
if (response.geotiff) export_el.append(' <span class="file"><a href="https://mapknitter-exports-warps.storage.googleapis.com/' + response.geotiff.split('public/warps/')[1] + '">GeoTiff</span>');
export_el.append('<br />');
if (response.height && response.width) export_el.append(' <span class="meta">' + response.height + 'x' + response.width + '</span>');
if (response.size) export_el.append(' <span class="meta">' + (response.size.split('B')[0]/1000000) + 'MB</span>');
if (response.zip) export_el.append(' <span class="file"><a href="https://mapknitter-exports-warps.storage.googleapis.com/' + response.zip.split('public/tms/')[1].split('.zip')[0] + "/" + response.zip.split('public/tms/')[1] + '">TMS (zip)</span>');
if (response.start_time) export_el.append(' <i class="start_time">' + response.start_time + '</i>');
});
})
})()
</script>