Skip to content

Commit

Permalink
Merge pull request #259 from avo-hq/fix/bad-hydration-and-component-c…
Browse files Browse the repository at this point in the history
…onvert
  • Loading branch information
adrianthedev authored Jul 26, 2024
2 parents 95f3c11 + 63557ca commit eabdf1f
Show file tree
Hide file tree
Showing 117 changed files with 1,192 additions and 1,170 deletions.
22 changes: 12 additions & 10 deletions docs/2.0/actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ end

The available action responses are:

:::option `reload`
<Option name="`reload`">

When you use `reload`, a full-page reload will be triggered.

Expand All @@ -181,8 +181,8 @@ def handle(**args)
end
```

:::
:::option `redirect_to`
</Option>
<Option name="`redirect_to`">

`redirect_to` will execute a redirect to a new path of your app. It accept `allow_other_host`, `status` and any other arguments.

Expand Down Expand Up @@ -274,25 +274,26 @@ class Update < Avo::BaseAction
end
end
```
:::

:::info `turbo_frame`
Notice the `turbo_frame: "actions_show"` present on the redirect of `PreUpdate` action. That argument is essential to have a flawless redirect between the actions.
:::
</Option>


:::option `turbo`
<Option name="`turbo`">
There are times when you don't want to perform the actions with Turbo. In such cases, turbo should be set to false.
:::
</Option>

:::option `download`
<Option name="`download`">

`download` will start a file download to your specified `path` and `filename`.

**You need to set may_download_file to true for the download response to work like below**. That's required because we can't respond with a file download (send_data) when making a Turbo request.

If you find another way, please let us know 😅.

::: code-group
:::code-group

```ruby{3,19} [app/avo/actions/download_file.rb]
class DownloadFile < Avo::BaseAction
Expand Down Expand Up @@ -327,8 +328,9 @@ class ProjectResource < Avo::BaseResource
end
```
:::
</Option>

:::option `keep_modal_open`
<Option name="`keep_modal_open`">

There might be situations where you want to run an action and if it fails, respond back to the user with some feedback but still keep it open and the inputs filled in.

Expand All @@ -355,7 +357,7 @@ class KeepModalOpenAction < Avo::BaseAction
end
end
```
:::
</Option>

## Customization

Expand Down
16 changes: 8 additions & 8 deletions docs/2.0/associations/belongs_to.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ You will see three field types when you add a `BelongsTo` association to a model

<!-- @include: ./../common/associations_searchable_option_common.md-->

:::option `allow_via_detaching`
<Option name="`allow_via_detaching`">
Keeps the field enabled when visiting from the parent record.

<!-- @include: ./../common/default_boolean_false.md-->
:::
</Option>

<!-- @include: ./../common/associations_attach_scope_option_common.md-->

:::option `polymorphic_as`
<Option name="`polymorphic_as`">
Sets the field as polymorphic with the key set on the model.

#### Default
Expand All @@ -34,9 +34,9 @@ Sets the field as polymorphic with the key set on the model.
#### Possible values

A symbol, used on the `belongs_to` association with `polymorphic: true`.
:::
</Option>

:::option `types`
<Option name="`types`">
Sets the types the field can morph to.

#### Default
Expand All @@ -46,9 +46,9 @@ Sets the types the field can morph to.
#### Possible values

`[Post, Project, Team]`. Any array of model names.
:::
</Option>

:::option `polymorphic_help`
<Option name="`polymorphic_help`">
Sets the help text for the polymorphic type dropdown. Useful when you need to specify to the user why and what they need to choose as polymorphic.

#### Default
Expand All @@ -58,7 +58,7 @@ Sets the help text for the polymorphic type dropdown. Useful when you need to sp
#### Possible values

Any string.
:::
</Option>

<!-- @include: ./../common/associations_use_resource_option_common.md-->

Expand Down
Loading

0 comments on commit eabdf1f

Please sign in to comment.