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

@@ -34,7 +34,7 @@
{% if loop.first or loop.last %}
{% for id, month in year.months %}
{% if loop.first %}
{{ ('month.'~loop.index)|trans }} {{ yearName }}
moment.months({{ loop.index }}) {{ yearName }}
{% endif %}
{% endfor %}
{% endif %}
@@ -117,12 +117,7 @@
$(function () {
'use strict';
var timeChartData = {
labels : [
{% for i in 1..12 %}
'{{ ('month.' ~i)|trans }}'
{% if not loop.last %},{% endif %}
{% endfor %}
],
labels: moment.months(),
datasets: [
{% for yearName, year in chartWidget.data %}
{% set yearColors = colors[loop.index-1]|split('|') %}

View File

@@ -193,7 +193,7 @@
});
}
$(document).ready(function () {
document.addEventListener('kimai.initialized', function() {
$('body').on('click', '.exportBtn', function() {
var button = $(this);
var id = button.attr('data-timesheet');
@@ -227,7 +227,6 @@
$('#type').val('');
$form.removeAttr('target').attr('action', prevAction);
});
});
</script>
{% endblock %}

View File

@@ -93,7 +93,7 @@
{{ parent() }}
{% if is_granted('create_invoice') %}
<script type="text/javascript">
$(document).ready(function () {
document.addEventListener('kimai.initialized', function() {
$("body").on('click', '#print-invoice-button', function() {
var prevAction = $( "#invoice-print-form" ).attr('action');
$( "#invoice-print-form" ).attr('target', '_blank').attr('action', '{{ path('invoice_print') }}');

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()
}
);
});