Commit 0e5d906a authored by Olga Brani's avatar Olga Brani Committed by Alex Pyrgiotis
Browse files

admin-ui: Show date in stats download file name

Fix apyrgio/synnefo#282
parent d2ecf367
......@@ -32,6 +32,15 @@ $(document).ready(function() {
$('.stats .custom-btn').click(function(e){
var url = $(this).attr('href');
var download = $(this).attr('download');
var d = new Date();
var month = d.getMonth()+1;
var day = d.getDate();
var output = '_' + d.getFullYear() + '_' +
((''+month).length<2 ? '0' : '') + month + '_' +
((''+day).length<2 ? '0' : '') + day;
var fName = download + output;
$(this).attr('download', fName);
var spinner = $(this).parents('section').find('.spinner');
spinner.show();
$.ajax({
......
......@@ -12,11 +12,11 @@ class="active"
<div class="container stats">
<section class="clearfix">
<h3><span class="snf-user-full"></span>Astakos</h3>
<a href="{% url admin-stats-component 'astakos' %}" class="custom-btn" download="astakos-terse.json" type="application/json" title="Download terse Astakos statistics in JSON format" data-toggle="tooltip" data-placement="bottom">
<a href="{% url admin-stats-component 'astakos' %}" class="custom-btn" download="astakos-terse" type="application/json" title="Download terse Astakos statistics in JSON format" data-toggle="tooltip" data-placement="bottom">
<span class="snf-download-full"></span>
<span>Terse stats</span>
</a>
<a href="{% url admin-stats-component-details 'astakos' %}" class="custom-btn" download="astakos-details.json" type="application/json" title="Download detailed Astakos statistics in JSON format" data-toggle="tooltip" data-placement="bottom">
<a href="{% url admin-stats-component-details 'astakos' %}" class="custom-btn" download="astakos-details" type="application/json" title="Download detailed Astakos statistics in JSON format" data-toggle="tooltip" data-placement="bottom">
<span class="snf-download-full"></span>
<span>Detailed stats</span>
</a>
......@@ -29,11 +29,11 @@ class="active"
</section>
<section class="clearfix">
<h3><span class="snf-pc-full"></span>Cyclades</h3>
<a href="{% url admin-stats-component 'cyclades' %}" class="custom-btn" download="cyclades-terse.json" type="application/json" title="Download terse Cyclades statistics in JSON format" data-toggle="tooltip" data-placement="bottom">
<a href="{% url admin-stats-component 'cyclades' %}" class="custom-btn" download="cyclades-terse" type="application/json" title="Download terse Cyclades statistics in JSON format" data-toggle="tooltip" data-placement="bottom">
<span class="snf-download-full"></span>
<span>Terse stats</span>
</a>
<a href="{% url admin-stats-component-details 'cyclades' %}" class="custom-btn" download="cyclades-details.json" type="application/json" title="Download detailed Cyclades statistics in JSON format" data-toggle="tooltip" data-placement="bottom">
<a href="{% url admin-stats-component-details 'cyclades' %}" class="custom-btn" download="cyclades-details" type="application/json" title="Download detailed Cyclades statistics in JSON format" data-toggle="tooltip" data-placement="bottom">
<span class="snf-download-full"></span>
<span>Detailed stats</span>
</a>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment