Files
wekan/client/components/settings/tablePage.jade
T
Lauri Ojansivu 3d703965c4 Admin Panel / Problems: "IPv6 location" and "Instrumentation" are translated.
The Security report in Finnish read "Sijainti" beside the English "IPv6
location", and the menu row and title bar of the Instrumentation report were
English in every language.

- The IPv6 location column is the translated 'location' with the fixed
  technical suffix " (IPv6)" - "Sijainti (IPv6)" - through a new optional
  labelSuffix on table headers, so no new key is needed.
- instrumentationReportTitle names the report in the menu row and in its
  title bar, which tests/adminUrls.test.cjs requires to say the same words.
  It is translated into all 246 locale files, after instrumentation-other
  in en.i18n.json's key order. French uses "Instrumentation logicielle",
  because the bare word is spelled exactly like the English one.

Low-confidence translations, written from the language's general
vocabulary for "measuring tools" where the technical term has no
established form: ak, ay, bm, bua, chr, cv, ee, ff, fj, gn, gv, ha, haw, ig,
iu, kl, kw, lg, mi, nah, nd, ny, om, qu, rn, rw, sah, se, sm, sn, ss, st,
tig, tlh, to, tpi, ts, ve, vo, wal, wo, zgh.

tests/addressReportColumns.test.cjs checks that every address column header
is translated. The admin-office-location UI spec expects "Location (IPv6)".

Thanks to xet7 !
2026-10-20 10:37:03 +03:00

198 lines
11 KiB
Plaintext

