mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 09:59:47 -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 !
19 lines
798 B
JavaScript
19 lines
798 B
JavaScript
import { TAPi18n } from '/imports/i18n';
|
|
|
|
// The caret in front of a collapsible section's heading.
|
|
//
|
|
// Down when the section is open. When it is closed it points the way the
|
|
// reader's eye travels - to the RIGHT in English and to the LEFT in Arabic,
|
|
// Hebrew and Persian - because a caret is an arrow saying "there is more this
|
|
// way", and in a mirrored page "this way" is the other way.
|
|
//
|
|
// One function, because the card's eleven sections and the board sidebar's
|
|
// Activities are the same control and must not point different directions in
|
|
// the same language.
|
|
export function caretClassFor(isOpen) {
|
|
if (isOpen) return 'fa-caret-down';
|
|
const rtl =
|
|
(TAPi18n.getLanguageDirection && TAPi18n.getLanguageDirection()) === 'rtl';
|
|
return rtl ? 'fa-caret-left' : 'fa-caret-right';
|
|
}
|