Files
wekan/client/components/settings/tablePage.css
T
Lauri Ojansivu ebe985d453 A location in an Admin Panel table opens a map, through the card's own chooser.
Admin Panel / Problems / Offices names the places accounts log in from -
"London", with the country's flag - and a name is only useful if it leads
somewhere. Clicking one now asks which map to open it at, from the same eleven
providers a card's location offers.

THE SAME CHOOSER, not a second one. The provider list was eleven options inside
cardDetails.jade; it is client/components/main/mapProvider.jade now, and both
callers include it. Two lists would be eleven places to add a provider instead
of one, and they would disagree the first time only one was edited. The
isMapProvider helper moves with it, so neither caller needs its own copy, and so
do its styles - they were scoped to .js-card-location-form, which stopped being
true the moment a second template used them.

What the two do NOT share is the rest. A card's popup EDITS a location - name,
address, coordinates, delete - and none of that applies to an office: its
location arrived in a CDN header, WeKan did not ask for it and cannot correct
it. So tablePageMapPopup is the map half alone: where this is, the link, the
chooser, and a save that makes the choice the default for cards too, because
profile.mapProvider is the one setting both read.

A cell is a link only when the row HAS coordinates. A city name is not a
position, and a map URL built from one would either search for the word or
invent a place, so buildRows drops a location without lat/lon and the cell stays
plain text. The link follows the selection BEFORE it is saved: choosing a
provider and finding the link still pointing at the old one reads as broken.

The handler lives on the shared table page, not on the report. That is also
where the "clicking a user opens the Edit user popup" handler goes: three
reports each had their own identical copy, because each was written where its
own page was. A Blaze event bubbles through the template hierarchy, so one
handler on tablePage reaches every report - and a report added later gets both
without being told.

Two things the guards caught, both worth naming. The popup had no title, which
in WeKan means no header and so no close button; it opens with
titleKey: 'location-open-map-at' - the phrase the chooser is already labelled
with in every language - rather than adding a key to 154 files. And a comment
between an `if` and its `else if` breaks jade nesting, which
tests/jadeCompiles.test.cjs has a negative test for; the comments sit above the
chain.

Thanks to xet7 !
2026-08-16 17:33:09 +03:00

280 lines
10 KiB
CSS

