translate date picker and charts (#775)

This commit is contained in:
Kevin Papst
2019-05-12 00:56:00 +02:00
committed by GitHub
parent 5f4a5364b0
commit f31118292c
10 changed files with 55 additions and 55 deletions

View File

@@ -9,33 +9,29 @@
{% endif %}
<script type="text/javascript">
var userProfileChartOptions = {
maintainAspectRatio : true,
responsive : true,
legend : false,
barPercentage : 0.5,
categoryPercentage : 0.9,
scales: {
xAxes: [{
gridLines: {
display: false
}
}],
yAxes: [{
gridLines: {
display: true,
color: 'rgba(0,0,0,.05)',
lineWidth: 1
}
}]
}
};
var userProfileChartLabels = [
{% for i in 1..12 %}
'{{ ('month.' ~i)|trans }}'
{% if not loop.last %},{% endif %}
{% endfor %}
];
function userProfileChartOptions() {
return {
maintainAspectRatio: true,
responsive: true,
legend: false,
barPercentage: 0.5,
categoryPercentage: 0.9,
scales: {
xAxes: [{
gridLines: {
display: false
}
}],
yAxes: [{
gridLines: {
display: true,
color: 'rgba(0,0,0,.05)',
lineWidth: 1
}
}]
}
};
}
</script>
{% for year,yearStat in years %}
@@ -48,9 +44,9 @@
<canvas id="userProfileChart{{ year }}" style="height: 200px;"></canvas>
</div>
<script type="text/javascript">
$(document).ready(function () {
document.addEventListener('kimai.initialized', function() {
var userProfileChartData{{ year }} = {
labels: userProfileChartLabels,
labels: moment.months(),
datasets: [
{
label: '{{ year }}',
@@ -73,7 +69,7 @@
userProfileChartCanvas{{ year }}, {
type: 'bar',
data: userProfileChartData{{ year }},
options: userProfileChartOptions
options: userProfileChartOptions()
}
);
{% endif %}
@@ -83,7 +79,7 @@
userProfileChartCanvas{{ year }}, {
type: 'bar',
data: userProfileChartData{{ year }},
options: userProfileChartOptions
options: userProfileChartOptions()
}
);
});