mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 18:10:06 -05:00
Board Settings / Card Settings is a table of twenty-four settings in two columns - what a card shows, and what a minicard shows - and it lived in one place only, four clicks from the card whose fields it decides. It is now also the first entry of the two menus it is about: the opened card's hamburger offers Show on Card, a minicard's offers Show on Minicard, each followed by a rule like every other group in those menus. Both open the SAME popup with the other column hidden by a class, so there is one list of settings and one set of handlers; a setting added to the table appears in all three places by itself. The permission is the one Board Settings already used - a board admin - asked in the menu and again where it acts. The menu is opened from two places and its data context is the card either way, so the opener records which hamburger it was in a module-level reactive value rather than a field on the card document, which a re-render throws away. "Hide minicard label text" left the right sidebar, where nothing else about a minicard is, and became the "Labels text" row of the same table, directly under Labels. It is ticked when the text is SHOWN, which is the default: the stored flag is a "hidden" one, and reading it straight through would leave the box unticked for the behaviour a board has out of the box. It is the one personal row of a board-wide table, so it shows in the minicard's view only, is offered to everybody, and a reader who is not a board admin gets that row alone. The move found a bug: the setting was written out three times and the minicard's own copy only ever wrote localStorage, so a logged-in user toggling it set something nothing reads. One module reads and writes it now. The board sidebar's Activities heading had an eye and the words "Show activities" beside it - one setting with two controls and its own name twice. It is a caret in front of the heading now, and the heading is the button, which is what every collapsible section of an opened card already is. Both take the caret's direction from one function, so it cannot point one way on a card and another in the sidebar of the same language. tests/showOnCardMenus.test.cjs pins all of it. The Sandstorm and Scaling docs name the new route beside the old one, and the developer directory structure lists the three new client/lib modules. Thanks to xet7 !
27 lines
1.1 KiB
JavaScript
27 lines
1.1 KiB
JavaScript
import { ReactiveVar } from 'meteor/reactive-var';
|
|
|
|
// Which menu the card's action popup was opened from.
|
|
//
|
|
// `cardDetailsActionsPopup` is ONE template opened from two places: the
|
|
// hamburger on an opened card, and the hamburger on a minicard on the board.
|
|
// Almost everything in it is the same from both - it acts on the same card -
|
|
// but the first entry is not: the card's menu offers "Show on Card" and the
|
|
// minicard's offers "Show on Minicard", because that is the thing you are
|
|
// looking at when you reach for the menu.
|
|
//
|
|
// The popup cannot tell where it was opened from by itself (its data context is
|
|
// the card either way), so the opener says so here and the popup reads it. A
|
|
// module-level ReactiveVar rather than a field on the data context: the context
|
|
// is a Card document, and a field added to one is gone the next time Blaze
|
|
// re-renders the popup with a fresh copy of it (the same trap #6479 described
|
|
// for the confirmation popups).
|
|
const source = new ReactiveVar('card');
|
|
|
|
export function setCardMenuSource(next) {
|
|
source.set(next === 'minicard' ? 'minicard' : 'card');
|
|
}
|
|
|
|
export function cardMenuSource() {
|
|
return source.get();
|
|
}
|