Files
wekan/client/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

71 lines
2.6 KiB
JavaScript

import { ReactiveVar } from 'meteor/reactive-var';
const {
VIEWS,
STORAGE_KEY,
normalizeAllBoardsView,
resolveAllBoardsView,
} = require('/models/lib/allBoardsView');
// The state the All Boards controls share, and where the view choice is kept.
// Design: docs/Features/Page/All-Boards.md
//
// The controls live in `boardListHeaderBar` and the boards live in `boardList`.
// Those are two SEPARATE Blaze template instances - the header bar is rendered
// into the layout's headerBar region, the page into its content region - so a
// ReactiveVar on either instance is invisible to the other. The state they share
// lives here instead, at module scope, which is what lets the search field in the
// header bar filter the list in the page.
//
// Which views exist and which is the default is models/lib/allBoardsView.js: that
// part is pure and unit-tested, this part is the Meteor and browser glue.
// Remembered per BROWSER, not on the user document: it is a view preference for
// one page, it changes nothing anybody else can see, and it is not worth a
// profile field or a round trip. A board's view IS on the profile, because it
// follows the user between devices; this deliberately does not.
const viewVar = new ReactiveVar(null);
function readStoredView() {
try {
return normalizeAllBoardsView(window.localStorage.getItem(STORAGE_KEY));
} catch (e) {
return null; // private mode, or storage disabled
}
}
export function allBoardsView() {
return resolveAllBoardsView(viewVar.get() || readStoredView());
}
export function setAllBoardsView(view) {
if (!VIEWS.includes(view)) return;
viewVar.set(view);
try {
window.localStorage.setItem(STORAGE_KEY, view);
} catch (e) {
/* the choice still applies for this session */
}
}
export function isAllBoardsView(view) {
return allBoardsView() === view;
}
// The search term and the selected section, shared for the same reason: the
// controls are in the header bar and the boards they act on are in the page.
//
// Exported as the ReactiveVars themselves, not behind getters, because
// `boardList` assigns them onto its own instance (`this.boardSearchVar = …`) -
// so every `tpl.boardSearchVar.get()` already written against an instance
// variable keeps working, and the two templates read one object instead of two.
export const allBoardsSearchVar = new ReactiveVar('');
export const allBoardsMenuVar = new ReactiveVar('starred');
export function allBoardsSearch() {
return allBoardsSearchVar.get();
}
export function setAllBoardsSearch(term) {
allBoardsSearchVar.set(typeof term === 'string' ? term : '');
}