Fase 3 feedback round 3: sidebar icons, thumbnail preview, location search
- Sidebar submenu bullets (List all/Add new/Batch create) swapped from far fa-circle to fas fa-angle-right - the outlined circle read as an unchecked radio button, per feedback. - List-page qr thumbnails now sit in a fixed 100x100 box with object-fit:contain instead of width/height attrs, so taller images (e.g. icon-above-qr) no longer get squashed into a square. Thumbnails are now clickable, opening a shared Bootstrap modal with the full-size image (same data-toggle/data-target pattern already used for the delete-confirmation modal). - Location QR form gets an address search box backed by OpenStreetMap Nominatim (dist/js/location-search.js): free-text query, pick a result, it fills in latitude/longitude. No API key needed; the browser talks to nominatim.openstreetmap.org directly, called out in the field's help text since queries leave the self-hosted server. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Fo3DiRRpmz2DXjD7Uzhc8u
This commit is contained in:
Vendored
+17
@@ -6,4 +6,21 @@
|
||||
#err-msg {
|
||||
display: none;
|
||||
color: red;
|
||||
}
|
||||
|
||||
/* List-page qr code thumbnails: fixed box, but object-fit:contain instead of
|
||||
width/height attrs so taller images (e.g. icon-above-qr) don't get squashed. */
|
||||
.qr-thumb-link {
|
||||
display: inline-block;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
background: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
.qr-thumb-img {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
object-fit: contain;
|
||||
background: #fff;
|
||||
border: 1px solid #dee2e6;
|
||||
}
|
||||
Vendored
+69
@@ -0,0 +1,69 @@
|
||||
(function () {
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
var searchInput = document.getElementById('location_search');
|
||||
var searchBtn = document.getElementById('location_search_btn');
|
||||
var resultsBox = document.getElementById('location_search_results');
|
||||
var latInput = document.getElementById('latitude');
|
||||
var lngInput = document.getElementById('longitude');
|
||||
|
||||
if (!searchInput || !searchBtn || !resultsBox || !latInput || !lngInput) {
|
||||
return;
|
||||
}
|
||||
|
||||
function clearResults() {
|
||||
resultsBox.innerHTML = '';
|
||||
}
|
||||
|
||||
function doSearch() {
|
||||
var query = searchInput.value.trim();
|
||||
if (!query) {
|
||||
return;
|
||||
}
|
||||
|
||||
clearResults();
|
||||
resultsBox.innerHTML = '<div class="list-group-item">Searching...</div>';
|
||||
|
||||
fetch('https://nominatim.openstreetmap.org/search?format=json&limit=5&q=' + encodeURIComponent(query))
|
||||
.then(function (response) { return response.json(); })
|
||||
.then(function (results) {
|
||||
clearResults();
|
||||
|
||||
if (!results.length) {
|
||||
resultsBox.innerHTML = '<div class="list-group-item">No results found.</div>';
|
||||
return;
|
||||
}
|
||||
|
||||
results.forEach(function (place) {
|
||||
var item = document.createElement('button');
|
||||
item.type = 'button';
|
||||
item.className = 'list-group-item list-group-item-action';
|
||||
item.textContent = place.display_name;
|
||||
item.addEventListener('click', function () {
|
||||
latInput.value = place.lat;
|
||||
lngInput.value = place.lon;
|
||||
searchInput.value = place.display_name;
|
||||
clearResults();
|
||||
});
|
||||
resultsBox.appendChild(item);
|
||||
});
|
||||
})
|
||||
.catch(function () {
|
||||
resultsBox.innerHTML = '<div class="list-group-item text-danger">Search failed (network error).</div>';
|
||||
});
|
||||
}
|
||||
|
||||
searchBtn.addEventListener('click', doSearch);
|
||||
searchInput.addEventListener('keydown', function (e) {
|
||||
if (e.key === 'Enter') {
|
||||
e.preventDefault();
|
||||
doSearch();
|
||||
}
|
||||
});
|
||||
|
||||
document.addEventListener('click', function (e) {
|
||||
if (e.target !== searchInput && !resultsBox.contains(e.target)) {
|
||||
clearResults();
|
||||
}
|
||||
});
|
||||
});
|
||||
})();
|
||||
Reference in New Issue
Block a user