fix: ora le ricerche lavorano nuovamente in cache. feat: aggiunto pulsante per eliminare rapidamente una ricerca testuale. feat: la ricerca in alto a destra rimanda alla ricerca spudorata ed il campo viene liberato.
This commit is contained in:
1 parent
c5e17ca57a
commit
c0c8a2531c
4 files changed
+57
-54
No files matched your search
+16
-11
@@ -163,12 +163,20 @@ const App = {
|
||||
searchInput.addEventListener('keydown', (e) => {
|
||||
if (e.key === 'Enter') {
|
||||
e.preventDefault();
|
||||
const hash = window.location.hash;
|
||||
if (!hash.startsWith('#/tickets') || hash.includes('/new') || hash.match(/#\/tickets\/\d+/)) {
|
||||
window.location.hash = '#/tickets';
|
||||
const query = searchInput.value.trim();
|
||||
searchInput.value = '';
|
||||
toggleClearBtn();
|
||||
if (query) {
|
||||
const newHash = `#/ricerca-spudorata?q=${encodeURIComponent(query)}`;
|
||||
if (window.location.hash === newHash && typeof RicercaSpudorataView !== 'undefined') {
|
||||
const input = document.getElementById('spudorata-search-input');
|
||||
if (input) input.value = query;
|
||||
RicercaSpudorataView.executeSearch(query);
|
||||
} else {
|
||||
window.location.hash = newHash;
|
||||
}
|
||||
} else {
|
||||
TicketListView.currentPage = 1;
|
||||
TicketListView.render();
|
||||
window.location.hash = '#/ricerca-spudorata';
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -178,12 +186,9 @@ const App = {
|
||||
searchInput.value = '';
|
||||
searchClearBtn.style.display = 'none';
|
||||
searchInput.focus();
|
||||
const hash = window.location.hash;
|
||||
if (hash.startsWith('#/tickets') && !hash.includes('/new') && !hash.match(/#\/tickets\/\d+/)) {
|
||||
TicketListView.currentPage = 1;
|
||||
TicketListView.render();
|
||||
} else {
|
||||
window.location.hash = '#/tickets';
|
||||
if (window.location.hash.startsWith('#/ricerca-spudorata') && typeof RicercaSpudorataView !== 'undefined') {
|
||||
RicercaSpudorataView.invalidateCache();
|
||||
RicercaSpudorataView.render();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user