Skip to content

Commit

Permalink
callable disabled_features
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul-Bob committed Oct 9, 2024
1 parent d83a1a9 commit 1432973
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions docs/3.0/customization.md
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,15 @@ Avo.configure do |config|
end
```

<VersionReq version="3.13.5" /> `disabled_features` become callable. Within this block, you gain access to all attributes of [`Avo::ExecutionContext`](execution-context)

```ruby{3}
# config/initializers/avo.rb
Avo.configure do |config|
config.disabled_features = -> { current_user.is_admin? ? [] : [:global_search] }
end
```

After this setting, the global search will be hidden for users.

Supported options:
Expand Down
9 changes: 9 additions & 0 deletions docs/3.0/search.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,15 @@ Avo.configure do |config|
end
```

<VersionReq version="3.13.5" /> `disabled_features` become callable. Within this block, you gain access to all attributes of [`Avo::ExecutionContext`](execution-context)

```ruby{3}
# config/initializers/avo.rb
Avo.configure do |config|
config.disabled_features = -> { current_user.is_admin? ? [] : [:global_search] }
end
```

### Scope out global or resource searches

You may want to perform different searches on the `global` search from the `resource` search. You may use the `params[:global]` flag to figure that out.
Expand Down

0 comments on commit 1432973

Please sign in to comment.