Projet

Général

Profil

0001-misc-add-autocompletion-support-for-separated-number.patch

Frédéric Péters, 29 novembre 2020 10:56

Télécharger (2,2 ko)

Voir les différences:

Subject: [PATCH] misc: add autocompletion support for separated number and
 street fields (#48918)

 .../static/authentic2/js/address_autocomplete.js  | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
src/authentic2/static/authentic2/js/address_autocomplete.js
32 32
            } else {
33 33
                number_and_street = road;
34 34
            }
35
            $('#id_address').val(number_and_street);
35
            if ($('#id_house_number')) {
36
                $('#id_house_number').val(house_number);
37
                $('#id_address').val(road);
38
            } else {
39
                $('#id_address').val(number_and_street);
40
            }
36 41
            $('#id_city').val(city);
37 42
            $('#id_zipcode').val(postcode);
38 43
        }
39 44
    });
40
    $('#id_address, #id_city, #id_zipcode').attr('readonly', 'readonly');
45
    $('#id_house_number, #id_address, #id_city, #id_zipcode').attr('readonly', 'readonly');
41 46
    $('#manual-address').on('change', function() {
42
        $('#id_address, #id_city, #id_zipcode').attr('readonly', this.checked ? null : 'readonly');
47
        $('#id_house_number, #id_address, #id_city, #id_zipcode').attr('readonly', this.checked ? null : 'readonly');
43 48
    });
44
    if ($('#id_address').val() || $('#id_city').val() || $('#id_zipcode').val()) {
49
    if ($('#id_house_number').val() || $('#id_address').val() || $('#id_city').val() || $('#id_zipcode').val()) {
45 50
        var data = {
46 51
            id: 1,
47 52
            text: ''
48 53
        }
49
        $.each(['#id_address', '#id_zipcode', '#id_city'], function(idx, value) {
54
        $.each(['#id_house_number', '#id_address', '#id_zipcode', '#id_city'], function(idx, value) {
50 55
            if ($(value).val()) {
51 56
                if (data.text) {
52 57
                    data.text += ' ';
53
-