This commit is contained in:
6
public/data/cities/AB.js
Normal file
6
public/data/cities/AB.js
Normal file
@@ -0,0 +1,6 @@
|
||||
const CITIES_AB = [
|
||||
"Сухум", "Гагра", "Гудаута", "Пицунда", "Новый Афон",
|
||||
"Очамчыра", "Ткуарчал", "Гал", "Мгудзырхуа", "Цандрыпш",
|
||||
"Гюльрыпш", "Бзыбь", "Лдзаа", "Алахадзы", "Эшера",
|
||||
"Агудзера", "Приморское", "Дурипш", "Лыхны", "Отхара"
|
||||
];
|
||||
@@ -152,47 +152,6 @@ function populateCountrySelect() {
|
||||
select.appendChild(opt);
|
||||
});
|
||||
|
||||
const popularCodes = popularCountriesCache.map(c => c.country_code);
|
||||
const popularCountries = [];
|
||||
const otherCountries = [];
|
||||
|
||||
countriesCache.forEach(country => {
|
||||
if (PINNED_CODES.includes(country.code)) return;
|
||||
if (popularCodes.includes(country.code)) {
|
||||
popularCountries.push(country);
|
||||
} else {
|
||||
otherCountries.push(country);
|
||||
}
|
||||
});
|
||||
|
||||
otherCountries.sort((a, b) => {
|
||||
const nameA = I18n.currentLang === 'ru' ? a.nameRu : a.name;
|
||||
const nameB = I18n.currentLang === 'ru' ? b.nameRu : b.name;
|
||||
return nameA.localeCompare(nameB);
|
||||
});
|
||||
|
||||
if (popularCountries.length > 0) {
|
||||
const popularGroup = document.createElement('optgroup');
|
||||
popularGroup.label = I18n.t('select.popular');
|
||||
popularCountries.forEach(country => {
|
||||
const opt = document.createElement('option');
|
||||
opt.value = country.code;
|
||||
opt.textContent = I18n.currentLang === 'ru' ? country.nameRu : country.name;
|
||||
popularGroup.appendChild(opt);
|
||||
});
|
||||
select.appendChild(popularGroup);
|
||||
}
|
||||
|
||||
const otherGroup = document.createElement('optgroup');
|
||||
otherGroup.label = I18n.t('select.alphabetical');
|
||||
otherCountries.forEach(country => {
|
||||
const opt = document.createElement('option');
|
||||
opt.value = country.code;
|
||||
opt.textContent = I18n.currentLang === 'ru' ? country.nameRu : country.name;
|
||||
otherGroup.appendChild(opt);
|
||||
});
|
||||
select.appendChild(otherGroup);
|
||||
|
||||
const otherCountryOpt = document.createElement('option');
|
||||
otherCountryOpt.value = '__other__';
|
||||
otherCountryOpt.textContent = I18n.t('form.another_country');
|
||||
|
||||
Reference in New Issue
Block a user