mirror of
https://github.com/wekan/wekan.git
synced 2026-11-25 17:45:18 -05:00
One reusable component, featureHelp and featureHelpPopup, and one pure module, models/lib/featureHelp.js, that maps every place to its help and every help to the docs page its texts were written from. The ? is a real button, named and titled How it works?, at least 28 pixels, with a focus ring, at the inline end of the place's header so it is mirrored under right-to-left languages and never on top of another button: - beside the Board View menu, for the view that is on; - in the heading of the board sidebar's open view; - in every mapped popup's title bar, before maximize and close; - in each card section's heading, before its hamburger; - beside every Admin Panel, Cloud Panel and All Boards pane title (paneTitle() now also returns the open entry's paneId); - in the Workload, Budget and billing and Rules headings. The popup is wide on a desktop and a full-screen sheet on a phone, titled How it works, with What is it? and How it works? as headings and the texts as plain text. Escape closes it and gives the focus back to the ?; from inside a popup, Popup.back() now focuses the element the sub-popup's returnFocusSelector names. Thanks to xet7 !
143 lines
6.5 KiB
Plaintext
143 lines
6.5 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().
|
|
//- The ? of the open pane is at the inline end of the title (featureHelp.css),
|
|
//- chosen from the page and the pane: models/lib/featureHelp.js paneHelpId.
|
|
template(name="paneTitle")
|
|
if isLeftMenuCollapsed
|
|
h1.admin-pane-title.admin-pane-title-folded
|
|
+leftMenuCollapse(paneTitleKey=titleKey paneLabel=label)
|
|
+featureHelp(id=paneHelp)
|
|
else if titleKey
|
|
h1.admin-pane-title
|
|
| {{_ titleKey}}
|
|
+featureHelp(id=paneHelp)
|
|
else if label
|
|
h1.admin-pane-title
|
|
| {{label}}
|
|
+featureHelp(id=paneHelp)
|
|
|
|
//- 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}}
|