Merge pull request #943 from openclassify/dia

#3266 Store error
This commit is contained in:
spektra2147 2021-02-09 11:31:44 +03:00 committed by GitHub
commit de6d52cfb1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,7 +13,9 @@ $('.filter-country-btn').on('click', function () {
countries = callback; countries = callback;
resetValue('country', true, false) resetValue('country', true, false)
$.each(countries, function (index, value) { $.each(countries, function (index, value) {
$('.filter-location-modal .countries').append(item('country', value.id, value.name, value.abv.toLowerCase())); $('.filter-location-modal .countries').append(
item('country', value.id, value.name, value.abv ? value.abv.toLowerCase() : '')
);
}); });
if (countries == "") if (countries == "")
$('.filter-location-modal .countries').html(null_msg); $('.filter-location-modal .countries').html(null_msg);
@ -245,22 +247,24 @@ function locationCrud(params, url, type, beforeSend, callback) {
function item(field_name, id, value, abv = '') { function item(field_name, id, value, abv = '') {
var selected = defaultCountry === id ? "checked" : ""; var selected = defaultCountry === id ? "checked" : "";
if (field_name === 'country') { if (field_name === 'country') {
return '<li class="px-2" data-id="' + id + '">\n' + return `
' <label class="w-100">\n' + <li class="px-2" data-id="${id}">
' <input' + <label class="w-100">
' type="checkbox" data-field="' + field_name + '" data-id="' + id + '" '+ selected +'>\n' + <input type="checkbox" data-field="${field_name}" data-id="${id}" ${selected}>
' <span class="flag ml-1 flag-' + abv + '">\n' + <span class="flag ml-1 flag-${abv}"></span>
' </span>\n' + <small>${value}</small>
' <small>' + value + '</small>\n' + </label>
' </label>\n' + </li>
' </li>'; `;
} else { } else {
return '<li class="px-2" data-id="' + id + '">\n' + return `
' <label class="w-100">\n' + <li class="px-2" data-id="${id}">
' <input type="checkbox" data-field="' + field_name + '" data-id="' + id + '">\n' + <label class="w-100">
' <small>' + value + '</small>\n' + <input type="checkbox" data-field="${field_name}" data-id="${id}">
' </label>\n' + <small>${value}</small>
' </li>'; </label>
</li>
`;
} }
} }