-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathbase_resource.rb
More file actions
31 lines (28 loc) · 835 Bytes
/
base_resource.rb
File metadata and controls
31 lines (28 loc) · 835 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
class Avo::BaseResource < Avo::Resources::Base
self.index_controls = -> {
# Don't show bulk destroy for these resources
return default_controls if resource.class.in?([
Avo::Resources::User,
Avo::Resources::Post,
Avo::Resources::Product,
Avo::Resources::Person,
Avo::Resources::Spouse,
Avo::Resources::Movie,
Avo::Resources::Fish,
])
bulk_title = tag.span(class: "text-xs") do
safe_join([
"Delete all selected #{resource.plural_name.downcase}",
tag.br,
"Select at least one #{resource.singular_name.downcase} to run this action"
])
end.html_safe
action Avo::Actions::BulkDestroy,
icon: "heroicons/solid/trash",
color: "red",
label: "",
style: :outline,
title: bulk_title
default_controls
}
end