some beautification to the template code

This commit is contained in:
Tobias Diekershoff 2016-01-18 17:29:46 +01:00
parent 9150ec59b5
commit 846153d388
1 changed files with 30 additions and 34 deletions

View File

@ -9,9 +9,9 @@
<p>{{$legendtext}} <p>{{$legendtext}}
<ul> <ul>
{{foreach $counts as $c}} {{foreach $counts as $c}}
{{if $c[0]['total'] > 0}} {{if $c[0]['total'] > 0}}
<li>{{$c[0]['platform']}} ({{$c[0]['total']}})</li> <li>{{$c[0]['platform']}} ({{$c[0]['total']}})</li>
{{/if}} {{/if}}
{{/foreach}} {{/foreach}}
</ul> </ul>
</p> </p>
@ -23,40 +23,36 @@ var FedData = [
{{/foreach}} {{/foreach}}
]; ];
var ctx = document.getElementById("FederationChart").getContext("2d"); var ctx = document.getElementById("FederationChart").getContext("2d");
var myDoughnutChart = new Chart(ctx).Doughnut(FedData, var myDoughnutChart = new Chart(ctx).Doughnut(FedData, { animateRotate : false, });
{
animateRotate : false,
});
document.getElementById('FederationLegend').innerHTML = myDoughnutChart.generateLegend();
</script> </script>
<table id="federation-stats"> <table id="federation-stats">
{{foreach $counts as $c}} {{foreach $counts as $c}}
{{if $c[0]['total'] > 0}} {{if $c[0]['total'] > 0}}
<tr> <tr>
<th>{{$c[0]['platform']}}</th> <th>{{$c[0]['platform']}}</th>
<th><strong>{{$c[0]['total']}}</strong></td> <th><strong>{{$c[0]['total']}}</strong></td>
<td>{{$c[0]['network']}}</td> <td>{{$c[0]['network']}}</td>
</tr> </tr>
<tr> <tr>
<td colspan="3" class="federation-data"> <td colspan="3" class="federation-data">
<canvas id="{{$c[2]}}Chart" class="federation-network-graph"></canvas> <canvas id="{{$c[2]}}Chart" class="federation-network-graph"></canvas>
<script> <script>
var {{$c[2]}}data = [ var {{$c[2]}}data = [
{{foreach $c[1] as $v}} {{foreach $c[1] as $v}}
{ value: {{$v['total']}}, label: '{{$v['version']}}', color: "#90EE90", highlight: "#EE90A1",}, { value: {{$v['total']}}, label: '{{$v['version']}}', color: "#90EE90", highlight: "#EE90A1",},
{{/foreach}} {{/foreach}}
]; ];
var ctx = document.getElementById("{{$c[2]}}Chart").getContext("2d"); var ctx = document.getElementById("{{$c[2]}}Chart").getContext("2d");
var my{{$c[2]}}DoughnutChart = new Chart(ctx).Doughnut({{$c[2]}}data, {animateRotate : false,}); var my{{$c[2]}}DoughnutChart = new Chart(ctx).Doughnut({{$c[2]}}data, {animateRotate : false,});
</script> </script>
<ul class="federation-stats"> <ul class="federation-stats">
{{foreach $c[1] as $v}} {{foreach $c[1] as $v}}
<li>{{if ($c[0]['platform']==='Friendica' and $version===$v['version']) }}<span class="version-match">{{$v['version']}}</span>{{else}}{{$v['version']}}{{/if}} ({{$v['total']}})</li> <li>{{if ($c[0]['platform']==='Friendica' and $version===$v['version']) }}<span class="version-match">{{$v['version']}}</span>{{else}}{{$v['version']}}{{/if}} ({{$v['total']}})</li>
{{/foreach}} {{/foreach}}
</ul> </ul>
</td> </td>
</tr> </tr>
{{/if}} {{/if}}
{{/foreach}} {{/foreach}}
</table> </table>