Skip to content

Commit

Permalink
📝 Update Controls placement documentation (#296)
Browse files Browse the repository at this point in the history
  • Loading branch information
RocKhalil authored Oct 14, 2024
1 parent 1432973 commit 7e2fa0e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
13 changes: 11 additions & 2 deletions docs/3.0/customization.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ That will render all `id` fields in the **Index** view as a link to that resourc

<Image src="/assets/img/fields-reference/as-link-to-resource.jpg" width="694" height="166" alt="As link to resource" />

## Resource controls on the left side
## Resource controls on the left or both sides
<DemoVideo demo-video="https://youtu.be/MfryUtcXqvU?t=706" />

By default, the resource controls are located on the right side of the record rows, which might be hidden if there are a lot of columns. You might want to move the controls to the left side in that situation using the `resource_controls_placement` option.
Expand All @@ -84,9 +84,18 @@ Avo.configure do |config|
end
```


<Image src="/assets/img/customization/resource-controls-left.jpg" width="1206" height="920" alt="Resource controls on the left side" />

<VersionReq version="3.13.7" class="mt-2" />

You might want to render the controls on both sides

```ruby{2}
Avo.configure do |config|
config.resource_controls_placement = :both
end
```

## Container width

```ruby{2-3}
Expand Down
19 changes: 19 additions & 0 deletions docs/3.0/resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -889,6 +889,25 @@ end

</Option>

<Option name="`self.controls_placement`">
<VersionReq version="3.13.7" />

By default, Avo renders action controls according to the `controls_placement` configuration, which is set to `right` by default. This value can be customized for each individual resource.

#### Possible values

Either `:left`, `:right` or `:both`

```ruby
class Avo::Resources::Task < Avo::BaseResource
self.controls_placement = :both

# ...
end
```

</Option>

## Cards

Use the `def cards` method to add some cards to your resource.
Expand Down

0 comments on commit 7e2fa0e

Please sign in to comment.