feat: Only show existing data
This commit is contained in:
parent
0c94049e21
commit
c6af3e8d04
@ -0,0 +1,8 @@
|
|||||||
|
function ifdef(variable, prefix = "", suffix = "") {
|
||||||
|
if (variable !== undefined) {
|
||||||
|
return prefix + variable + suffix;
|
||||||
|
} else {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -14,6 +14,8 @@
|
|||||||
<link href="{% static 'fontawesomefree/css/brands.css' %}" rel="stylesheet" type="text/css">
|
<link href="{% static 'fontawesomefree/css/brands.css' %}" rel="stylesheet" type="text/css">
|
||||||
<link href="{% static 'fontawesomefree/css/solid.css' %}" rel="stylesheet" type="text/css">
|
<link href="{% static 'fontawesomefree/css/solid.css' %}" rel="stylesheet" type="text/css">
|
||||||
|
|
||||||
|
<script src="{% static 'fellchensammlung/js/custom.js' %}"></script>
|
||||||
|
|
||||||
<link rel="apple-touch-icon" sizes="180x180" href="{% static 'fellchensammlung/favicon/apple-touch-icon.png' %}">
|
<link rel="apple-touch-icon" sizes="180x180" href="{% static 'fellchensammlung/favicon/apple-touch-icon.png' %}">
|
||||||
<link rel="icon" type="image/png" sizes="32x32" href="{% static 'fellchensammlung/favicon/favicon-32x32.png' %}">
|
<link rel="icon" type="image/png" sizes="32x32" href="{% static 'fellchensammlung/favicon/favicon-32x32.png' %}">
|
||||||
<link rel="icon" type="image/png" sizes="16x16" href="{% static 'fellchensammlung/favicon/favicon-16x16.png' %}">
|
<link rel="icon" type="image/png" sizes="16x16" href="{% static 'fellchensammlung/favicon/favicon-16x16.png' %}">
|
||||||
|
@ -60,12 +60,12 @@
|
|||||||
locations.forEach(location => {
|
locations.forEach(location => {
|
||||||
const listItem = document.createElement('li');
|
const listItem = document.createElement('li');
|
||||||
listItem.classList.add('result-item');
|
listItem.classList.add('result-item');
|
||||||
listItem.textContent = location.properties.name + " (" + location.properties.city+")";
|
listItem.textContent = location.properties.name + ifdef(location.properties.city, " (", ")");
|
||||||
|
|
||||||
// Add event when user clicks on a result location
|
// Add event when user clicks on a result location
|
||||||
listItem.addEventListener('click', () => {
|
listItem.addEventListener('click', () => {
|
||||||
|
|
||||||
locationInput.value = location.properties.name + ", " + location.properties.city + ", " + location.properties.country; // Set input field to selected location
|
locationInput.value = location.properties.name +ifdef(location.properties.city, ", ", "") + ifdef(location.properties.country, ", ", ""); // Set input field to selected location
|
||||||
resultsList.innerHTML = ''; // Clear the results after selecting a location
|
resultsList.innerHTML = ''; // Clear the results after selecting a location
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user