Files
wekan/models/lib/allBoardsView.js
T
Lauri Ojansivu daaf563910 Docs: implemented designs move to docs/Features, filed the way the menu is.
A design that describes what WeKan already DOES belongs with the feature it
describes, not in the folder for things being proposed. Fifteen docs move:

  Design/Accessibility.md      -> Features/Accessibility/Accessibility-Improvements.md
  Design/Original-Positions.md -> Features/Board/Original-Positions.md
  Design/Page/*                -> Features/Page/*   (thirteen pages that exist)
  Design/AdminPanelProblems.md -> Features/Admin-Panel/Problems/Design.md

What stays in docs/Design is what the folder is for: the principles
(Design-Principles, Monkey-Proof-Software), the comparisons, the roadmap
(Multiverse), and the proposals not yet built (Multitenancy, Autoupdate).

The Admin Panel Problems design is new and covers six changes - summaries, the
per-actor tally, IPv4/IPv6 columns, an API report, a per-address login tally,
and blocking with increasing delays. Three are shipped and three are planned;
it is filed under the feature because the pane exists, with each planned item
marked so it can become plain description as it lands.

Every reference in the repository is rewritten - 152 files, including the CSS
comments that point at the table-page design, which a first pass over .md and
.js alone missed. Two suites asserted the old paths and now assert the new
ones. A moved doc whose links nobody fixed is worse than one nobody moved.

Thanks to xet7 !
2026-08-16 15:15:01 +03:00

44 lines
1.4 KiB
JavaScript

'use strict';
// Which views the All Boards page has, and which one an account that has never
// chosen sees. Design: docs/Features/Page/All-Boards.md
//
// Pure — no Meteor, no DOM, no storage — so the answer to "is this a view?" and
// "what is the default?" is unit-testable. The ReactiveVars and the localStorage
// that carry the CHOICE live in client/lib/allBoardsView.js, which is Meteor and
// cannot be loaded in a plain Node test.
const VIEW_LISTS = 'lists';
const VIEW_TABLE = 'table';
// In the order the view menu offers them. Lists first because it is the default.
const VIEWS = [VIEW_LISTS, VIEW_TABLE];
const STORAGE_KEY = 'wekan-all-boards-view';
// The board icons: what the page has always been, and what it still is unless the
// user says otherwise.
const DEFAULT_VIEW = VIEW_LISTS;
// A stored (or otherwise untrusted) value as a view, or null when it is not one.
// Null rather than the default, so a caller can tell "never chosen" from "chose
// Lists" — and so a value left by a future version does not render nothing.
function normalizeAllBoardsView(value) {
return VIEWS.includes(value) ? value : null;
}
// The view to use given whatever was stored.
function resolveAllBoardsView(stored) {
return normalizeAllBoardsView(stored) || DEFAULT_VIEW;
}
module.exports = {
VIEW_LISTS,
VIEW_TABLE,
VIEWS,
STORAGE_KEY,
DEFAULT_VIEW,
normalizeAllBoardsView,
resolveAllBoardsView,
};