//- The ONE table page used by every paginated admin table.
//- Design + the list of pages that use it: docs/Features/General/Table.md
//-
//- Rows, top to bottom: title, status, controls (search + pagination), table.
//- That order is the design; it is defined here once instead of being retyped in
//- each report, which is how the reports had drifted apart.
//-
//- Data context (see tablePage.js / models/lib/tablePage.js):
//- title / titleKey, descKey, additionalDesc, statusTemplate + statusData,
//- header[], rows[], rowCount, searchTerm, page, totalPages, hasPrev, hasNext,
//- emptyKey
template(name="tablePage")
.table-page
//- The title carries .admin-pane-title as well, the ONE heading style every
//- Admin Panel pane uses (settingBody.css) - so a table pane and a form pane
//- have the same title at the same size.
//-
//- Rendered only when the page supplies one: inside the Admin Panel the pane
//- title comes from the ACTIVE LEFT MENU ENTRY (docs/Features/All-Boards/Left-Menu.md),
//- rendered once for every pane by the section around it, so a table page that
//- also printed its own title would show the same heading twice.
if titleKey
h1.table-page-title.admin-pane-title {{_ titleKey}}
else if title
h1.table-page-title.admin-pane-title {{title}}
if descKey
p.quiet.table-page-desc {{_ descKey}}
if additionalDesc
p.quiet.table-page-desc {{additionalDesc}}
if statusTemplate
.table-page-status
+Template.dynamic(template=statusTemplate data=statusData)
.table-page-controls
input.js-table-page-search(type="search" placeholder="{{_ 'search'}}" aria-label="{{_ 'search'}}" value="{{searchTerm}}")
//- Filters, actions and the total are ON by default: supply them and they
//- render. They came from Admin Panel / People, where they were hand-written
//- into that page's own markup; they are general enough for any table.
each filters
select.js-table-page-filter(data-filter="{{id}}" title="{{_ labelKey}}")
each options
option(value="{{value}}" selected="{{selected}}")
if labelKey
| {{_ labelKey}}
else
| {{label}}
each actions
button.js-table-page-action(data-action="{{id}}" class="{{cls}}")
if icon
i.fa(class="{{icon}}")
| {{_ labelKey}}
if total
span.table-page-total
if totalLabelKey
| {{_ totalLabelKey}}
|  {{total}}
.table-page-pagination
button.js-table-page-prev(class="{{#unless hasPrev}}disabled{{/unless}}" title="{{_ 'previous'}}")
| <
span.table-page-page-info {{page}} / {{totalPages}}
button.js-table-page-next(class="{{#unless hasNext}}disabled{{/unless}}" title="{{_ 'next'}}")
| >
//- The table is ALWAYS rendered, empty or not. Its header carries controls on
//- several pages - the "New" link of Organizations, Teams, People and
//- Translation, the select-all pairs - so hiding the whole table when there
//- are no rows hid the only way to create the FIRST row: an empty
//- Organizations pane had no "New" button, and no way to get one.
//- The empty message is below the table now, not instead of it.
//-
//- The wrapper is the only element allowed to scroll sideways, and only as
//- a last resort: the table itself is width:100% + table-layout:fixed, so
//- it cannot grow past the panel and push its right edge off-screen.
.table-page-table-wrap
//- The column count, for the narrow-screen floor in tablePage.css.
table.table-page-table(style="--table-page-columns: {{header.length}}")
thead
tr
each header
th(style="width: {{width}}" class="{{cls}}")
//- A column may render its own header - a select-all pair, an
//- "add row" form - instead of a plain label. Used by the People
//- panes, whose headers carry controls.
if template
+Template.dynamic(template=template data=data)
else if labelKey
| {{_ labelKey}}{{labelSuffix}}
else
| {{label}}
tbody
//- Two ways to render a row. `cells` (a column spec) is the default and
//- keeps the guarantee that a row can never be shorter than the header.
//- `rowTemplate` is for panes whose rows are interactive - inline
//- checkboxes, edit links - which a text-cell spec cannot express; that
//- page owns its <tr> and is responsible for matching the columns.
if rowTemplate
each docs
+Template.dynamic(template=../rowTemplate data=this)
else
each rows
tr(class="{{cls}}")
each cells
td(class="{{cls}}" data-sev="{{data}}")
if icons.length
span.table-page-status-icons
each icons
i.fa(class="{{cls}}" title="{{title}}" aria-hidden="true")
//- A user cell shows INITIALS, or the avatar where the
account has one - the same way the board sidebar and a card
show a member. It takes a fraction of the width of a
username or a full name, and these tables are wide already.
The name is the anchor's title, so hovering still says who
it is, and clicking opens the same "Edit user" popup as
Admin Panel / People. Not +userAvatar, which renders its own
anchor for the board's member popup: an anchor inside this
one is invalid and would swallow the click.
//- Several people in one cell: an office row's People
column. Each is the same avatar-or-initials link as a
single user cell, with the number of logins beside it.
//- `.member` is the board sidebar's own avatar box - 24px,
round, with the image cropped to fill it and the initials
centred in it. EVERY avatar rule in userAvatar.css is
scoped to it, so a cell without it drew the image at its
natural size: a 300px photograph in a table row, with the
login counts scattered around it.
//- A PLACE - an office row's Location: the country's flag
and the city, and clicking it asks which map to open it
at, from the same eleven providers as a card's location
because it is the same chooser. Only when the row HAS
coordinates: a city name is not a position, so a cell with
a label and no lat/lon stays plain text.
//- These comments sit ABOVE the chain, all of them. One
between an `if` and its `else if` breaks the nesting -
see the negative test in tests/jadeCompiles.test.cjs.
if attachment
.table-page-attachment
button.table-page-attachment-preview.js-table-page-attachment-preview(type="button" data-attachment-id="{{attachment.id}}" title="{{_ 'preview'}}")
if attachment.isImage
img.table-page-attachment-thumbnail(src="{{attachment.link}}" alt="{{attachment.name}}")
else
span.table-page-attachment-extension {{attachment.extension}}
.table-page-attachment-actions
button.js-table-page-attachment-preview(type="button" data-attachment-id="{{attachment.id}}" title="{{_ 'preview'}}")
i.fa.fa-search-plus(aria-hidden="true")
a.js-table-page-attachment-download(href="{{attachment.link}}?download=true" download="{{attachment.name}}" title="{{_ 'download'}}")
i.fa.fa-arrow-down(aria-hidden="true")
else if users.length
.table-page-people
each users
span.table-page-person
a.member.edit-user.js-table-page-edit-user(data-user-id="{{userId}}" title="{{text}}")
if avatarUrl
img.avatar.avatar-image(src="{{avatarSrc avatarUrl}}" alt="{{text}}")
else
+userAvatarInitials(userId=userId initials=initials)
span.table-page-person-name {{text}}
if count
span.table-page-people-count {{count}}
else if userId
.table-page-single-person
a.member.edit-user.js-table-page-edit-user(data-user-id="{{userId}}" title="{{text}}")
if userAvatarUrl
img.avatar.avatar-image(src="{{avatarSrc userAvatarUrl}}" alt="{{text}}")
else
+userAvatarInitials(userId=userId initials=initials)
span.table-page-single-person-name {{text}}
else if location
a.js-table-page-map(href="#" data-latitude="{{location.latitude}}" data-longitude="{{location.longitude}}" data-label="{{location.label}}" title="{{_ 'location-open-map-at'}}")
if flag
span.table-page-flag(aria-hidden="true") {{flag}}
| {{text}}
else
if flag
span.table-page-flag(aria-hidden="true") {{flag}}
| {{text}}
unless rowCount
.table-page-empty {{_ emptyKey}}
//- Where a location cell leads: this place, and which map to open it at.
//-
//- The MAP HALF of the card's location popup and nothing else. A card's popup
//- also edits the 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. What the two share is the chooser
//- itself, +mapProviderSelect, so a provider added for one is offered by both.
template(name="tablePageMapPopup")
.table-page-map-popup
if label
p.table-page-map-label {{label}}
if coordinates
p.quiet.table-page-map-coordinates {{coordinates}}
if mapUrl
a.js-open-map(href="{{mapUrl}}" target="_blank" rel="noopener noreferrer")
i.fa.fa-map-marker
| &nbsp;{{_ 'location-open-map'}}
+mapProviderSelect
button.primary.js-save-map-provider(type="button") {{_ 'save'}}
if savedMessage
p.quiet.js-map-saved {{savedMessage}}