mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 09:59:47 -05:00
Under Edit custom fields, the Custom Fields pane has the two forms its buttons opened: Create Field (also from Board Settings, for a board admin) and Link fields to another card. In the pane the list's own two buttons are not repeated; a new field saved there empties the form for the next one, and Card Settings stays open. Opened as their own popup - the card's Custom Fields hamburger - they step back when saved, as before (client/lib/popupBack.js, now for a form drawn by more than one popup, and telling whether it stepped back). Thanks to xet7 !
16 lines
708 B
JavaScript
16 lines
708 B
JavaScript
// A form that is its own popup from the opened card (a section hamburger) and
|
|
// also part of a Card Settings pane (docs/Features/Cards/Card-Fields.md):
|
|
// saved in its own popup it steps back from it; saved in the pane, Card
|
|
// Settings stays open. `popupName` is one name or several (a form drawn by
|
|
// more than one popup). Returns whether it stepped back.
|
|
export function backIfOwnPopup(evt, popupName) {
|
|
const names = Array.isArray(popupName) ? popupName : [popupName];
|
|
const el = evt && (evt.currentTarget || evt.target);
|
|
const popup = el && el.closest && el.closest('.js-pop-over');
|
|
if (popup && names.includes(popup.dataset.popup)) {
|
|
Popup.back();
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|