mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 18:10:06 -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 !
81 lines
3.0 KiB
JavaScript
81 lines
3.0 KiB
JavaScript
'use strict';
|
|
|
|
// Which controls the shared page sidebar shows, per page.
|
|
//
|
|
// A page's controls used to live in its own second header bar, beside its `h1`.
|
|
// The title moved to the first bar (models/lib/pageTitles.js) and the controls
|
|
// moved into a right sidebar, so a page is its content plus one panel rather
|
|
// than its content plus a strip of buttons above it.
|
|
//
|
|
// A board has its own sidebar and All Boards has its own; this is for every
|
|
// OTHER page. Most have no controls at all - their second bar was only a title
|
|
// - and those get no sidebar and no hamburger, because an empty panel is worse
|
|
// than none.
|
|
//
|
|
// Pure: a route name in, a Blaze template name out. No Meteor, no router.
|
|
// docs/Features/Header-Bar/Header.md
|
|
|
|
// routeName -> the template that draws that page's controls.
|
|
const PAGE_SIDEBAR_TEMPLATES = {
|
|
'my-cards': 'myCardsControls',
|
|
'due-cards': 'dueCardsControls',
|
|
'global-search': 'globalSearchControls',
|
|
};
|
|
|
|
// The routes that have their own sidebar already, and so must NOT get this one.
|
|
const OWN_SIDEBAR_ROUTES = [
|
|
// Every board route: the board sidebar. The Rules page is a page of the
|
|
// board and uses it too; its own sidebar, which held only its views, is gone
|
|
// - they are in Board Settings under Rules, in the board sidebar.
|
|
'board', 'card', 'boardCard', 'board-rules',
|
|
// All Boards and its sections, and Public: the All Boards sidebar.
|
|
'home', 'allboards', 'allboards-templates', 'allboards-remaining', 'public',
|
|
];
|
|
|
|
// ...and of those, the routes that must NOT be offered the HAMBURGER.
|
|
//
|
|
// All Boards has a sidebar, but nothing opens it from the top of the panel any
|
|
// more: its four controls are in the first header bar, and Search and
|
|
// Multi-Selection open the sidebar straight into their own view. The
|
|
// hamburger's only destination was a home view listing those same four things,
|
|
// so it opened a menu to reach what is now one click away.
|
|
//
|
|
// A board keeps its hamburger: what its sidebar holds - members, labels,
|
|
// activities, settings - is not in the bar and has nowhere else to be opened
|
|
// from.
|
|
const NO_HAMBURGER_ROUTES = [
|
|
'home', 'allboards', 'allboards-templates', 'allboards-remaining', 'public',
|
|
];
|
|
|
|
function hasHamburger(routeName) {
|
|
return !NO_HAMBURGER_ROUTES.includes(routeName);
|
|
}
|
|
|
|
function hasOwnSidebar(routeName) {
|
|
return OWN_SIDEBAR_ROUTES.includes(routeName);
|
|
}
|
|
|
|
// The controls template for a route, or null when that page has none.
|
|
function pageSidebarTemplate(routeName) {
|
|
if (hasOwnSidebar(routeName)) return null;
|
|
return Object.prototype.hasOwnProperty.call(PAGE_SIDEBAR_TEMPLATES, routeName)
|
|
? PAGE_SIDEBAR_TEMPLATES[routeName]
|
|
: null;
|
|
}
|
|
|
|
// Whether the hamburger should be offered at all. A page with no sidebar and
|
|
// nothing to put in one must not show a control that opens an empty panel.
|
|
function hasPageSidebar(routeName) {
|
|
return pageSidebarTemplate(routeName) !== null;
|
|
}
|
|
|
|
module.exports = {
|
|
PAGE_SIDEBAR_TEMPLATES,
|
|
OWN_SIDEBAR_ROUTES,
|
|
NO_HAMBURGER_ROUTES,
|
|
hasOwnSidebar,
|
|
hasHamburger,
|
|
pageSidebarTemplate,
|
|
hasPageSidebar,
|
|
};
|