Move "Show on … too" to the foot of the relation menu
Docs / build (push) Canceled after 0s
Docs / deploy (push) Canceled after 0s
CI / go (Media) (push) Successful in 10m29s
CI / go (Server) (push) Failing after 18m53s
CI / go (Web-App) (push) Successful in 14m26s
CI / frontend (push) Failing after 7m47s
CI / desktop (ubuntu-latest) (push) Failing after 1h24m30s
CI / desktop (macos-latest) (push) Canceled after 0s
CI / desktop (windows-latest) (push) Canceled after 0s
CI / mobile (push) Failing after 5m42s
CI / docker (push) Successful in 1h11m11s

It sat between the lists of databases and read like one of them. It is
now a "+" action below the page search, like other add buttons.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
tajniak81andClaude Opus 5.5 committed 2026-11-16 20:11:40 +01:00
1 parent 68c14e116d
commit 7fa5df53e5
2 files changed
+20 -15

No files matched your search

+19 -14
View File
@@ -4,7 +4,7 @@
// which records a cell links to, and what a rollup calculates.
import type { DbContext } from "./cells";
import { h, popover } from "./dom";
import { h, icon, popover } from "./dom";
import { fill, typeLabel, type DatabaseLabels } from "./labels";
import { linkedIds, rollupFnsFor, type DatabaseChoice, type RelationTarget, type RollupConfig, type RollupFn } from "./linked";
import { cellText, titleColumn, type Column, type DbData, type Row } from "./model";
@@ -104,19 +104,6 @@ export function relationTargetPanel(ctx: DbContext, anchor: Element, col: Column
};
drawLocal();
box.append(h("div", { class: "dw-db-pop__title" }, l.relationPick), list);
// A one-way relation on this page can get its other side in one step.
if (current && !current.back && linked.addBack && linked.writable?.(current)) {
const other = linked.read(current);
const has = other?.columns.some((c) => c.relation?.back === col.id && linked.pointsHere?.(current, c.relation));
if (other && !has) {
const btn = h("button", { type: "button", class: "dw-db__btn" }, fill(l.relationShowOn, other.title || l.untitled));
btn.addEventListener("click", () => {
linked.addBack!(current, col.id, ctx.db.title || col.name || l.typeRelation);
close();
});
box.append(btn);
}
}
if (linked.searchPages && linked.databasesOn) {
const input = h("input", { class: "dw-db-input", placeholder: l.relationSearchPage, "aria-label": l.relationOtherPage });
const found = h("div", { class: "dw-db-pop__list", role: "listbox" });
@@ -147,6 +134,24 @@ export function relationTargetPanel(ctx: DbContext, anchor: Element, col: Column
input.addEventListener("keydown", (e) => e.stopPropagation());
box.append(h("div", { class: "dw-db-pop__heading" }, l.relationOtherPage), input, found);
}
// A one-way relation on this page can get its other side in one step.
if (current && !current.back && linked.addBack && linked.writable?.(current)) {
const other = linked.read(current);
const has = other?.columns.some((c) => c.relation?.back === col.id && linked.pointsHere?.(current, c.relation));
if (other && !has) {
const btn = h(
"button",
{ type: "button", class: "dw-db__btn dw-db-pop__add" },
icon("plus", 14),
h("span", {}, fill(l.relationShowOn, other.title || l.untitled)),
);
btn.addEventListener("click", () => {
linked.addBack!(current, col.id, ctx.db.title || col.name || l.typeRelation);
close();
});
box.append(btn);
}
}
},
{ class: "dw-db-pop--choices", label: l.relationTo, onClose: onDone },
);