translate datatable

This commit is contained in:
ziirish 2016-09-01 08:41:09 +02:00
parent 252c025a94
commit f8ae8d6175
6 changed files with 55 additions and 13 deletions

View file

@ -0,0 +1,22 @@
{
"sProcessing": "Traitement en cours...",
"sSearch": "Rechercher :",
"sLengthMenu": "Afficher _MENU_ éléments",
"sInfo": "Affichage de l'élément _START_ à _END_ sur _TOTAL_ éléments",
"sInfoEmpty": "Affichage de l'élément 0 à 0 sur 0 élément",
"sInfoFiltered": "(filtré de _MAX_ éléments au total)",
"sInfoPostFix": "",
"sLoadingRecords": "Chargement en cours...",
"sZeroRecords": "Aucun élément à afficher",
"sEmptyTable": "Aucune donnée disponible dans le tableau",
"oPaginate": {
"sFirst": "Premier",
"sPrevious": "Précédent",
"sNext": "Suivant",
"sLast": "Dernier"
},
"oAria": {
"sSortAscending": ": activer pour trier la colonne par ordre croissant",
"sSortDescending": ": activer pour trier la colonne par ordre décroissant"
}
}

View file

@ -27,8 +27,10 @@
* ]
* The JSON is then parsed into a table
*/
{% import 'macros.html' as macros %}
var _client_table = $('#table-client').dataTable( {
{{ macros.translate_datatable() }}
{% if session.pageLength -%}
pageLength: {{ session.pageLength }},
{% endif -%}

View file

@ -41,8 +41,10 @@ var __date = {
* ]
* The JSON is then parsed into a table
*/
{% import 'macros.html' as macros %}
var _clients_table = $('#table-clients').dataTable( {
{{ macros.translate_datatable() }}
{% if session.pageLength -%}
pageLength: {{ session.pageLength }},
{% endif -%}

View file

@ -8,7 +8,9 @@
* _servers: function that retrieve up-to-date informations from the burp server
* The JSON is then parsed into a table
*/
{% import 'macros.html' as macros %}
var _servers_table = $('#table-servers').dataTable( {
{{ macros.translate_datatable() }}
responsive: true,
ajax: {
url: '{{ url_for("api.servers_stats") }}',

View file

@ -437,16 +437,5 @@ app.controller('ConfigCtrl', ['$scope', '$http', '$scrollspy', function($scope,
};
}]);
// Add a smooth scrolling to anchor
$(document).ready(function() {
$('a[href^="#"]').click(function() {
var target = $(this.hash);
if (target.length == 0) target = $('a[name="' + this.hash.substr(1) + '"]');
if (target.length == 0) target = $('html');
$('html, body').animate({ scrollTop: target.offset().top }, 500);
return false;
});
$(".dropdown-menu label, .dropdown-menu input, .dropdown-menu li").click(function(e) {
e.stopPropagation();
});
});
{% import 'macros.html' as macros %}
{{ macros.smooth_scrolling() }}

View file

@ -97,3 +97,28 @@
<button type="submit" class="{{ btn_class }}">{{ action_text }} </button>
</form>
{%- endmacro %}
{% macro smooth_scrolling() -%}
// Add a smooth scrolling to anchor
$(document).ready(function() {
$('a[href^="#"]').click(function() {
var target = $(this.hash);
if (target.length == 0) target = $('a[name="' + this.hash.substr(1) + '"]');
if (target.length == 0) target = $('html');
$('html, body').animate({ scrollTop: target.offset().top }, 500);
return false;
});
$(".dropdown-menu label, .dropdown-menu input, .dropdown-menu li").click(function(e) {
e.stopPropagation();
});
});
{%- endmacro %}
{# Loads the datatable translation if needed #}
{% macro translate_datatable() -%}
{% if g.locale and g.locale != 'en' -%}
language: {
url: '{{ url_for("static", filename="extra/i18n/datatable-{}.json".format(g.locale)) }}'
},
{% endif -%}
{%- endmacro %}