Skip to content

Commit 5793fdf

Browse files
feature: callable filter name (#304)
* feature: callable filter name * add version req and button_label option --------- Co-authored-by: Paul Bob <paul.ionut.bob@gmail.com>
1 parent 4f19403 commit 5793fdf

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

docs/3.0/basic-filters.md

+29
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,35 @@ Each filter is configured in a class with a few dedicated [methods and options](
1313
<Option name="`self.name`">
1414

1515
`self.name` is what is going to be displayed to the user in the filters panel.
16+
17+
```ruby
18+
self.name = "User names filter"
19+
```
20+
21+
<VersionReq version="3.14.0" />
22+
23+
```ruby
24+
self.name = -> { I18n.t("avo.filter.name") }
25+
```
26+
Within this block, you gain access to all attributes of [`Avo::ExecutionContext`](execution-context) along with the `arguments`.
27+
28+
</Option>
29+
30+
<Option name="`self.button_label`">
31+
32+
The value of `self.button_label` is the label displayed on the button that applies the filter.
33+
34+
```ruby
35+
self.button_label = "Filter by user names"
36+
```
37+
38+
<VersionReq version="3.14.0" />
39+
40+
```ruby
41+
self.button_label = -> { I18n.t("avo.filter.button_label") }
42+
```
43+
Within this block, you gain access to all attributes of [`Avo::ExecutionContext`](execution-context) along with the `arguments`.
44+
1645
</Option>
1746

1847
<Option name="`self.visible`">

0 commit comments

Comments
 (0)