Files
wekan/client/components/settings/leftMenu.jade
T
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

136 lines
6.3 KiB
Plaintext

//- The ONE left menu used by every Admin Panel page.
//- Design + the list of pages that use it: docs/Features/All-Boards/Left-Menu.md
//-
//- "Left" is the reading order, not a side: under a right-to-left language the
//- whole panel mirrors and this menu sits on the RIGHT. That comes from logical
//- CSS on .side-menu, not from anything here — see the design doc.
//-
//- The three icon shapes below are the ones the pages already used, reproduced
//- exactly so converting a page changes no pixel:
//- emoji:true an empty span.emoji-icon before the icon (Settings,
//- Features) — the span carries its own font-size rule
//- iconWrapCls:'text-red' the icon wrapped in a coloured span.emoji-icon
//- (People → Locked users)
//- neither a bare i.fa (Problems, People, Translation, Info)
//-
//- Data context: { items } from buildMenuItems() in models/lib/leftMenu.js.
template(name="leftMenu")
//- TWO roots, and the handle is the second on purpose: it is positioned
against the ROW (.content-body), not against the menu, because the menu is
its own scroll area and a handle inside it would scroll away with the
entries. Here rather than in each page's template, so a new Admin Panel page
cannot draw the menu and forget the handle.
docs/Features/All-Boards/Left-Menu.md
.side-menu(class="{{#if isLeftMenuCollapsed}}collapsed{{/if}}")
+leftMenuCollapse
ul
each items
if separator
li.left-menu-separator
hr
else if heading
//- A group title: text, not a row. No anchor, so there is nothing to
//- click and nothing for the page's click handler to read a data-id from.
li.left-menu-heading
if labelKey
| {{_ labelKey}}
else
| {{label}}
else
li(class="{{#if active}}active{{/if}} {{cls}}")
a.js-left-menu-item(class="{{jsClass}}" data-id="{{id}}")
if iconWrapCls
span.emoji-icon(class="{{iconWrapCls}}")
i.fa(class="{{icon}}")
else
if emoji
span.emoji-icon
i.fa(class="{{icon}}")
if labelKey
| {{_ labelKey}}
else
| {{label}}
+leftMenuResize
//- The grip that changes the menu's width, on its INNER edge - the right one
//- while reading left to right, the left one under a right-to-left language,
//- which the CSS mirrors by itself. It is the same gesture the right board
//- sidebar has on its own inner edge (sidebar.jade), and it is dragged the same
//- way: press, move, and the width is saved when let go.
//-
//- `nodragscroll` for the same reason the sidebar's has it: the board pages
//- drag-scroll on mousedown, and without it a drag on the grip would pan the
//- page instead of resizing the menu.
//-
//- It is positioned against the ROW around the menu rather than against the
//- menu, so it does not scroll with a long list of entries, and it follows the
//- menu because both read the same `--wekan-left-menu-width`.
//- client/components/settings/leftMenu.js, docs/Features/All-Boards/Left-Menu.md
template(name="leftMenuResize")
.left-menu-resize-handle.js-left-menu-resize.nodragscroll(
title="{{_ 'drag-to-resize-left-menu'}}"
aria-label="{{_ 'drag-to-resize-left-menu'}}"
role="separator"
aria-orientation="vertical")
//- The title of the open pane, at the top of the content beside the menu. Its text
//- is the ACTIVE menu entry's own label (paneTitle() in models/lib/leftMenu.js), so
//- every Admin Panel pane has a heading, in the same words as the row that opened
//- it and - through the one .admin-pane-title class - at the same size. The shared
//- table page puts that class on its own title, so a table pane and a form pane
//- look the same.
//-
//- FOLDED, this heading is also the way back: the menu is gone entirely - no
//- column, no strip - so the caret moves here, to the inline start of the title,
//- and the caret AND the title are one target that brings the menu back. The
//- whole heading is inside the anchor for exactly that reason.
//-
//- It is drawn even when there is no title. paneTitle() returns {} when no menu
//- entry is active, and an empty heading is better than a folded menu with
//- nothing left to unfold it.
//-
//- Data context: { titleKey } or { label } from paneTitle().
template(name="paneTitle")
if isLeftMenuCollapsed
h1.admin-pane-title.admin-pane-title-folded
+leftMenuCollapse(paneTitleKey=titleKey paneLabel=label)
else if titleKey
h1.admin-pane-title {{_ titleKey}}
else if label
h1.admin-pane-title {{label}}
//- The caret that folds the menu away.
//-
//- The same control a LIST has on a board (listHeader.jade): a caret pointing
//- DOWN while the thing is open and RIGHT once it is folded, clicked to switch.
//- It is the collapse gesture WeKan already has, so there is nothing new to
//- learn, and it uses the same two words - Collapse / Uncollapse - in its
//- tooltip.
//-
//- It is drawn TWICE, and only ever one of them is on screen, because the menu
//- itself is not drawn while it is folded:
//- * at the top of the menu, where it points down and folds the menu away;
//- * at the inline start of the pane title, where it points right and brings
//- the menu back - see `paneTitle` above, which passes the pane's title in
//- so that caret and title are ONE target rather than two.
//- One template for both places and both pages, so the carets cannot drift.
//- client/components/settings/leftMenu.js
template(name="leftMenuCollapse")
a.left-menu-collapse-indicator.js-collapse-left-menu(
title="{{collapseLabel}}"
aria-label="{{collapseLabel}}"
role="button"
tabindex="0")
if isLeftMenuCollapsed
i.fa.fa-caret-right
else
i.fa.fa-caret-down
//- The pane's own title, when this is the caret beside it. `paneTitleKey` /
//- `paneLabel` rather than the `titleKey` / `label` paneTitle() itself uses,
//- so the caret in the MENU - which inherits whatever data context the menu
//- sits in - can never pick a title up by accident.
if paneTitleKey
span.left-menu-collapse-title {{_ paneTitleKey}}
else if paneLabel
span.left-menu-collapse-title {{paneLabel}}