Dates localization

This commit is contained in:
Dmitry Khomutov 2017-01-15 17:28:15 +07:00
commit d0a46ee8ab
No known key found for this signature in database
GPG key ID: 7EB36C9576F9ECB9
17 changed files with 35 additions and 106 deletions

View file

@ -3,17 +3,7 @@ var PHPCensor = {
intervals: {},
init: function () {
// Setup the date locale
moment.locale(LANGUAGE);
$(document).ready(function () {
// Format datetimes
$('time[datetime]').each(function() {
var thisDate = $(this).attr('datetime');
var formattedDate = moment(thisDate).format($(this).data('format') || 'lll');
$(this).text(formattedDate);
});
// Update latest builds every 5 seconds:
PHPCensor.getBuilds();
PHPCensor.intervals.getBuilds = setInterval(PHPCensor.getBuilds, 5000);
@ -27,8 +17,6 @@ var PHPCensor = {
PHPCensor.intervals.getDashboard = setInterval(PHPCensor.getDashboard, 10000);
PHPCensor.intervals.getTimeline = setInterval(PHPCensor.getTimeline, 10000);
}
PHPCensor.uiUpdated();
});
$(window).on('builds-updated', function (e, data) {
@ -123,7 +111,6 @@ var PHPCensor = {
success: function (data) {
success();
PHPCensor.uiUpdated();
},
error: PHPCensor.handleFailedAjax
@ -134,28 +121,6 @@ var PHPCensor = {
if (xhr.status == 401) {
window.location.href = window.APP_URL + 'session/login';
}
},
uiUpdated: function () {
$('.duration').each(function () {
var seconds = $(this).data('duration');
if (seconds == 0) {
return;
}
$(this).text(moment.duration(seconds, 'seconds').humanize());
});
$('.datetime').each(function () {
var dateString = $(this).data('date');
if (!dateString) {
return;
}
$(this).text(moment(dateString).format('lll'));
});
}
};
@ -506,5 +471,3 @@ var Lang = {
return string;
}
};
moment.locale(LANGUAGE);

View file

@ -1,6 +1,6 @@
var codeceptionPlugin = ActiveBuild.UiPlugin.extend({
id: 'build-codeception-errors',
css: 'col-lg-12 col-md-12 col-sm-12 col-xs-12',
css: 'col-xs-12',
title: Lang.get('codeception'),
lastData: null,
lastMeta: null,

View file

@ -1,6 +1,6 @@
var phpspecPlugin = ActiveBuild.UiPlugin.extend({
id: 'build-phpspec-errors',
css: 'col-lg-12 col-md-12 col-sm-12 col-xs-12',
css: 'col-xs-12',
title: Lang.get('phpspec'),
lastData: null,
displayOnUpdate: false,

View file

@ -1,6 +1,6 @@
var phptalPlugin = ActiveBuild.UiPlugin.extend({
id: 'build-phptal',
css: 'col-lg-6 col-md-12 col-sm-12 col-xs-12',
css: 'col-xs-12',
title: 'PHPTAL Lint',
lastData: null,
box: true,
@ -25,9 +25,9 @@ var phptalPlugin = ActiveBuild.UiPlugin.extend({
return $('<div class="table-responsive"><table class="table" id="phptal-data">' +
'<thead>' +
'<tr>' +
' <th>File</th>' +
' <th>Line</th>' +
' <th>Message</th>' +
' <th>' + Lang.get('file') + '</th>' +
' <th>' + Lang.get('line') + '</th>' +
' <th>' + Lang.get('message') + '</th>' +
'</tr>' +
'</thead><tbody></tbody></table></div>');
},

View file

@ -65,8 +65,6 @@ var Build = Class.extend({
}
}
PHPCensor.uiUpdated();
});
},
@ -179,7 +177,7 @@ var Build = Class.extend({
UiPlugin: Class.extend({
id: null,
css: 'col-lg-4 col-md-6 col-sm-12 col-xs-12',
css: 'col-xs-12',
box: false,
init: function(){