Skip to content

Commit

Permalink
update customizable controls (#152)
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul-Bob authored Dec 19, 2023
1 parent f17dae8 commit b44cfbf
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions docs/3.0/customizable-controls.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,13 @@ Renders a button that triggers an action. You must provide it an [Action](./acti

#### Supported options

`title`, `style`, `color`, and `icon`.
`title`, `style`, `color`, `arguments` and `icon`.

#### Example

```ruby
action Avo::Actions::DisableAccount
action Avo::Actions::DisableAccount, arguments: { hide_some_fields: true }
action Avo::Actions::ExportSelection, style: :text
action Avo::Actions::PublishPost, color: :fuchsia, icon: "heroicons/outline/eye"
```
Expand All @@ -204,18 +205,22 @@ When you use the `action` helper in any customizable block it will act only as a

You must manually register it with the `action` declaration.

```ruby{6,10}
```ruby{6-8,13-15}
class Avo::Resources::Fish < Avo::BaseResource
self.title = :name
self.show_controls = -> do
# In order to use it here
action Avo::Actions::ReleaseFish, style: :primary, color: :fuchsia
action Avo::Actions::ReleaseFish, style: :primary, color: :fuchsia, arguments: {
action_on_show_controls: "Will use this arguments"
}
end
# 👇 Also declare it here 👇
def actions
action Avo::Actions::ReleaseFish, arguments: { both_actions: "Will use them" }
action Avo::Actions::ReleaseFish, arguments: {
action_from_list: "Will use this arguments"
}
end
end
```
Expand Down

0 comments on commit b44cfbf

Please sign in to comment.