mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 09:59:47 -05:00
A feature's guide now sits under the menu it is used from, read from the templates rather than from where somebody once put it: Header-Bar, All-Boards, Pages, Board-Header (search and every Board View), Board-Sidebar (Board Settings, Filter, Members, Labels, Archive), Rules, Swimlanes, Lists, Cards, Member-Settings, Admin-Panel and Login-Page. Topics used from several menus (editor, history, theme, translations, email, troubleshooting) are in General. - Each area has a README mapping its menu entries to their guides and to the template or server module that implements them. Board-Header/README.md lists all 40 Board View entries with the template boardBody.jade renders; five views (Table, Calendar Mode, Time, Timeline, Map) have no guide of their own yet and say so. - Board-View.md listed 25 views while BOARD_VIEWS has 40; it now lists all of them with their English labels. - Pages keep their file names. Where a released changelog links an old path, a "# Moved" page stays there and points to the new one; test-menu.sh skips folders holding only those. - Undo was filed under Login; it is General/Undo now. - Every link in docs, code comments, scripts and tests follows the move; docsLinksResolve checks them all. Tests that read a doc follow it to its new place. boardViewSettings now fails when Board-View.md or Board-Header/README.md differs from BOARD_VIEWS, or names a template boardBody.jade does not render. Thanks to xet7 !
44 lines
1.4 KiB
JavaScript
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/All-Boards/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,
|
|
};
|