Self-hosted project management for devs and their clients: tickets, time tracking, docs and meetings, with an AI assistant that cites its sources. AGPL-3.0.
Ruby agplai-assistantdockerdsgvogdprhotwireissue-trackerjira-alternativeknowledge-basellmmcp-servermeeting-notesopen-sourceproject-managementredmine-alternativeruby-on-railsself-hostedticketingtime-tracking
Let a lane of another list take the list state, and close a lane whose object is gone
Guido Boykea4bc7f9aa466
diff --git a/app/javascript/application.js b/app/javascript/application.jsindex 708f30d..a3746f0 100644--- a/app/javascript/application.js+++ b/app/javascript/application.js@@ -116,6 +116,13 @@ Turbo.StreamActions.replaceAddress = function () {document.dispatchEvent(new CustomEvent("lane:restored"));};+// The object of the open lane is gone (a meeting deleted in it): the page's+// layout-toggle closes the lane and takes it out of the address+// (layout_toggle#closeLane). The target names the lane's frame.+Turbo.StreamActions.closeLane = function () {+ document.dispatchEvent(new CustomEvent("lane:close", { detail: { frameId: this.target } }));+};+// Stores the most recent Turbo requests in order to detect duplicatesconst recentTurboRequests = new Map();diff --git a/app/javascript/controllers/CLAUDE.md b/app/javascript/controllers/CLAUDE.mdindex 7eced8a..ee2128c 100644--- a/app/javascript/controllers/CLAUDE.md+++ b/app/javascript/controllers/CLAUDE.md@@ -1,4 +1,4 @@-# Karte: app/javascript/controllers (Stand: 2026-09-30)+# Karte: app/javascript/controllers (Stand: 2026-10-17)~109 Stimulus-Controller, bewusst FLACH gehalten: Unterordner würden via`eagerLoadControllersFrom` alle Identifier ändern (`meetings/row_controller.js` →@@ -382,6 +382,14 @@ die Sidebar-Zeile liegt in der Navigation. Damit sind sie NICHT im selben Stimul⚠️ Die Doppel-Sperre in `application.js` schlüsselt seitdem auf Methode + Ziel-Frame,nicht nur auf die Adresse: der Reload-GET des Boards nach „+ Ticket" wäre sonst im500-ms-Fenster verschluckt worden.+- **Bahn einer fremden Liste** (17.10.2026, „Alle Meetings“, PR 3): die Übersicht zeigt das+ Meeting eines Projekts in ihrer Bahn. `layout_toggle#syncFilterContext` gibt den Listenzustand+ nur Links und Formularen unter dem Index der Seite (`data-index-url`) UND unter dem Index, den+ der Kopf der Bahn nennt (`data-lane-index-url`, Regel in `lib/lane/filter_context.js`,+ node:test). Ohne den zweiten behielten Bearbeiten und Speichern den Filter vom Öffnen. Ein+ Löschen in der Bahn schickt `closeLane` (application.js): `layout_toggle#closeLane` schließt+ und nimmt `meeting_id` im SELBEN Eintrag aus der Adresse. `list_address` ist gelöscht, die+ Übersicht hat wie die Projektseite EINEN Adress-Schreiber (`layout_toggle#syncUrlFromFrame`).## Mobile Anwendung (PR #807)diff --git a/app/javascript/controllers/layout_toggle_controller.js b/app/javascript/controllers/layout_toggle_controller.jsindex 4f87021..00dc952 100644--- a/app/javascript/controllers/layout_toggle_controller.js+++ b/app/javascript/controllers/layout_toggle_controller.js@@ -1,5 +1,6 @@import { Controller } from "@hotwired/stimulus"import { readLaneParams, laneParamNames } from "lane/params"+import { controlIndexPath, indexPaths } from "lane/filter_context"// The fixed-height list/detail grids (Tickets table, Knowledge, Meetings) fill the// viewport instead of carrying a hardcoded `calc(100vh - <magic>)` height. The bottom@@ -117,6 +118,11 @@ export default class extends Controller {this.element.addEventListener('click', this.boundSyncFilterContext, true)this.element.addEventListener('submit', this.boundSyncFilterContext, true)+ // A write that ends the lane's object (a deleted meeting) closes the lane+ // through the closeLane stream action (application.js).+ this.boundCloseLane = this.closeLane.bind(this)+ document.addEventListener('lane:close', this.boundCloseLane)+// ESC key closes content panelthis.boundCloseOnEscape = this.closeOnEscape.bind(this)document.addEventListener('keydown', this.boundCloseOnEscape)@@ -132,6 +138,7 @@ export default class extends Controller {document.removeEventListener('turbo:before-stream-render', this.boundHandleListStream)this.element.removeEventListener('click', this.boundSyncFilterContext, true)this.element.removeEventListener('submit', this.boundSyncFilterContext, true)+ document.removeEventListener('lane:close', this.boundCloseLane)document.removeEventListener('keydown', this.boundCloseOnEscape)window.removeEventListener('resize', this.boundScheduleGridHeight)if (this._gridHeightRaf) cancelAnimationFrame(this._gridHeightRaf)@@ -256,22 +263,26 @@ export default class extends Controller {// A frame refresh leaves the page head and an open form in place. Refresh// their URLs and hidden filters; repeat before clicks/submits for controls- // subsequently inserted by Turbo streams. Only this index's routes opt in.+ // subsequently inserted by Turbo streams. Only this index's routes opt in,+ // and those of the index a lane head names (data-lane-index-url): the lane+ // of "Alle Meetings" shows a project's meeting (lib/lane/filter_context).syncFilterContext(current) {if (!this.listFilterParamsValue.length || !this.element.dataset.indexUrl) return- const index = new URL(this.element.dataset.indexUrl, current.origin)+ const laneIndexUrls = [...this.element.querySelectorAll('[data-lane-index-url]')].map(head => head.dataset.laneIndexUrl)+ const indexes = indexPaths(this.element.dataset.indexUrl, laneIndexUrls, current.origin)for (const control of this.element.querySelectorAll('a[href], form[action], button[formaction]')) {const isForm = control.tagName === 'FORM'if (isForm && control.method.toLowerCase() === 'get') continueconst attribute = isForm ? 'action' : control.tagName === 'BUTTON' ? 'formaction' : 'href'const address = new URL(control.getAttribute(attribute), current.origin)const path = address.pathname.replace(/\.turbo_stream$/, '')- if (address.origin !== index.origin || !(path === index.pathname || path.startsWith(`${index.pathname}/`))) continue+ const index = controlIndexPath(path, indexes)+ if (address.origin !== current.origin || !index) continue// List links intentionally change page, sort or view. Only explicit lane// return links inherit the current list state at the index route.- if (control.tagName === 'A' && path === index.pathname && !control.matches('[data-lane-back], [data-form-lane-back], [data-lane-close]')) continue+ if (control.tagName === 'A' && path === index && !control.matches('[data-lane-back], [data-form-lane-back], [data-lane-close]')) continueconst previousInputs = new URLSearchParams()if (isForm) control.querySelectorAll('input[type="hidden"]').forEach(input => previousInputs.append(input.name, input.value))@@ -388,6 +399,18 @@ export default class extends Controller {this.updateLayout()}+ // The lane's object is gone: close as the ✕ does, and take its names out of+ // the address in the SAME entry. A new entry would let Back reopen it.+ closeLane() {+ const currentUrl = new URL(window.location.href)+ const names = this.laneStateNames+ if (names.some(param => currentUrl.searchParams.has(param))) {+ names.forEach(param => currentUrl.searchParams.delete(param))+ window.history.replaceState(window.history.state || { lane: true }, '', currentUrl.toString())+ }+ this.closeContent({ history: false })+ }+closeContent({ history = true } = {}) {// Mobile renders either list OR detail on the server. There is no hidden// list column for updateLayout() to reveal, so closing must visit the indexdiff --git a/app/javascript/controllers/list_address_controller.js b/app/javascript/controllers/list_address_controller.jsdeleted file mode 100644index 431d9b2..0000000--- a/app/javascript/controllers/list_address_controller.js+++ /dev/null@@ -1,56 +0,0 @@-import { Controller } from "@hotwired/stimulus"-import { listAddress } from "list_address"--/**- * List Address Controller- *- * Keeps the address of a list page without a lane ("Alle Meetings") equal to- * the list it shows. Whenever the list frame is loaded (filter bar, column head,- * page link) or replaced by a stream (a save from the "+" modal), the address- * becomes the page's path with the state the frame rendered. The entry is- * replaced, not added, and keeps its history state; lane:list-changed tells- * index-page which list part the page now shows (its Back/Forward restorer).- *- * Values:- * frame the id of the list frame- * path the page's path, without query- */-export default class extends Controller {- static values = { frame: String, path: String }-- connect() {- this.handleFrameLoad = this.handleFrameLoad.bind(this)- this.handleStream = this.handleStream.bind(this)- document.addEventListener("turbo:frame-load", this.handleFrameLoad)- document.addEventListener("turbo:before-stream-render", this.handleStream)- }-- disconnect() {- document.removeEventListener("turbo:frame-load", this.handleFrameLoad)- document.removeEventListener("turbo:before-stream-render", this.handleStream)- }-- handleFrameLoad(event) {- if (event.target.id === this.frameValue) this.sync()- }-- handleStream(event) {- if (event.target.getAttribute("target") !== this.frameValue) return-- const render = event.detail.render- event.detail.render = async (stream) => {- await render(stream)- this.sync()- }- }-- sync() {- const frame = document.getElementById(this.frameValue)- const state = frame && frame.querySelector("[data-list-filter-query]")- const address = listAddress(this.pathValue, state ? state.dataset.listFilterQuery : undefined)- if (!address) return-- window.history.replaceState(window.history.state || { lane: true }, "", address)- this.element.dispatchEvent(new CustomEvent("lane:list-changed", { bubbles: true }))- }-}diff --git a/app/javascript/lib/lane/filter_context.js b/app/javascript/lib/lane/filter_context.jsnew file mode 100644index 0000000..f2e656c--- /dev/null+++ b/app/javascript/lib/lane/filter_context.js@@ -0,0 +1,30 @@+// Which controls of a list page with a lane take the list state when the list+// changes beside an open lane (layout_toggle#syncFilterContext). Pure, so the+// rule can be said without a browser (spec/javascript/lib/lane).+//+// A control belongs to an index when its path is the index or lies below it:+// the page's own index (data-index-url on the wrapper) and, on a page whose+// lane is another list's detail, the index the lane names on its head+// (data-lane-index-url). "Alle Meetings" shows a project's meeting in its+// lane: its edit, delete and search switch live below that project's meetings+// index, not below the overview's, and without the second index they kept the+// state the list had when the lane was opened (doc/meetings_uebersicht_vereinheitlichen_plan.md,+// PR 3). Any other control (a ticket a meeting links to) is left alone: the+// list state of one list means nothing to another one.++// The index pathname a control belongs to, or null. The first match wins; a+// control's path ending in .turbo_stream counts as the path without it.+export function controlIndexPath(path, indexPaths) {+ const plain = path.replace(/\.turbo_stream$/, "")+ for (const index of indexPaths) {+ if (index && (plain === index || plain.startsWith(`${index}/`))) return index+ }+ return null+}++// The index pathnames of a page: its own, then each one a lane head names,+// without repeats (on the project page both are the same).+export function indexPaths(pageIndexUrl, laneIndexUrls, origin) {+ const paths = [pageIndexUrl, ...laneIndexUrls].filter(Boolean).map((url) => new URL(url, origin).pathname)+ return [...new Set(paths)]+}diff --git a/app/javascript/lib/list_address.js b/app/javascript/lib/list_address.jsdeleted file mode 100644index 75bfbff..0000000--- a/app/javascript/lib/list_address.js+++ /dev/null@@ -1,19 +0,0 @@-// What: the address of a list page without a lane ("Alle Meetings") after its-// list frame loaded: the page's path with the list state the server rendered-// (data-list-filter-query, Meetings::ListState).-// Why: a column head, a page link and the "+" modal reload only the frame.-// The filter bar reads sort and the open view from window.location, so an-// address left behind loses the sort on the next filter and the page on a-// reload. The project page does the same in layout_toggle#syncUrlFromFrame,-// which also keeps the lane's own parameters; this page has no lane.-//-// Null when the frame rendered no state (an error page): the address stays.-export function listAddress(path, renderedQuery) {- if (!path || renderedQuery === undefined || renderedQuery === null) return null-- const query = new URLSearchParams(renderedQuery)- if (query.get('page') === '1') query.delete('page')- const search = query.toString()-- return search ? `${path}?${search}` : path-}diff --git a/config/importmap.rb b/config/importmap.rbindex dda9f86..c9b2581 100644--- a/config/importmap.rb+++ b/config/importmap.rb@@ -23,8 +23,6 @@ pin 'time_session_modal', to: 'lib/time_session_modal.js'# predicate, pure so spec/javascript can test them independently of the mobile# browser regressions that also run in CI.pin 'meeting_modal', to: 'lib/meeting_modal.js'-# The address of a list page without a lane after its frame loaded ("Alle Meetings").-pin 'list_address', to: 'lib/list_address.js'# NeoAutosuggest's server search (the ticket picker of the "Link" modal): confirmed# choice, request sequence, debounce and abort, pure so spec/javascript can test them.pin 'autosuggest_search', to: 'lib/autosuggest_search.js'@@ -43,9 +41,11 @@ pin 'column_picker/order', to: 'lib/column_picker/order.js'pin 'assignee_menu/diff', to: 'lib/assignee_menu/diff.js'pin 'kanban/keyboard', to: 'lib/kanban/keyboard.js'pin 'list_row/address', to: 'lib/list_row/address.js'-# The lane's parameter groups and what Back restores (doc/dateivorschau_plan.md, D9 and D2).+# The lane's parameter groups and what Back restores (doc/dateivorschau_plan.md, D9 and D2),+# and which controls take the list state beside an open lane (filter_context).pin 'lane/params', to: 'lib/lane/params.js'pin 'lane/history', to: 'lib/lane/history.js'+pin 'lane/filter_context', to: 'lib/lane/filter_context.js'# The document forms' drop zone: the title a file suggests (S4 of doc/dokumentansicht_plan.md).pin 'upload_zone/title', to: 'lib/upload_zone/title.js'# The folder target a type condition becomes (pure, node:test).@@ -175,7 +175,6 @@ elsepin 'controllers/lane_link_controller', to: 'controllers/lane_link_controller.js'pin 'controllers/lane_split_controller', to: 'controllers/lane_split_controller.js'pin 'controllers/layout_toggle_controller', to: 'controllers/layout_toggle_controller.js'- pin 'controllers/list_address_controller', to: 'controllers/list_address_controller.js'pin 'controllers/list_row_controller', to: 'controllers/list_row_controller.js'pin 'controllers/meeting_analysis_composer_controller', to: 'controllers/meeting_analysis_composer_controller.js'pin 'controllers/meeting_modal_controller', to: 'controllers/meeting_modal_controller.js'diff --git a/spec/javascript/controllers/layout_toggle_controller.test.js b/spec/javascript/controllers/layout_toggle_controller.test.jsindex d181add..bce6fdc 100644--- a/spec/javascript/controllers/layout_toggle_controller.test.js+++ b/spec/javascript/controllers/layout_toggle_controller.test.js@@ -3,6 +3,7 @@ import assert from 'node:assert/strict'import { readFileSync } from 'node:fs'import { runInNewContext } from 'node:vm'import { laneParamNames } from '../../../app/javascript/lib/lane/params.js'+import { controlIndexPath, indexPaths } from '../../../app/javascript/lib/lane/filter_context.js'const source = readFileSync(new URL('../../../app/javascript/controllers/layout_toggle_controller.js', import.meta.url), 'utf8').replace(/^import .*\n/gm, '')@@ -15,7 +16,7 @@ function controllerWith(document, { window = {}, groups = null, element = null }CustomEvent: class {constructor(type, options) { this.type = type; Object.assign(this, options) }},- readLaneParams: () => groups, laneParamNames+ readLaneParams: () => groups, laneParamNames, controlIndexPath, indexPaths})const controller = new Controller()controller.listFilterParamsValue = []@@ -151,7 +152,7 @@ test('filter frame loads keep the open lane and synchronize links and an alreadyconst otherLink = control('A', '/tickets?search=keep')const element = {dataset: { indexUrl: '/meetings' },- querySelectorAll: () => [newLink, editLink, form, createForm, otherLink],+ querySelectorAll: selector => selector === '[data-lane-index-url]' ? [] : [newLink, editLink, form, createForm, otherLink],dispatchEvent: event => events.push(event.type)}const window = {@@ -253,7 +254,7 @@ test('list navigation retains its destination while lane return links inherit cuconst detail = link('/meetings/M/edit')const element = {dataset: { indexUrl: '/meetings' },- querySelectorAll: () => [...navigation, back, detail]+ querySelectorAll: selector => selector === '[data-lane-index-url]' ? [] : [...navigation, back, detail]}const controller = controllerWith({}, { element })controller.listFilterParamsValue = ['smart_folder_id', 'page', 'sort', 'items']@@ -267,3 +268,63 @@ test('list navigation retains its destination while lane return links inherit cuassert.equal(address.searchParams.has('meeting_id'), false)}})++// "Alle Meetings" shows a project's meeting in its lane (PR 3 of+// doc/meetings_uebersicht_vereinheitlichen_plan.md): its controls live below the+// project's meetings index, which the lane head names. They take the list state+// of the overview; a ticket link in the lane does not.+test('a lane of another list takes the list state on the index its head names', () => {+ const current = new URL('http://lalabase.test/org/o/meetings?search=Neu&meeting_id=M')+ const control = (tagName, href, matched = false) => ({+ tagName, href, method: 'post',+ getAttribute() { return this.href },+ setAttribute(_name, value) { this.href = value },+ matches() { return matched },+ querySelectorAll: () => [],+ append() {}+ })+ const back = control('A', '/org/o/meetings?search=Alt', true)+ const edit = control('A', '/org/o/projects/p/meetings/M/edit.turbo_stream?list_context=organisation&search=Alt')+ const toggle = control('FORM', '/org/o/projects/p/meetings/M/toggle_search?list_context=organisation&search=Alt')+ const ticket = control('A', '/org/o/projects/p/tickets/T?search=Alt')+ const head = { dataset: { laneIndexUrl: '/org/o/projects/p/meetings' } }+ const element = {+ dataset: { indexUrl: '/org/o/meetings' },+ querySelectorAll: selector => selector === '[data-lane-index-url]' ? [head] : [back, edit, toggle, ticket]+ }+ const controller = controllerWith({ createElement: () => ({}) }, { element })+ controller.listFilterParamsValue = ['search']+ controller.syncFilterContext(current)++ for (const target of [back, edit, toggle]) {+ assert.equal(new URL(target.href).searchParams.get('search'), 'Neu')+ }+ assert.equal(new URL(edit.href).searchParams.get('list_context'), 'organisation')+ assert.equal(ticket.href, '/org/o/projects/p/tickets/T?search=Alt')++ // Without the head the lane's controls belong to no index of this page.+ const stale = control('A', '/org/o/projects/p/meetings/M/edit.turbo_stream?search=Alt')+ controller.element = { dataset: { indexUrl: '/org/o/meetings' }, querySelectorAll: selector => selector === '[data-lane-index-url]' ? [] : [stale] }+ controller.syncFilterContext(current)+ assert.equal(stale.href, '/org/o/projects/p/meetings/M/edit.turbo_stream?search=Alt')+})++test('closing a lane whose object is gone takes it out of the address in the same entry', () => {+ const current = new URL('http://lalabase.test/org/o/meetings?search=x&meeting_id=M')+ const calls = []+ const window = {+ location: current,+ history: {+ state: { lane: true },+ replaceState: (_s, _t, url) => { calls.push('replace'); current.href = url },+ pushState: () => calls.push('push')+ }+ }+ const controller = controllerWith({}, { window, groups: { selection: ['meeting_id'], preview: [], form: [] } })+ controller.closeContent = options => calls.push(['close', options])+ controller.closeLane()+ assert.equal(current.searchParams.has('meeting_id'), false)+ assert.equal(current.searchParams.get('search'), 'x')+ // The options come from the controller's own realm: compared as JSON.+ assert.equal(JSON.stringify(calls), JSON.stringify(['replace', ['close', { history: false }]]))+})diff --git a/spec/javascript/lib/lane/filter_context.test.js b/spec/javascript/lib/lane/filter_context.test.jsnew file mode 100644index 0000000..1e53a22--- /dev/null+++ b/spec/javascript/lib/lane/filter_context.test.js@@ -0,0 +1,44 @@+// What: which controls of a list page with a lane take the list state when the+// list changes beside an open lane (lib/lane/filter_context.js).+// Type: node:test unit spec over paths; no browser.+// Why: "Alle Meetings" shows a project's meeting in its lane. Its edit, delete+// and search switch live below that project's meetings index, so a rule that+// knew only the page's own index left them with the state the list had when+// the lane was opened: a save redrew the list with old filters. A control of+// another list (a linked ticket) must stay as it is.+import { test } from "node:test"+import assert from "node:assert/strict"+import { controlIndexPath, indexPaths } from "../../../../app/javascript/lib/lane/filter_context.js"++const ORIGIN = "http://x.test"+const OVERVIEW = "/org/o1/meetings"+const PROJECT = "/org/o1/projects/p1/meetings"++test("the page's own index and what lies below it", () => {+ assert.equal(controlIndexPath(PROJECT, [PROJECT]), PROJECT)+ assert.equal(controlIndexPath(`${PROJECT}/m1/edit.turbo_stream`, [PROJECT]), PROJECT)+ assert.equal(controlIndexPath(`${PROJECT}/m1.turbo_stream`, [PROJECT]), PROJECT)+})++test("on the overview, the lane's controls belong to the index its head names", () => {+ const paths = indexPaths(OVERVIEW, [PROJECT], ORIGIN)+ assert.deepEqual(paths, [OVERVIEW, PROJECT])+ assert.equal(controlIndexPath(`${PROJECT}/m1/toggle_search`, paths), PROJECT)+ assert.equal(controlIndexPath(`${OVERVIEW}`, paths), OVERVIEW)+})++test("without a lane head only the page's index counts (tickets, knowledge)", () => {+ const paths = indexPaths(OVERVIEW, [], ORIGIN)+ assert.equal(controlIndexPath(`${PROJECT}/m1/toggle_search`, paths), null)+})++test("a control of another list or a path that only starts alike is left alone", () => {+ const paths = indexPaths(OVERVIEW, [PROJECT], ORIGIN)+ assert.equal(controlIndexPath("/org/o1/projects/p1/tickets/t1", paths), null)+ assert.equal(controlIndexPath("/org/o1/projects/p1/meetings_archive", paths), null)+ assert.equal(controlIndexPath("/org/o1/meetingsx", paths), null)+})++test("the same index twice is one, and full addresses become paths", () => {+ assert.deepEqual(indexPaths(`${ORIGIN}${PROJECT}?search=x`, [PROJECT, null], ORIGIN), [PROJECT])+})diff --git a/spec/javascript/lib/list_address.test.js b/spec/javascript/lib/list_address.test.jsdeleted file mode 100644index 9c1cb42..0000000--- a/spec/javascript/lib/list_address.test.js+++ /dev/null@@ -1,35 +0,0 @@-// What: the address of "Alle Meetings" after its list frame loaded (lib/list_address.js).-// Why: the filter bar reads sort and the open view from window.location. A-// column head or a page link reloads only the frame; an address that stayed-// behind lost the sort on the next filter and the page on a reload (review-// of the overview filter bar, P2).-import { test } from "node:test"-import assert from "node:assert/strict"-import { listAddress } from "../../../app/javascript/lib/list_address.js"--const PATH = "/org/o1/meetings"--test("the address is the path with the state the frame rendered", () => {- const rendered = "filter%5Bproject%5D%5B%5D=p1&page=2&sort%5Bcolumn%5D=title&sort%5Bdirection%5D=asc"- const params = new URL(listAddress(PATH, rendered), "http://x.invalid").searchParams-- assert.deepEqual(params.getAll("filter[project][]"), ["p1"])- assert.equal(params.get("sort[column]"), "title")- assert.equal(params.get("sort[direction]"), "asc")- assert.equal(params.get("page"), "2")-})--test("a state that no longer has a condition takes it out of the address", () => {- assert.equal(listAddress(PATH, "search=Kickoff"), `${PATH}?search=Kickoff`)- assert.equal(listAddress(PATH, ""), PATH)-})--test("page 1 is no page", () => {- assert.equal(listAddress(PATH, "page=1&smart_folder_id=v1"), `${PATH}?smart_folder_id=v1`)-})--test("a frame without a rendered state leaves the address alone", () => {- assert.equal(listAddress(PATH, undefined), null)- assert.equal(listAddress(PATH, null), null)- assert.equal(listAddress("", "search=x"), null)-})