mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 09:59:47 -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 !
53 lines
3.8 KiB
JavaScript
53 lines
3.8 KiB
JavaScript
'use strict';
|
|
|
|
// Jira issue types as a first-class minicard badge (models/lib/issueTypeIcon.js).
|
|
// Run: node tests/issueTypeIcon.test.cjs
|
|
|
|
const assert = require('node:assert/strict');
|
|
const fs = require('node:fs');
|
|
const path = require('node:path');
|
|
const { execFileSync } = require('node:child_process');
|
|
const { issueTypeBadge } = require('../models/lib/issueTypeIcon.js');
|
|
|
|
const read = file => fs.readFileSync(path.join(__dirname, '..', file), 'utf8');
|
|
|
|
assert.deepEqual(issueTypeBadge('Bug'), { name: 'Bug', icon: 'fa-bug', tone: 'red' });
|
|
assert.equal(issueTypeBadge('Sub-task').icon, 'fa-level-down', 'hyphen and case do not matter');
|
|
assert.equal(issueTypeBadge('SUB TASK').icon, 'fa-level-down');
|
|
assert.equal(issueTypeBadge('User Story').icon, 'fa-bookmark');
|
|
assert.equal(issueTypeBadge('New Feature').icon, 'fa-plus-square');
|
|
assert.equal(issueTypeBadge('Epic').tone, 'purple');
|
|
// A site's own type keeps its name with a neutral icon.
|
|
assert.deepEqual(issueTypeBadge(' Customer Escalation '), { name: 'Customer Escalation', icon: 'fa-circle-o', tone: 'grey' });
|
|
// Negative: nothing to show.
|
|
for (const none of [undefined, null, '', ' ', 5, {}]) assert.equal(issueTypeBadge(none), null, String(none));
|
|
assert.equal(issueTypeBadge('x'.repeat(300)).name.length, 100, 'bounded like the stored value');
|
|
console.log(' ok - issue types map to icons, and anything else keeps its name');
|
|
|
|
// Wiring: shown from the stored Jira value on every board, and no longer also
|
|
// as a Scrum minicard text field.
|
|
assert.match(read('client/components/cards/minicard.js'), /issueTypeBadge\(\) \{\s*return issueTypeBadge\(this\.scrum && this\.scrum\.issueType\);/);
|
|
const jade = read('client/components/cards/minicard.jade');
|
|
// Since Board Settings / Card orders the minicard badges, the type is one of
|
|
// them ("Scrum settings: Work item type"), behind its own board toggle, which
|
|
// defaults on - so it stays first and shown on every board unless turned off.
|
|
// (2026-10-28: a badge of the minicard's badge strips, drawn in Card
|
|
// Settings' Scrum section - models/lib/minicardGroups.js.)
|
|
assert.ok(require('../models/lib/minicardGroups').BADGE_FIELDS.includes('scrumIssueType'));
|
|
assert.match(jade, /else if group\.badges\n\s+\.badges\n\s+each field in group\.fields\n[\s\S]{0,1200}if \$eq field "scrumIssueType"\n\s*if showIssueTypeOnMinicard\n\s*if issueTypeBadge\n\s*\.badge\.minicard-issue-type\(class="issue-type-\{\{issueTypeBadge\.tone\}\}" title="\{\{issueTypeBadge\.name\}\}"\)/);
|
|
// (Read through the minicard's view of the board, so the Scrum settings
|
|
// section hidden whole on Show on Minicard in Card Settings hides it too.)
|
|
assert.match(read('client/components/cards/minicard.js'), /showIssueTypeOnMinicard\(\) \{\s*return minicardBoardOf\(this\)\?\.allowsIssueTypeOnMinicard !== false;/,
|
|
'on unless the board turned it off');
|
|
assert.doesNotMatch(jade.slice(jade.indexOf('if issueTypeBadge') - 400, jade.indexOf('if issueTypeBadge')), /scrum\.enabled/,
|
|
'not gated on the board using Scrum');
|
|
const scrumFields = read('client/components/boards/scrum/scrumFields.js');
|
|
const minicardDefs = scrumFields.slice(scrumFields.indexOf(' minicard: ['), scrumFields.indexOf('\n', scrumFields.indexOf(' minicard: [')));
|
|
assert.doesNotMatch(minicardDefs, /IssueType/, 'no second, text-only copy on the minicard');
|
|
assert.match(read('models/lib/jiraScrumMetadata.js'), /normalizeScrumMetadata\('card', \{ issueType: fields\.issuetype\.name \}\)/,
|
|
'Jira imports still store the type where the badge reads it');
|
|
// The minicard module still parses: a source check alone missed an import
|
|
// line placed inside a multi-line import, which broke the whole client.
|
|
execFileSync(process.execPath, ['--input-type=module', '--check'], { input: read('client/components/cards/minicard.js') });
|
|
console.log(' ok - the minicard shows the stored Jira type once, on every board');
|