mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 20:45:00 -05:00
The opened card and the minicard now draw Card Settings' sections, in
Card Settings' order, each section's fields in the order of its rows:
- Section order is per side: cardSettingsSectionOrder for the card,
the new minicardSettingsSectionOrder for the minicard. A board that
stores none: the card starts with Labels, Date, Members, Card, ...
(the card's historical order as far as the grouping allows), the
minicard with what it drew first before.
- CARD_LAYOUT's and MINICARD_LAYOUT's reorderable sections are Card
Settings' sections, so dragging a section or a row in Card Settings
moves it on the card or the minicard. Stored field orders map: a
field keeps its place relative to the others of its new section.
- On the card every section has the shared heading (its icon, title,
caret and hamburger) - Voting and Planning Poker too, which had a
heading of their own. The minicard stays compact: no headings.
Card Settings shows both sides at once: the minicard's pane first (on
the left), the card's second, each with a caret that folds it, each
scrolling on its own, stacked when the popup is too narrow for two.
The Show radio is gone. A splitter between the panes changes their
widths by dragging, like spreadsheet columns (clamped, kept per user
as a fraction, reset by a double-click, moved by the arrow keys). The
popup is wider again for two panes and its corner grip resizes it,
the panes following.
A hamburger's content opens under its line inside the pane, not in a
popup: the hamburger shows it is open (aria-expanded, highlighted, the
panel attached to it); its button, the panel's X or Escape closes it.
A custom field's edit form and the + create form open inline the same
way and close only their panel when saved. The popup layer added in
9c9742e09d is removed, as nothing uses it now.
Docs: Card-Settings.md, Card-Fields.md and Board Settings / Card.md.
New tests cardSectionsOnCard, minicardSections, cardSettingsSplit,
cardSettingsInlinePanels and card-settings-sections-order.e2e.js; the
guards of the old layouts and orders say why they changed.
Thanks to xet7 !
61 lines
2.9 KiB
JavaScript
61 lines
2.9 KiB
JavaScript
'use strict';
|
|
|
|
// Regression guard: reported directly - after adding a label to an opened
|
|
// card, clicking it in the Labels popup no longer made it wider/applied it
|
|
// to the card. It had worked in the previous release.
|
|
//
|
|
// The card detail view's reorderable sections (Labels, Dates, Members,
|
|
// Custom Fields, Description) are rendered with an `each` over the board's
|
|
// stored section order. The plain `each orderedCardFieldSections` form sets
|
|
// the DATA CONTEXT of everything inside it to the current item - the section
|
|
// NAME string ("labels", "dates", ...) - so `+cardFieldSectionLabels` and the
|
|
// Labels popup opened from its `.js-add-labels` link (Popup.open uses the
|
|
// clicked element's data context) both received a string where they
|
|
// expected the card. `templateInstance.data.toggleLabel` was then undefined
|
|
// and the click handler returned silently; `isLabelSelected ../_id` looked
|
|
// up `_id` on a string; the section's own `each labels`/`each stickers`/
|
|
// `each getLocations` rendered nothing.
|
|
//
|
|
// The `each section in orderedCardFieldSections` form keeps `this` as the
|
|
// card and exposes the item as `section`. This pins that form.
|
|
//
|
|
// Run: node tests/cardFieldSectionsKeepCardContext.test.cjs
|
|
|
|
const assert = require('assert');
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
const ROOT = path.join(__dirname, '..');
|
|
const jade = fs.readFileSync(
|
|
path.join(ROOT, 'client', 'components', 'cards', 'cardDetails.jade'), 'utf8');
|
|
|
|
let passed = 0;
|
|
function test(name, fn) { fn(); passed += 1; console.log(' ok -', name); }
|
|
|
|
console.log('cardFieldSectionsKeepCardContext:');
|
|
|
|
test('the section loop uses the context-preserving `each section in ...` form', () => {
|
|
assert.ok(/^\s*each section in orderedCardFieldSections\s*$/m.test(jade));
|
|
assert.ok(!/^\s*each orderedCardFieldSections\s*$/m.test(jade),
|
|
'the plain `each` form replaces the card data context with the section name (negative)');
|
|
});
|
|
|
|
test('every section branch compares the loop variable, not `this`', () => {
|
|
const start = jade.indexOf('each section in orderedCardFieldSections');
|
|
// 2026-10-28: the loop is the last thing of the left column (the old fixed
|
|
// tail - checklists ... comments - is sections of it now), so the block ends
|
|
// at the right column.
|
|
const block = jade.slice(start, jade.indexOf('.card-details-right', start));
|
|
const branches = [...block.matchAll(/if \$eq (\S+) "/g)].map(m => m[1]);
|
|
assert.ok(branches.length >= 5, `expected the five section branches, found ${branches.length}`);
|
|
assert.deepStrictEqual([...new Set(branches)], ['section']);
|
|
});
|
|
|
|
test('the Labels popup click handler still relies on the popup data being the card', () => {
|
|
const labels = fs.readFileSync(
|
|
path.join(ROOT, 'client', 'components', 'cards', 'labels.js'), 'utf8');
|
|
assert.ok(/const card = templateInstance\.data;[\s\S]*?await card\.toggleLabel\(labelId\)/.test(labels));
|
|
});
|
|
|
|
console.log(`\ncardFieldSectionsKeepCardContext: ${passed} tests passed`);
|