fix: corretto issue 20 e 28. torna alla lista rimanda alla lista e non più alla pagina precedente e i link non aprono più una nuova scheda

This commit is contained in:
2026-07-13 19:34:44 +02:00
parent afe6e8d652
commit 7020112e8a
2 changed files with 7 additions and 2 deletions
+5
View File
@@ -15,6 +15,7 @@ const App = {
motivationalPhrases: [], motivationalPhrases: [],
drafts: {}, drafts: {},
tabs: [], tabs: [],
lastListView: '#/tickets',
loadTabs() { loadTabs() {
try { try {
@@ -232,6 +233,10 @@ const App = {
const hash = fullHash.split('?')[0]; const hash = fullHash.split('?')[0];
const titleEl = document.getElementById('page-title'); const titleEl = document.getElementById('page-title');
if (hash === '#/tickets' || hash === '#/tickets/my') {
this.lastListView = hash;
}
// Save draft for previous ticket before routing // Save draft for previous ticket before routing
if (typeof TicketDetailView !== 'undefined' && TicketDetailView.ticketId) { if (typeof TicketDetailView !== 'undefined' && TicketDetailView.ticketId) {
TicketDetailView.saveDraft(); TicketDetailView.saveDraft();
+2 -2
View File
@@ -60,7 +60,7 @@ const TicketDetailView = {
await App.ensureLookups(); await App.ensureLookups();
const data = await App.api(`/api/tickets/${id}`); const data = await App.api(`/api/tickets/${id}`);
const { ticket, articles, attachments } = data; const { ticket, articles, attachments } = data;
App.addTabWithoutRedirect(ticket.id, ticket.tn, ticket.title); // No automatic tab creation here anymore
let groupsData = { asMaster: [], asMember: [] }; let groupsData = { asMaster: [], asMember: [] };
try { try {
@@ -107,7 +107,7 @@ const TicketDetailView = {
const emailBtnText = hasEmailDraft ? 'Continua mail' : 'Invia Email'; const emailBtnText = hasEmailDraft ? 'Continua mail' : 'Invia Email';
container.innerHTML = ` container.innerHTML = `
<a class="back-link" onclick="history.back()"> <a class="back-link" onclick="window.location.hash = App.lastListView || '#/tickets'">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" style="width:16px;height:16px;"><path d="M19 12H5M12 19l-7-7 7-7"/></svg> <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" style="width:16px;height:16px;"><path d="M19 12H5M12 19l-7-7 7-7"/></svg>
Torna alla lista Torna alla lista
</a> </a>