[chronojump-server] Date format changed in results table
- From: Marcos Venteo Garcia <mventeo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump-server] Date format changed in results table
- Date: Wed, 24 May 2017 19:15:26 +0000 (UTC)
commit 8b3cf3b217b4bc1eaf5df099a4d6ed4fc0884242
Author: Marcos Venteo García <mventeo gmail com>
Date: Wed May 24 21:15:09 2017 +0200
Date format changed in results table
chronojump-flask/templates/results.html | 74 ++++++++++++++++++++++++-------
1 files changed, 58 insertions(+), 16 deletions(-)
---
diff --git a/chronojump-flask/templates/results.html b/chronojump-flask/templates/results.html
index 83e4996..5a3a04b 100644
--- a/chronojump-flask/templates/results.html
+++ b/chronojump-flask/templates/results.html
@@ -10,7 +10,64 @@
<script type="text/javascript">
$(document).ready(function() {
// Initialize datatable with results
+ /*
+ <th>Data</th>
+ <th>Jugador</th>
+ <th>Estació</th>
+ <th>Exercici</th>
+ <th>Càrrega</th>
+ <th>n</th>
+ <th>Pèrdua</th>
+ <th>[ rep</th>
+ <th>rang</th>
+ <th>Vm</th>
+ <th>VM</th>
+ <th>Pm</th>
+ <th>PM ]</th>
+ </thead>*/
var table = $('#results').DataTable({
+ "columns" : [
+ { type : "date" , title : "Data",
+ render: function(value) {
+ // Compare with today
+ today = new Date();
+ var dd = today.getDate();
+ var mm = today.getMonth();
+ var yy = today.getFullYear();
+
+ var dt = new Date(value);
+ var dd2 = dt.getDate();
+ var mm2 = dt.getMonth();
+ var yy2 = dt.getFullYear();
+ var hh = dt.getHours();
+ var MM = dt.getMinutes();
+ if (dd == dd2 && mm == mm2 && yy == yy2) {
+ // Today, show the result hours and minute
+ return hh + ":" + MM;
+ } else if ( yy == yy2 ) {
+ // Same year
+ return dd2 + "/" + (mm2 +1) + " " + hh + ":" + MM;
+ } else {
+ return dd2 + "/" + (mm2 +1) + "/"+ yy2 + " " + hh +
":" + MM;
+ }
+
+ }
+ },
+ { type : "html" , title : "Jugador"},
+ { type : "html" , title : "Estació" },
+ { type : "html" , title: "Exercici"},
+ { type : "num" , title: "Càrrega", render: $.fn.dataTable.render.number( '',
',', 2 )},
+ { type : "num" , title: "n" },
+ { type : "num" , title: "Pèrdua" },
+ { type : "num" , title: "[rep" },
+ { type : "num" , title: "rang", render: $.fn.dataTable.render.number( '',
',', 2 )},
+ { type : "num" , title: "Vm", render: $.fn.dataTable.render.number( '', ',',
2 )},
+ { type : "num" , title: "VM", render: $.fn.dataTable.render.number( '', ',',
2 )},
+ { type : "num" , title: "Pm", render: $.fn.dataTable.render.number( '', ',',
2 )},
+ { type : "num" , title: "PM]", render: $.fn.dataTable.render.number( '', ',',
2 )}
+ ],
+ "pageLength": 25,
+ "order" : [ [ 0, 'desc' ]],
"ajax" : "/api/v1/results",
"language": {
"lengthMenu": "Mostrant _MENU_ resultats per pàgina",
@@ -44,22 +101,7 @@
</div>
<table id="results" class="table table-hovered " cellspacing="0" width="100%">
- <thead>
- <th>Data</th>
- <th>Jugador</th>
- <th>Estació</th>
- <th>Exercici</th>
- <th>Càrrega</th>
- <th>n</th>
- <th>Pèrdua</th>
- <th>[ rep</th>
- <th>rang</th>
- <th>Vm</th>
- <th>VM</th>
- <th>Pm</th>
- <th>PM ]</th>
- </thead>
- </table>
+ </table>
</div>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]