Commit 0e03390c authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

Merge branch 'cherry-pick-7b4f8fd5' into 'master'

Prise en compte des accents dans les recherches (#40917)

See merge request !96
parents 40c6bb45 9c7b8e35
Loading
Loading
Loading
Loading
+2 −1
Changes for CHANGELOG.md: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -32,10 +32,11 @@ Objectif : Plafonds personnalisables

* Ajout du numéro de SIRET au niveau de la table employeur et suppression de la contrainte d'unicité sur le SIREN (Tâche #40810)

## Correction de bug
## Corrections de bugs

* Correction sur l'horodatage du service prévisionnel qui se mettait à jour lors de la création ou suppresion d'un contrat (#40925)
* Correction de bug empêchant le calcul des charges d'enseignement (#40991)
* Prise en compte des accents dans les recherches (#40917)

## Notes de mise à jour

+37
Changes for public/js/app.js: 37 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@ $(function ()
    WidgetInitializer.add('selectpicker', 'selectpicker', function () {
        WidgetInitializer.includeJs(Url('vendor/bootstrap-select-1.9.4/dist/js/bootstrap-select.min.js'));
        WidgetInitializer.includeCss(Url('vendor/bootstrap-select-1.9.4/dist/css/bootstrap-select.min.css'));
        $('.selectpicker').data('liveSearchNormalize', true); // insensible aux accents
    });

    WidgetInitializer.add('intervenant-recherche', 'intervenantRecherche', function () {
@@ -23,6 +24,42 @@ $(function ()
        WidgetInitializer.includeCss(Url('vendor/DataTables-1.10.12/media/css/dataTables.bootstrap.min.css'));

        WidgetInitializer.includeJs(Url('table-sort/widget.js'));

        (function () {

            function removeAccents(data)
            {
                if (data.normalize) {
                    // Use I18n API if avaiable to split characters and accents, then remove
                    // the accents wholesale. Note that we use the original data as well as
                    // the new to allow for searching of either form.
                    return data + ' ' + data
                        .normalize('NFD')
                        .replace(/[\u0300-\u036f]/g, '');
                }

                return data;
            }

            var searchType = jQuery.fn.DataTable.ext.type.search;

            searchType.string = function (data) {
                return !data ?
                    '' :
                    typeof data === 'string' ?
                        removeAccents(data) :
                        data;
            };

            searchType.html = function (data) {
                return !data ?
                    '' :
                    typeof data === 'string' ?
                        removeAccents(data.replace(/<.*?>/g, '')) :
                        data;
            };

        }());
    });

    /* Services */