You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use this minimal wrapper component to add a border/rounding around the default action UI while keeping the action logic intact.
301
+
Keep the `<slot />` (that's where AdminForth renders the default button) and emit `callAction` (optionally with a payload) to trigger the handler when the wrapper is clicked.
You can pass arbitrary data from your custom UI wrapper to the backend action by emitting `callAction` with a payload. That payload will be available on the server under the `extra` argument of your action handler.
330
+
331
+
Frontend examples:
332
+
333
+
```vue title="./custom/ActionBorder.vue"
334
+
<template>
335
+
<!-- Two buttons that pass different flags to the action -->
336
+
<button @click="emit('callAction', { asListed: true })" class="mr-2">Mark as listed</button>
337
+
<button @click="emit('callAction', { asListed: false })">Mark as unlisted</button>
338
+
339
+
<!-- Or keep the default slot button and wrap it: -->
- If you don’t emit a payload, the default behavior is used by the UI (e.g., in lists the current row context is used). When you do provide a payload, it will be forwarded to the backend as `extra` for your action handler.
376
+
- You can combine default context with your own payload by merging before emitting, for example: `emit('callAction', { ...row, asListed: true })` if your component has access to the row object.
Copy file name to clipboardExpand all lines: adminforth/documentation/docs/tutorial/06-CLICommands.md
+13Lines changed: 13 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -353,6 +353,19 @@ Generated example:
353
353
custom/OrderShowBottomExportButton.vue
354
354
```
355
355
356
+
Special position for create/edit:
357
+
-`saveButton` — replaces the default Save button at the top bar.
358
+
359
+
Example usage via interactive flow:
360
+
```bash
361
+
adminforth component
362
+
# → CRUD Page Injections
363
+
# → (create | edit)
364
+
# → Save button
365
+
```
366
+
367
+
Your generated component will receive props documented in Page Injections → Create/Edit custom Save button. At minimum, call `props.saveRecord()` on click and respect `props.saving`, `props.isValid`, and `props.disabled`.
Copy file name to clipboardExpand all lines: adminforth/documentation/docs/tutorial/07-Plugins/02-TwoFactorsAuth.md
+70-2Lines changed: 70 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -227,7 +227,7 @@ To do it, first, create frontend custom component which wraps and intercepts cli
227
227
asyncfunction onClick() {
228
228
if (props.disabled) return;
229
229
230
-
const verificationResult =awaitwindow.adminforthTwoFaModal.get2FaConfirmationResult(); // this will ask user to enter code
230
+
const verificationResult =awaitwindow.adminforthTwoFaModal.get2FaConfirmationResult(); // this will ask user to enter code
231
231
emit('callAction', { verificationResult }); // then we pass this verification result to action (from fronted to backend)
232
232
}
233
233
</script>
@@ -303,6 +303,74 @@ options: {
303
303
}
304
304
```
305
305
306
+
## Request 2FA for create/edit (secure save gating)
307
+
308
+
To protect create and edit operations, collect the result of the 2FA modal on the frontend and send it along with the save payload. The server must verify it before writing changes.
0 commit comments