Inline-edit the type badge directly in the table
Clicking a row's type badge swaps it for a native <select> in place; picking a new value POSTs to a new endpoint (LedgerActionsController::updateType) instead of opening the full edit modal for this one field. The endpoint goes through the normal node save() lifecycle, so figli_compta_ledger_node_presave() still forces a proper revision and still enforces the répartition invariant -- nothing here bypasses that. It also clears a stale field_entree_liee when the new type is no longer linkable (versement/achat/hébergement), mirroring the full form's #states visibility rule. CSRF-protected via core's own /session/token, scoped to CsrfRequestHeaderAccessCheck::TOKEN_KEY to match what that endpoint actually generates. Verified end-to-end via the real click flow: correct revision (user + timestamp), correct optimistic UI update, correct field_entree_liee clearing, and 400/403 on invalid type / missing CSRF respectively.
This commit is contained in:
@@ -217,6 +217,24 @@ html.gin--dark-mode #figli-home-app {
|
||||
#figli-home-app .type-ouverture { background: #7c3aed1a; color: #9061f0; }
|
||||
#figli-home-app .type-autre { background: #6b72801a; color: var(--figli-text-light); }
|
||||
|
||||
/* Click-to-edit type badge -- swaps for a native <select> in place
|
||||
(figli-type-select below), no modal needed for this one field. */
|
||||
#figli-home-app .figli-badge-editable {
|
||||
cursor: pointer;
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
#figli-home-app .figli-badge-editable:hover {
|
||||
border-color: currentColor;
|
||||
}
|
||||
#figli-home-app .figli-type-select {
|
||||
font-size: 0.72rem;
|
||||
padding: 0.05rem 0.2rem;
|
||||
background: var(--figli-bg);
|
||||
color: var(--figli-text);
|
||||
border: 1px solid var(--figli-border);
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
#figli-home-app .figli-note {
|
||||
color: var(--figli-text-light);
|
||||
font-weight: 400;
|
||||
@@ -315,3 +333,14 @@ html.gin--dark-mode #figli-home-app {
|
||||
padding: 0.75rem 1rem;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
/* Dismissible, doesn't replace the table like the top-level fetch error
|
||||
does -- a failed inline type change is a small hiccup, not a reason to
|
||||
hide everything that's already loaded. */
|
||||
#figli-home-app .figli-inline-error {
|
||||
margin-bottom: 1rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user