From b5b0193110bbafa58cb546f05c08d9a9b2e818ec Mon Sep 17 00:00:00 2001
From: Paul Bob <69730720+Paul-Bob@users.noreply.github.com>
Date: Fri, 29 Nov 2024 00:38:23 +0200
Subject: [PATCH] callable action labels (#319)
---
docs/3.0/actions.md | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/docs/3.0/actions.md b/docs/3.0/actions.md
index ee2d2db3..66463ffd 100644
--- a/docs/3.0/actions.md
+++ b/docs/3.0/actions.md
@@ -496,7 +496,7 @@ end
### Callable options
-Both `name` and `message` allow a block. Within this block, you gain access to all attributes of [`Avo::ExecutionContext`](execution-context) along with the `record` (if on show view), `resource`, `arguments` and `view`.
+Both `name` and `message` (and since `confirm_button_label` and `cancel_button_label`) allow a block. Within this block, you gain access to all attributes of [`Avo::ExecutionContext`](execution-context) along with the `record` (if on show view), `resource`, `arguments` and `view`.
### Customize the name
```ruby
@@ -513,6 +513,18 @@ end
You may customize the labels for the action buttons using `confirm_button_label` and `cancel_button_label`.
+
+
+ `confirm_button_label` and `cancel_button_label` became callable options.
+
+The blocks are executed using [`Avo::ExecutionContext`](execution-context). Within this blocks, you gain access to all attributes of [`Avo::ExecutionContext`](execution-context) along with the `resource`, `record`, `view` and `arguments`.
+
+```ruby{2,3}
+class Avo::Actions::ReleaseFish < Avo::BaseAction
+ self.confirm_button_label = -> { "Release #{record.name}" }
+ self.cancel_button_label = -> { "Cancel release on #{record.name}" }
+end
+```
### No confirmation actions