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

@@ -24,6 +24,7 @@ require('moment/locale/ar');
require('moment/locale/hu');
require('moment/locale/pt-br');
require('moment/locale/sv');
require('moment/locale/ja');
require('daterangepicker');
@@ -55,6 +56,7 @@ require('fullcalendar/dist/locale/ar');
require('fullcalendar/dist/locale/hu');
require('fullcalendar/dist/locale/pt-br');
require('fullcalendar/dist/locale/sv');
require('fullcalendar/dist/locale/ja');
require('fullcalendar/dist/fullcalendar.min.css');
// ------ for charts ------

View File

@@ -11,6 +11,7 @@
import jQuery from 'jquery';
import KimaiPlugin from '../KimaiPlugin';
import moment from 'moment';
export default class KimaiDatePicker extends KimaiPlugin {
@@ -40,7 +41,9 @@ export default class KimaiDatePicker extends KimaiPlugin {
firstDay: 1,
applyLabel: translator.get('apply'),
cancelLabel: translator.get('cancel'),
customRangeLabel: translator.get('customRange')
customRangeLabel: translator.get('customRange'),
daysOfWeek: moment.weekdaysShort(),
monthNames: moment.months(),
}
});

View File

@@ -9,9 +9,9 @@
* [KIMAI] KimaiDateRangePicker: activate the (daterange picker) compound field in toolbar
*/
import moment from 'moment';
import jQuery from 'jquery';
import KimaiPlugin from '../KimaiPlugin';
import moment from 'moment';
export default class KimaiDateRangePicker extends KimaiPlugin {
@@ -55,7 +55,9 @@ export default class KimaiDateRangePicker extends KimaiPlugin {
firstDay: 1,
applyLabel: translator.get('apply'),
cancelLabel: translator.get('cancel'),
customRangeLabel: translator.get('customRange')
customRangeLabel: translator.get('customRange'),
daysOfWeek: moment.weekdaysShort(),
monthNames: moment.months(),
},
ranges: rangesList,
alwaysShowCalendars: true

View File

@@ -11,6 +11,7 @@
import jQuery from 'jquery';
import KimaiPlugin from '../KimaiPlugin';
import moment from 'moment';
export default class KimaiDateTimePicker extends KimaiPlugin {
@@ -44,7 +45,9 @@ export default class KimaiDateTimePicker extends KimaiPlugin {
firstDay: 1,
applyLabel: translator.get('apply'),
cancelLabel: translator.get('cancel'),
customRangeLabel: translator.get('customRange')
customRangeLabel: translator.get('customRange'),
daysOfWeek: moment.weekdaysShort(),
monthNames: moment.months(),
}
});

File diff suppressed because one or more lines are too long

View File

@@ -1,5 +1,5 @@
{
"build/app.js": "./app.js?090616bfede72650dab6",
"build/app.js": "./app.js?3d071111186a7bfc7ee4",
"build/app.css": "./app.css?71bf2f49930d41eb83d61ba95a3c9eb2",
"build/fonts/fa-solid-900.woff2": "./fonts/fa-solid-900.woff2?e8a92a29",
"build/images/fa-solid-900.svg": "./images/fa-solid-900.svg?666a82cb",

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,7 +9,8 @@
{% endif %}
<script type="text/javascript">
var userProfileChartOptions = {
function userProfileChartOptions() {
return {
maintainAspectRatio: true,
responsive: true,
legend: false,
@@ -30,12 +31,7 @@
}]
}
};
var userProfileChartLabels = [
{% for i in 1..12 %}
'{{ ('month.' ~i)|trans }}'
{% if not loop.last %},{% endif %}
{% endfor %}
];
}
</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()
}
);
});