Files
wekan/models/lib/sidebarViewButton.js
Lauri Ojansivu b7589737f5 File docs/Features the way the WeKan menus are.
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 !
2026-10-16 23:45:35 +03:00

35 lines
1.5 KiB
JavaScript

'use strict';
// Which way a header button that opens a sidebar VIEW goes on a click.
//
// Filter and Search only ever OPENED. Clicking one while the sidebar was
// already showing its view did nothing visible, so the button that opened the
// panel could not shut it and the only way back was the sidebar's own ✕ -
// somewhere else on screen from the thing you just clicked.
//
// They close on the second click now. `mustStayOpen` is the exception, and it
// is Filter's: with a filter on, the sidebar is the one place that says WHAT is
// being hidden from the board, and closing it would leave a board showing a
// subset of its cards with nothing on screen to say so. Search has no such
// case - its results are inside the panel and it hides nothing from the board -
// so it passes false and always toggles.
//
// Pure: two booleans in, one word out, so the guard can check every combination
// without a DOM. docs/Features/Header-Bar/Header.md
const SIDEBAR_VIEW_OPEN = 'open';
const SIDEBAR_VIEW_CLOSE = 'close';
// `isShowingView` is "the sidebar is open AND it is on THIS button's view" - a
// sidebar open on Activities is showing neither, and clicking either button
// there has to switch to it rather than close the panel.
function sidebarViewButtonAction(isShowingView, mustStayOpen) {
return isShowingView && !mustStayOpen ? SIDEBAR_VIEW_CLOSE : SIDEBAR_VIEW_OPEN;
}
module.exports = {
SIDEBAR_VIEW_OPEN,
SIDEBAR_VIEW_CLOSE,
sidebarViewButtonAction,
};