/* The ONE table page layout. Design: docs/Features/Page/Table.md
Used by every paginated admin table (Security, Speed, Tests, CPU usage, Files,
Rules, Boards, Cards, Impersonation, Recovery). Defined once here so a fix to
the layout reaches every page instead of one report at a time. */
/* Rows, top to bottom: title, status, controls, table. Plain block order - no
flex `order` anywhere, so the DOM order in tablePage.jade IS the visual order,
in both LTR and RTL. */
.table-page {
display: flex;
flex-direction: column;
gap: 12px;
/* min-width:0 lets this shrink inside the flex .main-body; without it a wide
table sets a min-content floor and pushes the panel's right edge past the
window, which is exactly the "table runs off-screen" report. */
min-width: 0;
max-width: 100%;
}
.table-page-title {
margin: 0;
}
.table-page-desc {
margin: 0;
}
/* Search on the start side, pagination pushed to the end. margin-inline-start
mirrors automatically in RTL. Wraps to a second line rather than overflowing
when the panel is narrow. */
.table-page-controls {
display: flex;
flex-direction: row;
align-items: center;
flex-wrap: wrap;
gap: 10px;
min-width: 0;
}
.table-page-controls input.js-table-page-search {
flex: 0 1 320px;
min-width: 0;
max-width: 100%;
padding: 0 8px;
height: 34px;
}
/* ONE height and NO margins for everything in the controls row, so the search
field, the action buttons and the prev/next buttons share the same top and
bottom edge instead of each floating at its own y.
The global `button` rule in forms.css is `display: block; margin-bottom: 14px;
min-height: 41px` - written for stacked form buttons. In this row that margin is
part of the flex item's box, so a button carrying it is centred HIGHER than one
without: the pager buttons kept the 14px and the action buttons did not, which is
exactly the "Teams is higher, Unlock all is lower" misalignment. Height and
margin belong to the layout, so they are set here, once, for every control in the
row; the colours stay in paginationControls.css.
The pager selector is spelled out because paginationControls.css sizes
`.table-page-pagination button` at the same specificity as a plain
`.table-page-controls button` - whichever file happened to load last would win,
which is not something a layout rule may depend on. */
.table-page-controls button,
.table-page-controls .table-page-pagination button,
.table-page-controls button.js-table-page-action {
margin: 0;
height: 34px;
min-height: 34px;
}
/* Layout only. The COLOURS of the prev/next buttons and of the "3 / 42" counter
come from the one shared pager stylesheet, client/components/main/
paginationControls.css, which every pager in WeKan uses: they follow the
per-user theme accent (Member Settings -> Change color sets --theme-accent on
:root) and fall back to the WeKan default blue when no custom theme is chosen.
Do NOT restate the button colours here. That stylesheet spells out :hover,
:focus, :active and :active:hover on purpose, because the global button rules
in forms.css set those states from --theme-accent with a BLACK/grey fallback at
equal or higher specificity - a partial copy loses the moment the button is
clicked and leaves a black button sitting on the page. */
.table-page-pagination {
margin-inline-start: auto;
display: flex;
align-items: center;
gap: 6px;
}
/* Filter dropdowns, action buttons and the total: the controls-row features that
came from Admin Panel / People. Same height as the search field so the row
reads as one strip, and all of them shrink before the row wraps. */
.table-page-controls select.js-table-page-filter {
height: 34px;
min-width: 0;
max-width: 100%;
padding: 0 6px;
}
/* The icon centred beside the label, on one line. Height and margin come from the
shared control rule above, so an action button lines up with the search field and
with the prev/next pair. (People's "Unlock all users" used to bring its own 20px
top margin and 28px height from the old page header, and sat lower and shorter
than "Teams" next to it.) Layout only; the colours are in paginationControls.css
with the pager. */
.table-page-controls button.js-table-page-action {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 6px;
padding: 0 12px;
white-space: nowrap;
}
/* The total sits with the controls, not in the table: it counts the whole result
set, not the page. Inherits its colour so it stays readable on a dark theme. */
.table-page-total {
color: inherit;
white-space: nowrap;
}
/* Last-resort sideways scroll for the table only - never the whole page. */
.table-page-table-wrap {
max-width: 100%;
overflow-x: auto;
}
/* Full width, equal columns, wrapping text - at EVERY window width.
`table-layout: fixed` is what makes the columns an equal share of the width AND
what makes width:100% binding: with the default `auto` layout the browser sizes
columns to their content, so one long id or file name widened the table past
the panel and the right-hand columns ended up outside the window - and a table
with two short columns shrank to a third of the panel instead of filling it.
`!important` on the three properties that ARE this design: they have twice been
overridden from outside by app-wide `table { width: max-content !important;
min-width: 1200px !important }` rules that a page stylesheet declared with no
page in the selector. Those are fixed, but an unscoped `table` rule anywhere in
the app must never be able to decide the width of a table page again - a rule
that a stylesheet in another folder can silently break is not a guarantee. */
.table-page-table {
width: 100% !important;
max-width: 100% !important;
table-layout: fixed !important;
border-collapse: collapse;
}
/* Cells wrap and carry no minimum of their own - `white-space: nowrap` or a
`min-width` on a cell is the other way a table grows past its panel, and admin
stylesheets used to set both on every `table td` in the app.
The wrapping is `!important` for the same reason the width above is: it IS the
design, and it was being switched off from outside by app-wide `table td`
rules. A cut-off id or a value that runs under the next column is the same
report as a table running off the right edge - and it is the wrapping, not the
width, that fixes it once a column is narrow. */
.table-page-table th,
.table-page-table td {
text-align: start;
padding: 4px 8px;
border-bottom: 1px solid rgba(0, 0, 0, 0.08);
vertical-align: top;
min-width: 0 !important;
/* Long unbroken text (ids, URLs, file names, stack details) must wrap inside
its cell instead of widening the column. `anywhere` breaks a long word that
has no space in it; `break-word` is the older spelling kept for Safari. */
white-space: normal !important;
overflow-wrap: anywhere !important;
word-break: break-word !important;
}
.table-page-table th {
font-weight: 700;
}
/* Opt-in per column from the column spec. */
.table-page-table .table-page-end {
text-align: end;
}
/* The one opt-out, per column from the column spec (the datetime columns). Two
classes plus !important, so it still beats the !important wrapping above - a
guarantee that cannot be opted out of on purpose is a bug of its own. */
.table-page-table .table-page-nowrap {
white-space: nowrap !important;
overflow-wrap: normal !important;
word-break: normal !important;
}
/* Severity, coloured from the cell's own data attribute so the rule lives with
the table rather than in each report's stylesheet. */
.table-page-table td[data-sev='high'],
.table-page-table td[data-sev='critical'] {
color: #c0392b;
font-weight: bold;
}
.table-page-empty {
padding: 8px 0;
}
/* Narrow windows: the side menu goes full width on top and the table sits BELOW
it, instead of the two being squeezed side by side. Above this width the menu
stays on the start side with the table next to it.
This deliberately overrides the older "always side by side, even on narrow
windows" rule in settingBody.css: keeping both on one row left the table a few
dozen pixels wide on a phone, with its right-hand columns unreachable. 800px is
the same phone breakpoint the rest of WeKan uses. */
@media screen and (max-width: 800px) {
.setting-content .content-body {
flex-wrap: wrap;
}
.setting-content .content-body .side-menu {
width: 100%;
flex: 1 1 100%;
}
.setting-content .content-body .main-body {
flex: 1 1 100%;
/* The table wraps now, so the panel itself never needs to scroll sideways. */
overflow-x: auto !important;
}
}
/* ── Cells that are not text ───────────────────────────────────────────────
A table page's rows carry three things that are not words: the people who
share an office, the country a location is in, and the location itself as a
link to a map. All three exist to keep a row SHORT - these tables are wide,
and a column of full names or coordinates is what made them so. */
/* People, as initials or avatars, several to a cell. Wrapping rather than
overflowing: an office with thirty accounts is a taller row, not a row with
twenty-two of them off the side of the screen. */
.table-page-people {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 4px;
}
.table-page-people .edit-user {
display: inline-flex;
align-items: center;
gap: 2px;
}
/* How many times that person logged in from here. Small and quiet: it is the
second question, after who. */
.table-page-people-count {
font-size: 0.75em;
opacity: 0.7;
}
/* The country's flag, at the start of a location cell. Sized like text rather
than like an icon - it is read as part of "🇬🇧 London", one phrase. */
.table-page-flag {
margin-inline-end: 4px;
font-size: 1.1em;
line-height: 1;
}
/* A location cell leads to the map popup, so it looks like what it is. */
a.js-table-page-map {
text-decoration: none;
}
a.js-table-page-map:hover {
text-decoration: underline;
}
/* The popup itself: a place, its coordinates, the link, the chooser. */
.table-page-map-popup .table-page-map-label {
font-weight: bold;
margin-bottom: 2px;
}
.table-page-map-popup .table-page-map-coordinates {
font-size: 0.85em;
margin-bottom: 8px;
}
.table-page-map-popup .js-open-map {
display: inline-block;
margin-bottom: 10px;
}