Skip to content

Commit 608528a

Browse files
committed
Merge branch 'main' of github.com:avo-hq/docs.avohq.io
2 parents bceaea0 + c26632b commit 608528a

File tree

10 files changed

+561
-9
lines changed

10 files changed

+561
-9
lines changed

docs/.vitepress/config.js

+6
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,12 @@ const config = {
204204
{text: "Dynamic Filters", link: "/3.0/dynamic-filters.html"},
205205
],
206206
},
207+
// {
208+
// text: "Audit Logging",
209+
// items: [
210+
// {text: "Overview", link: "/3.0/audit-logging/overview.html"},
211+
// ],
212+
// },
207213
{
208214
text: "Custom content",
209215
items: [

docs/.vitepress/theme/components/LicenseReq.vue

+5-2
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,16 @@ const links = {
1212
community: "https://avohq.io/pricing#comparison-heading",
1313
pro: "https://avohq.io/subscriptions/new?plan=pro",
1414
advanced: "https://avohq.io/subscriptions/new?plan=advanced",
15-
kanban: "mailto:avo@avohq.io?subject=I'd%20like%20to%20learn%20more%20about%20the%20Kanban%20license&body=Hi%2C%0D%0A%0D%0AI'm%20....",
16-
custom: "mailto:avo@avohq.io?subject=I'd%20like%20to%20learn%20more%20about%20the%20Custom%20license&body=Hi%2C%0D%0A%0D%0AI'm%20....",
15+
kanban: "https://savvycal.com/avo-hq/dev-chat-24",
16+
audit_logging: "https://savvycal.com/avo-hq/dev-chat-24",
17+
custom: "https://savvycal.com/avo-hq/dev-chat-24",
1718
};
1819
const labels = {
1920
community: "Community",
2021
pro: "Pro",
2122
advanced: "Advanced",
2223
kanban: "Kanban",
24+
audit_logging: "Audit logging",
2325
custom: "Custom",
2426
};
2527
const href = computed(() => links[license.value]);
@@ -37,6 +39,7 @@ const label = computed(() => labels[license.value]);
3739
'bg-blue-500 hover:bg-blue-600': license == 'pro',
3840
'bg-violet-500 hover:bg-violet-600': license == 'advanced',
3941
'bg-fuchsia-500 hover:bg-fuchsia-600': license == 'kanban',
42+
'bg-teal-500 hover:bg-teal-600': license == 'audit_logging',
4043
'bg-rose-500 hover:bg-rose-600': license == 'custom',
4144
'text-xs px-1 py-px': size == 'xs',
4245
'text-sm px-2 py-1': size == 'sm',

docs/3.0/actions.md

+61-6
Original file line numberDiff line numberDiff line change
@@ -415,13 +415,13 @@ Avo action responses are in the `turbo_stream` format. You can use the `append_t
415415

416416
```ruby{5-7}
417417
def handle(**args)
418-
succeed "Modal closed!!"
419-
close_modal
418+
succeed "Modal closed!!"
419+
close_modal
420420
421-
append_to_response -> {
422-
turbo_stream.set_title("Cool title ;)")
423-
}
424-
end
421+
append_to_response -> {
422+
turbo_stream.set_title("Cool title ;)")
423+
}
424+
end
425425
```
426426

427427
The `append_to_response` method accepts a Proc or lambda function. This function is executed within the context of the action's controller response.
@@ -446,6 +446,42 @@ append_to_response -> {
446446
:::
447447
</Option>
448448

449+
<Option name="`reload_records`">
450+
<VersionReq version="3.14.0" />
451+
452+
<div style="position: relative; padding-bottom: 56.25%; height: 0;"><iframe src="https://www.loom.com/embed/6b9ae6a3968c447f98ac4f9a161fe781?sid=17f08010-6a56-4e8c-8b80-692424327b55" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"></iframe></div>
453+
454+
:::warning
455+
This option **only** works on **Index** pages, **NOT** on **associations**.
456+
:::
457+
458+
This option leverages Turbo Stream to refresh specific table rows in response to an action. For individual records, you can use the `reload_record` alias method.
459+
460+
```ruby{8}
461+
def handle(query:, fields:, **args)
462+
query.each do |record|
463+
record.update! active: !record.active
464+
465+
record.notify fields[:message] if fields[:notify_user]
466+
end
467+
468+
reload_records(query)
469+
end
470+
```
471+
472+
The `reload_records` and `reload_record` methods are aliases, and they accept either an array of records or a single record.
473+
474+
:::code-group
475+
```ruby[Array]{1}
476+
reload_records([record_1, record_2])
477+
```
478+
479+
```ruby[Single]{1}
480+
reload_record(record)
481+
```
482+
:::
483+
</Option>
484+
449485
## Customization
450486

451487
```ruby{2-6}
@@ -563,6 +599,25 @@ self.authorize = -> {
563599
}
564600
```
565601

602+
## Actions close modal on backdrop click
603+
604+
<VersionReq version="3.14.0" />
605+
606+
By default, action modals use a dynamic backdrop. Add `self.close_modal_on_backdrop_click = false` in case you want to prevent the user from closing the modal when clicking on the backdrop.
607+
608+
```ruby{3}
609+
class Avo::Actions::DummyAction < Avo::BaseAction
610+
self.name = "Dummy action"
611+
self.close_modal_on_backdrop_click = false
612+
613+
def handle(query:, fields:, current_user:, resource:, **args)
614+
# Do something here
615+
616+
succeed 'Yup'
617+
end
618+
end
619+
```
620+
566621
## Custom action arguments
567622

568623
Actions can have different behaviors according to their host resource. In order to achieve that, arguments can receive additional arguments as follows:

0 commit comments

Comments
 (0)