Projet

Général

Profil

0001-misc-explode-address-fields-based-on-class-name-not-.patch

Frédéric Péters, 05 mai 2022 09:13

Télécharger (1,86 ko)

Voir les différences:

Subject: [PATCH] misc: explode address fields based on class name, not just
 geolocation (#64862)

 wcs/qommon/static/js/qommon.geolocation.js | 11 +++++++++++
 1 file changed, 11 insertions(+)
wcs/qommon/static/js/qommon.geolocation.js
6 6
  }
7 7
  $(selector).find('input').val(element_value);
8 8
  $(selector).find('textarea').val(element_value);
9
  $(selector).removeClass('widget-prefilled');
9 10
  var $options = $(selector).find('option');
10 11
  if ($options.length == 0) return;
11 12

  
......
28 29
}
29 30

  
30 31
function init_sync_from_template_address() {
32
  // turn address-part-- class names into geolocation attributes, this allows
33
  // address part elements to be both prefilled with some data and recognized
34
  // as parts of the address block mechanism.
35
  $('.address-part--number-and-street').attr('data-geolocation', 'number-and-street');
36
  $('.address-part--house').attr('data-geolocation', 'house');
37
  $('.address-part--road').attr('data-geolocation', 'road');
38
  $('.address-part--city').attr('data-geolocation', 'city');
39
  $('.address-part--postcode').attr('data-geolocation', 'postcode');
40
  $('.address-part--country').attr('data-geolocation', 'country');
41

  
31 42
  const widget_selector = '.JsonpSingleSelectWidget.template-address';
32 43
  const hidden_parts_selector = '.hide-address-parts';
33 44
  $(widget_selector + ' select').on('change', function() {
34
-