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 !
56 lines
2.5 KiB
JavaScript
56 lines
2.5 KiB
JavaScript
import { Meteor } from 'meteor/meteor';
|
|
import { ReactiveCache } from '/imports/reactiveCache';
|
|
import { currentUserWith } from '/client/lib/currentUserWith';
|
|
import { Utils } from '/client/lib/utils';
|
|
import { normalizeDependency } from '/models/metadata/dependencies';
|
|
const { canEditBoardDependencies, canEditCardDependency, normalizeMyDependencies } = require('/models/lib/dependencyAccess');
|
|
|
|
// #6732: the two dependency layers as THIS user sees them
|
|
// (docs/Features/General/Editor/RedStrings/Board-And-My-Dependencies.md). Both are off
|
|
// until the user turns them on in Member Settings, and turning one on changes
|
|
// only their own view.
|
|
|
|
export function dependencyVisibility() {
|
|
// #6745: read per minicard (newLineLayer), so only these two fields.
|
|
const user = currentUserWith(['profile.showBoardDependencies', 'profile.showMyDependencies']);
|
|
const profile = (user || {}).profile || {};
|
|
return { board: profile.showBoardDependencies === true, mine: profile.showMyDependencies === true };
|
|
}
|
|
|
|
export function canEditBoardDependenciesHere(board) {
|
|
return !!board && canEditBoardDependencies(board, Meteor.userId());
|
|
}
|
|
|
|
// Where a line drawn on the board goes: the Board Dependencies when they are
|
|
// shown and this user may edit them, otherwise My Dependencies when those are
|
|
// shown. With neither, nothing is drawn and no connect handle appears.
|
|
export function newLineLayer(board) {
|
|
const shown = dependencyVisibility();
|
|
if (shown.board && canEditBoardDependenciesHere(board)) return 'board';
|
|
if (shown.mine && Meteor.userId()) return 'mine';
|
|
return null;
|
|
}
|
|
|
|
// This user's own lines on one board.
|
|
export function myDependencyLines(boardId) {
|
|
const profile = (ReactiveCache.getCurrentUser() || {}).profile || {};
|
|
return normalizeMyDependencies(profile.myDependencies, normalizeDependency).filter(row => row.boardId === boardId);
|
|
}
|
|
|
|
// May this user edit this card's Board Dependencies? A linked card's live on
|
|
// the card it points at, as the server resolves them.
|
|
export function canEditCardDependenciesHere(card) {
|
|
const real = card && typeof card.getRealCard === 'function' ? card.getRealCard() : card;
|
|
const board = real && ReactiveCache.getBoard(real.boardId);
|
|
return !!(board && real && canEditCardDependency(board, Meteor.userId(), real));
|
|
}
|
|
|
|
// The open card's (card details).
|
|
Template.registerHelper('canEditBoardDependencies', () =>
|
|
canEditCardDependenciesHere(ReactiveCache.getCard(Utils.getCurrentCardId())));
|
|
|
|
Template.registerHelper('showAnyDependencies', () => {
|
|
const shown = dependencyVisibility();
|
|
return shown.board || shown.mine;
|
|
});
|