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
Fit the meeting panel to the grid's width in three stages
Guido Boyke8f23abce91b2
diff --git a/.github/workflows/guards.yml b/.github/workflows/guards.ymlindex 5445978..d2b166d 100644--- a/.github/workflows/guards.yml+++ b/.github/workflows/guards.yml@@ -639,6 +639,7 @@ jobs:spec/system/ticket_list_unread_dot_spec.rbspec/system/ticket_relations_spec.rbspec/system/ticket_meeting_panel_spec.rb+ spec/system/ticket_meeting_panel_stages_spec.rbspec/system/ticket_waiting_list_spec.rbspec/system/ticket_waiting_filters_spec.rbspec/services/smart_folder_query_builder_spec.rbdiff --git a/app/assets/stylesheets/components/ticket_meeting_panel.css b/app/assets/stylesheets/components/ticket_meeting_panel.cssindex 5b93148..c399a10 100644--- a/app/assets/stylesheets/components/ticket_meeting_panel.css+++ b/app/assets/stylesheets/components/ticket_meeting_panel.css@@ -9,6 +9,7 @@* Without a name: page, the form that works on any page.* 2. The panel's head (tickets/_meeting_panel): the meetings of the ticket as tabs.* The lane's own surface and width live in layout.css, beside the other lanes.+ * 3. The tab bar of the narrow stage, below.*/.meeting-reference--panel,@@ -69,3 +70,61 @@font-style: italic;color: rgb(var(--cream-600));}++/* 3. The narrow stage (layout.css, "NARROW"): ticket and meeting are two tabs in one+ * column. The bar is the panel's first row and the one part of it that stays+ * visible while the ticket is in front; it is sticky, so a meeting read halfway+ * down still shows it. Hidden at every other stage. */+.layout {+ --meeting-panel-tabs-height: 3rem;+}++.ticket-meeting-panel__stage-tabs {+ display: none;+}++.layout[data-meeting-panel-stage="narrow"]:not(.hide-panel) > .column.panel {+ padding-top: 0;+}++.layout[data-meeting-panel-stage="narrow"]:not(.hide-panel) .ticket-meeting-panel__stage-tabs {+ position: sticky;+ top: 0;+ z-index: 1;+ display: flex;+ align-items: center;+ gap: 0.25rem;+ height: var(--meeting-panel-tabs-height);+ margin-bottom: 1rem;+ padding-right: 2rem;+ border-bottom: 1px solid rgb(var(--cream-200));+ background: rgb(var(--white));+ visibility: visible;+}++.ticket-meeting-panel__stage-tab {+ height: 2rem;+ padding: 0 0.75rem;+ border-radius: 0.375rem;+ font-size: 0.8125rem;+ font-weight: 500;+ color: rgb(var(--cream-700));+}++.ticket-meeting-panel__stage-tab:hover {+ background: rgb(var(--cream-100));+ color: rgb(var(--cream-900));+}++.ticket-meeting-panel__stage-tab[aria-selected="true"] {+ background: rgb(var(--cream-100));+ color: rgb(var(--cream-900));+ font-weight: 700;+ box-shadow: inset 0 -2px 0 rgb(var(--ink));+}++/* The lane's close button stays reachable while the ticket is in front. */+.layout[data-meeting-panel-stage="narrow"][data-meeting-panel-tab="ticket"]:not(.hide-panel) > .column.panel .panel-close {+ visibility: visible;+ z-index: 2;+}diff --git a/app/assets/stylesheets/layout.css b/app/assets/stylesheets/layout.cssindex 0fdc57c..43d0c7b 100644--- a/app/assets/stylesheets/layout.css+++ b/app/assets/stylesheets/layout.css@@ -17,6 +17,15 @@/* The channel between two tracks of a .layout grid. */--lane-gap: 24px;+ /* The third lane beside an open detail (the meeting beside the ticket, and the+ width the assistant rule gives it), named once: the clamp below is built+ from these, and lib/lane/meeting_panel_stage reads the same four from the+ grid to decide how much fits (ticket_meeting_panel_controller), with+ --lane-gap above. */+ --panel-min: 320px;+ --panel-share: 0.34;+ --panel-max: 480px;+/* Page widths, named once (section "Page widths" below). A view names theclass, never a number: spec/architecture/page_width_guard_spec.rb. */--width-capped: 620px;@@ -1488,7 +1497,7 @@ main:has(.layout) > div {now shrinks with the space it actually sits in. Which lane yields isunchanged (L12: the LIST does); this only stops the remaining two frombeing measured against the wrong ruler. */- --panel-width: clamp(320px, 34%, 480px);+ --panel-width: clamp(var(--panel-min), calc(var(--panel-share) * 100%), var(--panel-max));grid-template-columns: 0px 1fr var(--panel-width);}body.assistant-panel-open .layout.two-column:not(.hide-content).hide-panel {@@ -1496,7 +1505,7 @@ main:has(.layout) > div {column-gap: 0;}body.assistant-panel-open .layout.two-column:not(.hide-content) .list,- .layout.two-column:not(.hide-content):not(.hide-panel) .list {+ .layout.two-column:not(.hide-content):not(.hide-panel):not([data-meeting-panel-stage="wide"]) .list {opacity: 0;pointer-events: none;transform: translateX(-100%);@@ -1512,10 +1521,73 @@ main:has(.layout) > div {/* Three tracks with the list's at 0px still have two channels, and the firstone stands before the ticket: 24px of page ground on top of the page's owninset (the two-track variants above set column-gap: 0 for the same reason).- The ticket takes that channel back; the one between ticket and meeting stays. */- .layout.two-column:not(.hide-content):not(.hide-panel) > .column.content {+ The ticket takes that channel back; the one between ticket and meeting stays.+ Not at the wide stage (the list is there, and so is its channel) unless the+ assistant has taken the list's place, and not at the narrow one (two tracks,+ no channel). */+ .layout.two-column:not(.hide-content):not(.hide-panel):not([data-meeting-panel-stage="wide"]):not([data-meeting-panel-stage="narrow"]) > .column.content,+ body.assistant-panel-open .layout.two-column:not(.hide-content):not(.hide-panel):not([data-meeting-panel-stage="narrow"]) > .column.content {margin-left: calc(-1 * var(--lane-gap));}++ /* The meeting beside the ticket in three stages (doc/ticket_meeting_panel_plan.md,+ S2), by the grid's width: ticket_meeting_panel_controller writes+ data-meeting-panel-stage from lib/lane/meeting_panel_stage, which reads the+ same --panel-* numbers as the clamp above. "medium" is the rule above as it+ stands: the list yields.++ WIDE: room for all three, so the list stays, with its share of what the+ panel leaves (--list-share, written by lane_split), held between the two+ minimums lane_split drags between. The handle stays hidden: it is drawn from+ --list-split, a share of the WHOLE grid, and would stand beside the edge it+ claims to move. Not while the assistant is open: it takes the list's place+ (L12) at any width. */+ body:not(.assistant-panel-open) .layout--lane.two-column:not(.hide-content):not(.hide-panel)[data-meeting-panel-stage="wide"] {+ grid-template-columns:+ clamp(var(--list-min),+ calc((100% - var(--panel-width) - 2 * var(--lane-gap)) * var(--list-share)),+ calc(100% - var(--panel-width) - 2 * var(--lane-gap) - var(--lane-min)))+ 1fr+ var(--panel-width);+ }++ /* NARROW: ticket and meeting do not fit side by side, so they share one column+ as two tabs (never stacked: two long scroll areas on top of each other trap+ the scroll). The panel moves into the detail's cell, above it; which of the+ two is in front is data-meeting-panel-tab (ticket_meeting_panel_controller).+ Neither is display:none, so each keeps its scroll position by itself: the+ one behind is visibility:hidden, which keeps its box, its scrollTop and its+ place in nothing else (no focus, no clicks, no screen reader). The panel's+ tab bar stays visible in both (components/ticket_meeting_panel.css). */+ .layout.two-column:not(.hide-content):not(.hide-panel)[data-meeting-panel-stage="narrow"] {+ grid-template-columns: 0px 1fr;+ column-gap: 0;+ }+ /* Both into the one cell, by name: placed only the panel, auto-placement put+ the detail into an implicit column beside it (measured: 49px wide). */+ .layout.two-column:not(.hide-content):not(.hide-panel)[data-meeting-panel-stage="narrow"] > .column.content,+ .layout.two-column:not(.hide-content):not(.hide-panel)[data-meeting-panel-stage="narrow"] > .column.panel {+ grid-column: 2;+ grid-row: 1;+ }+ .layout.two-column:not(.hide-content):not(.hide-panel)[data-meeting-panel-stage="narrow"] > .column.panel {+ z-index: 5;+ }+ .layout.two-column:not(.hide-content):not(.hide-panel)[data-meeting-panel-stage="narrow"][data-meeting-panel-tab="meeting"] > .column.content {+ visibility: hidden;+ }+ /* The tab bar lies over the top of the detail's cell; the detail begins below it+ (a spacer, so the lane's own inset is not written a second time). */+ .layout.two-column:not(.hide-content):not(.hide-panel)[data-meeting-panel-stage="narrow"] > .column.content::before {+ content: "";+ display: block;+ height: var(--meeting-panel-tabs-height);+ }+ .layout.two-column:not(.hide-content):not(.hide-panel)[data-meeting-panel-stage="narrow"][data-meeting-panel-tab="ticket"] > .column.panel {+ visibility: hidden;+ background: transparent;+ border-left-color: transparent;+ }}/* Two-column responsive overrides */diff --git a/app/javascript/controllers/lane_split_controller.js b/app/javascript/controllers/lane_split_controller.jsindex e8e7fb7..f07887e 100644--- a/app/javascript/controllers/lane_split_controller.js+++ b/app/javascript/controllers/lane_split_controller.js@@ -1,4 +1,5 @@import { Controller } from "@hotwired/stimulus"+import { MIN_LIST_PX, MIN_LANE_PX } from "lane/meeting_panel_stage"// The split between the list and the lane, dragged at the line that separates// them (layout.css, ".layout--lane" and ".lane-split").@@ -17,13 +18,20 @@ export default class extends Controller {// The list stays wide enough for a number, a title and one more column; the// lane wide enough for the running text it exists for. Below either the split- // stops - a resizer that can hide a pane is a resizer that loses one.- static MIN_LIST_PX = 320- static MIN_LANE_PX = 360+ // stops - a resizer that can hide a pane is a resizer that loses one. The+ // numbers live in lib/lane/meeting_panel_stage, which decides from the same+ // two how much of the meeting beside a ticket fits.+ static MIN_LIST_PX = MIN_LIST_PX+ static MIN_LANE_PX = MIN_LANE_PXstatic KEYBOARD_STEP_PX = 32static DEFAULT_SHARE = 0.4connect() {+ // For the stylesheet: with the meeting panel open on a wide grid the list+ // keeps its SHARE of what the panel leaves (layout.css, "wide"), held+ // between the same two minimums the drag is held between.+ this.element.style.setProperty("--list-min", `${MIN_LIST_PX}px`)+ this.element.style.setProperty("--lane-min", `${MIN_LANE_PX}px`)this.onWindowResize = this.onWindowResize.bind(this)this.onPointerMove = this.onPointerMove.bind(this)this.onPointerUp = this.onPointerUp.bind(this)@@ -78,6 +86,9 @@ export default class extends Controller {apply(share) {const px = this.clamp(share * this.gridWidth)this.element.style.setProperty("--list-split", `${Math.round(px)}px`)+ // The share actually applied (after the clamp); a grid not laid out yet has no+ // width to divide by and keeps the share it was asked for.+ this.element.style.setProperty("--list-share", String(this.gridWidth ? px / this.gridWidth : share))this.currentPx = pxif (!this.hasHandleTarget) returndiff --git a/app/javascript/controllers/ticket_meeting_panel_controller.js b/app/javascript/controllers/ticket_meeting_panel_controller.jsindex 0a4a212..14b974a 100644--- a/app/javascript/controllers/ticket_meeting_panel_controller.js+++ b/app/javascript/controllers/ticket_meeting_panel_controller.js@@ -1,5 +1,6 @@import { Controller } from "@hotwired/stimulus"import { escapeOwned } from "escape_owner"+import { meetingPanelStage } from "lane/meeting_panel_stage"// The meeting beside the ticket (doc/ticket_meeting_panel_plan.md, S1), mounted on the// content of turbo-frame#ticket_meeting_panel (tickets/_meeting_panel, and the "not@@ -14,11 +15,25 @@ import { escapeOwned } from "escape_owner"// * the ticket lane showing another ticket, or none, closes it (decision F3): the// meeting belongs to the ticket it was opened from. The lane has eight writers and// most are streams that fire no load event, so the lane is watched instead.+// And while it is open it decides how much of it fits (S2): a ResizeObserver on the grid+// writes data-meeting-panel-stage (wide | medium | narrow, lib/lane/meeting_panel_stage)+// for the stylesheet, and at the narrow stage it keeps which of ticket and meeting is in+// front (data-meeting-panel-tab). The grid, not the window: the assistant beside the page+// changes the grid's width without the window changing at all.export default class extends Controller {+ static targets = ["ticketTab", "meetingTab"]static values = { ticketId: String }connect() {this.grid = this.element.closest(".layout")+ if (this.grid) {+ // Before the lane opens, so its first frame already has the right stage.+ this.select("meeting")+ this.updateStage()+ this.resizeObserver = new ResizeObserver(() => this.updateStage())+ this.resizeObserver.observe(this.grid)+ }+this.dispatch(this.laneShowsTicket() ? "open" : "close")this.boundNoteEscape = this.noteEscape.bind(this)@@ -33,6 +48,47 @@ export default class extends Controller {window.removeEventListener("keydown", this.boundNoteEscape, true)document.removeEventListener("keydown", this.boundCloseOnEscape)this.laneObserver?.disconnect()+ this.resizeObserver?.disconnect()+ // A tab of the panel replaces this content and connects a new instance in the+ // same task, which writes both again before anything is painted.+ delete this.grid?.dataset.meetingPanelStage+ delete this.grid?.dataset.meetingPanelTab+ }++ // --- stages (S2) --------------------------------------------------------++ updateStage() {+ const style = getComputedStyle(this.grid)+ const number = name => parseFloat(style.getPropertyValue(name))+ const stage = meetingPanelStage({+ gridWidth: this.grid.getBoundingClientRect().width,+ panelMin: number("--panel-min"),+ panelShare: number("--panel-share"),+ panelMax: number("--panel-max"),+ gap: number("--lane-gap")+ })+ const previous = this.grid.dataset.meetingPanelStage+ if (stage === previous) return++ this.grid.dataset.meetingPanelStage = stage+ // Dropping to the tabs shows the meeting first: it is what was opened last (F6).+ if (stage === "narrow") this.select("meeting")+ }++ showTicket() {+ this.select("ticket")+ }++ showMeeting() {+ this.select("meeting")+ }++ select(tab) {+ if (!this.grid) return++ this.grid.dataset.meetingPanelTab = tab+ if (this.hasTicketTabTarget) this.ticketTabTarget.setAttribute("aria-selected", String(tab === "ticket"))+ if (this.hasMeetingTabTarget) this.meetingTabTarget.setAttribute("aria-selected", String(tab === "meeting"))}// While the lane shows this panel, the next Escape closes it.diff --git a/app/javascript/lib/lane/meeting_panel_stage.js b/app/javascript/lib/lane/meeting_panel_stage.jsnew file mode 100644index 0000000..6e97134--- /dev/null+++ b/app/javascript/lib/lane/meeting_panel_stage.js@@ -0,0 +1,37 @@+// How much of the meeting beside the ticket fits (doc/ticket_meeting_panel_plan.md, S2).+// Decided by the GRID's width, not the window's: the assistant docks to the left of the+// page at 280 to 640 px and can be dragged, so one window can hold three columns or not.+//+// wide list, ticket and meeting side by side; the list keeps its share of the rest+// medium ticket and meeting; the list yields first (its track goes to 0 px)+// narrow ticket and meeting as two tabs in one column, never stacked+//+// The minimums of the list and the lane live HERE, once: lane_split_controller clamps its+// drag with them and writes them to the grid for the stylesheet. The panel's own width is+// the stylesheet's (--panel-min, --panel-share, --panel-max in layout.css); the caller+// reads those and passes them in, so the clamp the browser lays out and the clamp this+// function computes are the same three numbers.++// The list stays wide enough for a number, a title and one more column; the lane wide+// enough for the running text it exists for.+export const MIN_LIST_PX = 320+export const MIN_LANE_PX = 360++export const STAGES = Object.freeze(["wide", "medium", "narrow"])++// The width the panel takes in a grid this wide: its share, held between its bounds,+// as the stylesheet's clamp() lays it out.+export function panelWidth({ gridWidth, panelMin, panelShare, panelMax }) {+ return Math.min(Math.max(gridWidth * panelShare, panelMin), panelMax)+}++// gap is the channel between two tracks. Both stages with a panel have three tracks+// (in medium the list's is 0 px wide but still a track), so two channels.+export function meetingPanelStage({+ gridWidth, panelMin, panelShare, panelMax, gap, listMin = MIN_LIST_PX, laneMin = MIN_LANE_PX+}) {+ const rest = gridWidth - panelWidth({ gridWidth, panelMin, panelShare, panelMax }) - 2 * gap+ if (rest >= listMin + laneMin) return "wide"+ if (rest >= laneMin) return "medium"+ return "narrow"+}diff --git a/app/views/organisations/tickets/_meeting_panel.html.erb b/app/views/organisations/tickets/_meeting_panel.html.erbindex 286833f..2abd467 100644--- a/app/views/organisations/tickets/_meeting_panel.html.erb+++ b/app/views/organisations/tickets/_meeting_panel.html.erb@@ -12,6 +12,19 @@<div class="ticket-meeting-panel"data-controller="ticket-meeting-panel"data-ticket-meeting-panel-ticket-id-value="<%= ticket.id %>">+ <%# The narrow stage (S2): ticket and meeting as two tabs in one column. Hidden at the+ other stages (components/ticket_meeting_panel.css); the controller keeps the+ selection on the grid and in aria-selected. %>+ <div class="ticket-meeting-panel__stage-tabs" role="tablist" aria-label="<%= t("#{mp}.stage_tabs_label") %>">+ <button type="button" role="tab" class="ticket-meeting-panel__stage-tab" aria-selected="false"+ data-ticket-meeting-panel-target="ticketTab" data-action="ticket-meeting-panel#showTicket">+ <%= t("#{mp}.ticket_tab", number: ticket.number) %>+ </button>+ <button type="button" role="tab" class="ticket-meeting-panel__stage-tab" aria-selected="true"+ data-ticket-meeting-panel-target="meetingTab" data-action="ticket-meeting-panel#showMeeting">+ <%= t("#{mp}.meeting_tab", date: l(meeting.occurred_at.to_date, format: :short)) %>+ </button>+ </div><header class="ticket-meeting-panel__head"><p class="text-xs font-mono uppercase tracking-wider text-cream-600"><%= t("#{mp}.eyebrow") %></p><% if meetings.size > 1 %>diff --git a/config/importmap.rb b/config/importmap.rbindex 6aa054d..f732d6e 100644--- a/config/importmap.rb+++ b/config/importmap.rb@@ -45,6 +45,7 @@ pin 'list_row/address', to: 'lib/list_row/address.js'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'+pin 'lane/meeting_panel_stage', to: 'lib/lane/meeting_panel_stage.js'# Who takes an Escape: the topmost menu, modal or drawer, before the lane.pin 'escape_owner', to: 'lib/escape_owner.js'# The document forms' drop zone: the title a file suggests (S4 of doc/dokumentansicht_plan.md).diff --git a/config/locales/views/tickets.de.yml b/config/locales/views/tickets.de.ymlindex 70879d4..1f337a7 100644--- a/config/locales/views/tickets.de.yml+++ b/config/locales/views/tickets.de.yml@@ -235,6 +235,9 @@ de:this_ticket: dieses Ticketopen_meeting: Meeting öffnenunavailable: Dieses Meeting ist nicht verfügbar.+ stage_tabs_label: Ticket oder Meeting zeigen+ ticket_tab: "Ticket #%{number}"+ meeting_tab: "Meeting %{date}"shared:subtasks:heading: Unteraufgabendiff --git a/config/locales/views/tickets.en.yml b/config/locales/views/tickets.en.ymlindex 3967a7d..1907f35 100644--- a/config/locales/views/tickets.en.yml+++ b/config/locales/views/tickets.en.yml@@ -235,6 +235,9 @@ en:this_ticket: this ticketopen_meeting: Open meetingunavailable: This meeting is not available.+ stage_tabs_label: Show the ticket or the meeting+ ticket_tab: "Ticket #%{number}"+ meeting_tab: "Meeting %{date}"shared:subtasks:heading: Sub-tasksdiff --git a/spec/javascript/lib/lane/meeting_panel_stage.test.js b/spec/javascript/lib/lane/meeting_panel_stage.test.jsnew file mode 100644index 0000000..e751e37--- /dev/null+++ b/spec/javascript/lib/lane/meeting_panel_stage.test.js@@ -0,0 +1,54 @@+// What: the three stages of the meeting beside the ticket, from the grid's width+// (lib/lane/meeting_panel_stage.js, doc/ticket_meeting_panel_plan.md S2).+// Type: node:test unit spec over numbers.+// Why: the stages switch at two widths, and each width is the sum of minimums, a panel+// that grows with the grid and two channels. An off-by-one there shows a lane below its+// minimum or tabs where two columns fit. Every boundary is pinned at n-1, n and n+1.+import { test } from "node:test"+import assert from "node:assert/strict"+import { MIN_LIST_PX, MIN_LANE_PX, STAGES, panelWidth, meetingPanelStage } from "../../../../app/javascript/lib/lane/meeting_panel_stage.js"++// The stylesheet's numbers (layout.css: --panel-min, --panel-share, --panel-max, --panel-gap).+const PANEL = { panelMin: 320, panelShare: 0.34, panelMax: 480, gap: 24 }+const stageAt = gridWidth => meetingPanelStage({ gridWidth, ...PANEL })++test("the minimums are the ones the split has always used", () => {+ assert.equal(MIN_LIST_PX, 320)+ assert.equal(MIN_LANE_PX, 360)+ assert.deepEqual(STAGES, ["wide", "medium", "narrow"])+})++test("panelWidth takes its share of the grid, held between its bounds", () => {+ assert.equal(panelWidth({ gridWidth: 900, ...PANEL }), 320) // 306 is below the minimum+ assert.equal(panelWidth({ gridWidth: 1000, ...PANEL }), 340)+ assert.equal(panelWidth({ gridWidth: 1500, ...PANEL }), 480) // 510 is above the maximum+})++// Medium needs the lane's minimum beside the panel: 360 + 320 + 2 * 24 = 728.+test("narrow below 728 px, medium from 728 px", () => {+ assert.equal(stageAt(727), "narrow")+ assert.equal(stageAt(728), "medium")+ assert.equal(stageAt(729), "medium")+})++// Wide needs list and lane minimums beside a panel that has grown with the grid:+// g - 0.34 g - 48 >= 680, so g >= 1103.03.+test("medium below 1104 px, wide from 1104 px", () => {+ assert.equal(stageAt(1103), "medium")+ assert.equal(stageAt(1104), "wide")+ assert.equal(stageAt(1105), "wide")+})++test("a panel at its maximum leaves everything else to list and lane", () => {+ assert.equal(stageAt(2560), "wide")+})++test("the boundaries follow the minimums and the channel it is given", () => {+ const custom = { ...PANEL, gap: 0, listMin: 100, laneMin: 200 }+ // medium: rest = g - 320 >= 200 (the panel stays at its minimum up to 941 px)+ assert.equal(meetingPanelStage({ gridWidth: 519, ...custom }), "narrow")+ assert.equal(meetingPanelStage({ gridWidth: 520, ...custom }), "medium")+ // wide: rest = g - 320 >= 300+ assert.equal(meetingPanelStage({ gridWidth: 619, ...custom }), "medium")+ assert.equal(meetingPanelStage({ gridWidth: 620, ...custom }), "wide")+})diff --git a/spec/system/ticket_meeting_panel_spec.rb b/spec/system/ticket_meeting_panel_spec.rbindex da8fdae..626413d 100644--- a/spec/system/ticket_meeting_panel_spec.rb+++ b/spec/system/ticket_meeting_panel_spec.rb@@ -15,6 +15,9 @@ RSpec.describe 'Meeting beside the ticket', type: :system dobefore dodriven_by :selenium_chrome_headless_full+ # A medium grid (896px): ticket and meeting beside each other, the list yielded.+ # The three stages are ticket_meeting_panel_stages_spec's.+ page.driver.browser.manage.window.resize_to(1200, 900)Prosopite.pauseActsAsTenant.current_tenant = organisationcreate(:membership, user: user, organisation: organisation, role: create(:admin_role, organisation: organisation),@@ -41,6 +44,7 @@ RSpec.describe 'Meeting beside the ticket', type: :system dorescue StandardErrornilend+ page.driver.browser.manage.window.resize_to(1440, 900)ActsAsTenant.current_tenant = nilProsopite.resumeenddiff --git a/spec/system/ticket_meeting_panel_stages_spec.rb b/spec/system/ticket_meeting_panel_stages_spec.rbnew file mode 100644index 0000000..e38075a--- /dev/null+++ b/spec/system/ticket_meeting_panel_stages_spec.rb@@ -0,0 +1,202 @@+# frozen_string_literal: true++require 'rails_helper'++# The meeting beside the ticket in three stages, measured in a real browser at real grid+# widths (doc/ticket_meeting_panel_plan.md, S2). The stage follows the GRID, so the+# assistant beside the page changes it without the window changing; the assistant is never+# closed for it. Widths (window 1440 x 900 and a 256px sidebar, measured 2026-10-23):+#+# window grid stage, without the assistant | with it+# 1600 1296 wide | medium (L12: the list yields to it)+# 1200 896 medium |+# 1280 | narrow+# 1024 720 narrow |+#+# The boundaries themselves (728 and 1104 px of grid) are pinned by the node tests of+# lib/lane/meeting_panel_stage; this spec proves the stylesheet lays out what they decide.+RSpec.describe 'Meeting beside the ticket, by the width of the grid', type: :system do+ let(:organisation) do+ create(:organisation, assistant_enabled: true, ai_enabled: true,+ ai_provider: 'openai', ai_access_token: 'sk-org-own-1234567890abcdef')+ end+ let(:user) { create(:user) }+ let(:project) { create(:project, organisation: organisation) }++ before do+ driven_by :selenium_chrome_headless_full+ Prosopite.pause+ ActsAsTenant.current_tenant = organisation+ role = create(:admin_role, organisation: organisation)+ create(:permission, role: role, category: 'assistant', action: 'use_assistant', allowed: true)+ create(:membership, user: user, organisation: organisation, role: role, active: true)+ sign_in user+ end++ # After the before block above: they need its tenant.+ let!(:ticket) do+ create(:ticket, project: project, title: 'Ticket with a long story', creator: user,+ content: Array.new(80) { |i| "<p>Ticket line #{i}.</p>" }.join)+ end+ let!(:meeting) do+ create(:meeting, project: project, title: 'Planning call', creator: user, occurred_at: 2.days.ago,+ notes: Array.new(80) { |i| "Meeting note #{i}." }.join("\n\n")).tap do |m|+ m.outgoing_references.create!(organisation: organisation, target: ticket, target_title_snapshot: ticket.display_title)+ end+ end++ after do+ page.driver.browser.manage.window.resize_to(1440, 900)+ ActsAsTenant.current_tenant = nil+ Prosopite.resume+ end++ def open_at(window_width)+ page.driver.browser.manage.window.resize_to(window_width, 900)+ visit organisation_project_tickets_path(organisation, project, ticket_id: ticket.id)+ open_panel+ end++ def open_panel+ within("#meeting-references-#{ticket.id}") { click_link 'Planning call' }+ expect(page).to have_css('aside.column.panel h2', text: 'Planning call')+ end++ def stage = find('.layout')['data-meeting-panel-stage']++ def width(selector)+ page.evaluate_script("Math.round(document.querySelector(#{selector.to_json}).getBoundingClientRect().width)")+ end++ def widths = { list: width('.layout .column.list'), ticket: width('.layout .column.content'), meeting: width('.layout .column.panel') }++ def scroll_top(selector) = page.evaluate_script("document.querySelector(#{selector.to_json}).scrollTop")++ def scroll(selector, to:)+ page.execute_script("document.querySelector(#{selector.to_json}).scrollTop = #{to}")+ end++ def stage_tab(name)+ find('.ticket-meeting-panel__stage-tab', text: name)+ end++ def assistant_open? = page.evaluate_script('document.body.classList.contains("assistant-panel-open")')++ # Wait for the grid's transition to settle before measuring.+ def settled+ sleep 0.5+ end++ context 'without the assistant' do+ it 'shows list, ticket and meeting side by side on a wide grid' do+ open_at(1600)++ expect(page).to have_css('.layout[data-meeting-panel-stage="wide"]')+ settled+ expect(widths[:list]).to be >= 320+ expect(widths[:ticket]).to be >= 360+ expect(widths[:meeting]).to be_between(320, 480)+ expect(page).to have_no_css('.ticket-meeting-panel__stage-tabs', visible: :visible)+ expect(page).to have_no_css('.lane-split', visible: :visible)+ end++ it 'lets the list yield on a medium grid' do+ open_at(1200)++ expect(page).to have_css('.layout[data-meeting-panel-stage="medium"]')+ settled+ expect(widths[:list]).to eq(0)+ expect(widths[:ticket]).to be >= 360+ expect(widths[:meeting]).to be_between(320, 480)+ expect(page).to have_no_css('.ticket-meeting-panel__stage-tabs', visible: :visible)+ end++ it 'turns ticket and meeting into two tabs on a narrow grid, each keeping its scroll position' do+ open_at(1024)++ expect(page).to have_css('.layout[data-meeting-panel-stage="narrow"]')+ settled+ expect(widths[:ticket]).to eq(width('.layout'))+ expect(widths[:meeting]).to eq(width('.layout'))+ # The meeting first: it was opened last (F6).+ expect(stage_tab('Meeting')['aria-selected']).to eq('true')+ expect(page).to have_css('aside.column.panel h2', text: 'Planning call', visible: :visible)+ expect(page).to have_no_css("#ticket-content-#{ticket.id}", visible: :visible)++ scroll('.layout .column.panel', to: 900)+ stage_tab("Ticket ##{ticket.number}").click+ expect(stage_tab("Ticket ##{ticket.number}")['aria-selected']).to eq('true')+ expect(page).to have_css("#ticket-content-#{ticket.id}", visible: :visible)+ expect(page).to have_no_css('aside.column.panel h2', visible: :visible)+ # The tab bar stays, so there is a way back.+ expect(page).to have_css('.ticket-meeting-panel__stage-tabs', visible: :visible)++ scroll('.layout .column.content', to: 700)+ stage_tab('Meeting').click+ expect(page).to have_css('aside.column.panel h2', visible: :visible)+ expect(scroll_top('.layout .column.panel')).to be_within(2).of(900)++ stage_tab("Ticket ##{ticket.number}").click+ expect(page).to have_css("#ticket-content-#{ticket.id}", visible: :visible)+ expect(scroll_top('.layout .column.content')).to be_within(2).of(700)+ end+ end++ context 'with the assistant' do+ it 'moves to the next stage when the assistant opens, and never closes it' do+ open_at(1600)+ expect(page).to have_css('.layout[data-meeting-panel-stage="wide"]')++ find('#assistant-panel-trigger').click+ expect(page).to have_css('body.assistant-panel-open')++ expect(page).to have_css('.layout[data-meeting-panel-stage="medium"]')+ settled+ expect(widths[:list]).to eq(0)+ expect(widths[:ticket]).to be >= 360+ expect(widths[:meeting]).to be_between(320, 480)++ find('body').send_keys(:escape)+ expect(page).to have_css('.layout.hide-panel')+ expect(assistant_open?).to be(true)+ end++ it 'shows the tabs on a grid the assistant has made narrow' do+ page.driver.browser.manage.window.resize_to(1280, 900)+ visit organisation_project_tickets_path(organisation, project, ticket_id: ticket.id)+ find('#assistant-panel-trigger').click+ expect(page).to have_css('body.assistant-panel-open')+ open_panel++ expect(page).to have_css('.layout[data-meeting-panel-stage="narrow"]')+ expect(page).to have_css('.ticket-meeting-panel__stage-tabs', visible: :visible)+ expect(stage_tab('Meeting')['aria-selected']).to eq('true')+ expect(assistant_open?).to be(true)+ end+ end++ context 'on the board' do+ before do+ create(:ticket_attribute_definition, project: project, name: 'status', field_type: 'select',+ options: { 'allowed_values' => [+ { 'value' => 'Neu', 'labels' => { 'de' => 'Neu' }, 'system_functions' => ['is_new'] }+ ] })+ ticket.update!(custom_attributes: { 'status' => 'Neu' })+ ViewConfiguration.create!(user: user, project: project, organisation: organisation,+ view_type: 'tickets', view_mode: 'kanban',+ table_columns: %w[number title], header_columns: %w[assignees],+ list_columns: { 'cells' => [], 'metadata' => [] })+ end++ it 'follows the same stages' do+ open_at(1600)+ expect(page).to have_css('.layout.kanban-layout[data-meeting-panel-stage="wide"]')+ settled+ expect(widths[:list]).to be >= 320++ page.driver.browser.manage.window.resize_to(1024, 900)+ expect(page).to have_css('.layout.kanban-layout[data-meeting-panel-stage="narrow"]')+ expect(page).to have_css('.ticket-meeting-panel__stage-tabs', visible: :visible)+ end+ end+end