avo 2.11.3.pre.3 → 2.13.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of avo might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -4
- data/README.md +2 -1
- data/app/components/avo/actions_component.html.erb +3 -3
- data/app/components/avo/actions_component.rb +12 -3
- data/app/components/avo/button_component.rb +1 -3
- data/app/components/avo/card_component.html.erb +8 -8
- data/app/components/avo/fields/common/gravatar_viewer_component.html.erb +1 -1
- data/app/components/avo/fields/date_field/edit_component.html.erb +0 -3
- data/app/components/avo/fields/date_time_field/edit_component.html.erb +0 -2
- data/app/components/avo/fields/has_one_field/show_component.html.erb +1 -1
- data/app/components/avo/fields/tags_field/show_component.rb +0 -2
- data/app/components/avo/index/ordering/buttons_component.html.erb +1 -1
- data/app/components/avo/index/resource_controls_component.rb +1 -1
- data/app/components/avo/item_switcher_component.html.erb +1 -1
- data/app/components/avo/panel_component.html.erb +1 -1
- data/app/components/avo/panel_component.rb +3 -4
- data/app/components/avo/resource_component.rb +6 -4
- data/app/components/avo/tab_group_component.html.erb +1 -1
- data/app/components/avo/tab_switcher_component.rb +2 -2
- data/app/components/avo/views/resource_edit_component.html.erb +1 -1
- data/app/components/avo/views/resource_edit_component.rb +1 -21
- data/app/components/avo/views/resource_index_component.html.erb +49 -97
- data/app/components/avo/views/resource_index_component.rb +19 -0
- data/app/components/avo/views/resource_show_component.html.erb +139 -53
- data/app/components/avo/views/resource_show_component.rb +1 -0
- data/app/controllers/avo/application_controller.rb +7 -3
- data/app/controllers/avo/associations_controller.rb +2 -2
- data/app/controllers/avo/base_controller.rb +11 -18
- data/app/controllers/avo/cards_controller.rb +5 -18
- data/app/controllers/avo/dashboards_controller.rb +2 -4
- data/app/controllers/avo/search_controller.rb +57 -20
- data/app/javascript/js/controllers/{card_controller.js → dashboard_card_controller.js} +0 -0
- data/app/javascript/js/controllers/menu_controller.js +2 -2
- data/app/javascript/js/controllers/search_controller.js +42 -15
- data/app/javascript/js/controllers.js +2 -2
- data/app/views/avo/associations/new.html.erb +1 -0
- data/app/views/avo/cards/_metric_card.html.erb +2 -2
- data/app/views/avo/dashboards/show.html.erb +20 -3
- data/app/views/avo/debug/index.html.erb +1 -1
- data/app/views/avo/debug/report.html.erb +1 -0
- data/app/views/avo/home/index.html.erb +1 -1
- data/app/views/avo/partials/_resource_search.html.erb +6 -0
- data/app/views/avo/private/design.html.erb +2 -2
- data/config/routes.rb +0 -3
- data/lib/avo/base_card.rb +21 -40
- data/lib/avo/base_resource.rb +5 -2
- data/lib/avo/concerns/has_editable_controls.rb +34 -0
- data/lib/avo/concerns/has_fields.rb +11 -10
- data/lib/avo/dashboards/base_dashboard.rb +50 -15
- data/lib/avo/dashboards/base_divider.rb +1 -5
- data/lib/avo/dashboards/chartkick_card.rb +4 -5
- data/lib/avo/fields/base_field.rb +13 -7
- data/lib/avo/fields/date_field.rb +1 -3
- data/lib/avo/fields/field_extensions/has_include_blank.rb +1 -1
- data/lib/avo/fields/field_extensions/visible_in_different_views.rb +1 -12
- data/lib/avo/fields/has_base_field.rb +18 -1
- data/lib/avo/fields/key_value_field.rb +6 -6
- data/lib/avo/hosts/base_host.rb +2 -1
- data/lib/avo/hosts/dashboard_card.rb +1 -1
- data/lib/avo/hosts/search_scope_host.rb +7 -0
- data/lib/avo/licensing/h_q.rb +12 -4
- data/lib/avo/licensing/pro_license.rb +1 -0
- data/lib/avo/menu/builder.rb +2 -0
- data/lib/avo/resources/controls/action.rb +32 -0
- data/lib/avo/resources/controls/actions_list.rb +19 -0
- data/lib/avo/resources/controls/back_button.rb +13 -0
- data/lib/avo/resources/controls/base_control.rb +59 -0
- data/lib/avo/resources/controls/delete_button.rb +13 -0
- data/lib/avo/resources/controls/detach_button.rb +13 -0
- data/lib/avo/resources/controls/edit_button.rb +13 -0
- data/lib/avo/resources/controls/execution_context.rb +58 -0
- data/lib/avo/resources/controls/items_holder.rb +19 -0
- data/lib/avo/resources/controls/link_to.rb +27 -0
- data/lib/avo/tab.rb +1 -3
- data/lib/avo/version.rb +1 -1
- data/lib/generators/avo/templates/action.tt +1 -1
- data/lib/generators/avo/templates/cards/partial_card_partial.tt +1 -1
- data/lib/generators/avo/templates/initializer/avo.tt +1 -0
- data/lib/generators/avo/templates/resource/resource.tt +1 -1
- data/lib/generators/avo/templates/resource_tools/partial.tt +1 -1
- data/lib/generators/avo/templates/standalone_action.tt +1 -1
- data/public/avo-assets/avo.css +592 -124
- data/public/avo-assets/avo.js +48 -48
- data/public/avo-assets/avo.js.map +3 -3
- metadata +17 -10
- data/app/components/avo/cards_list_component.html.erb +0 -16
- data/app/components/avo/cards_list_component.rb +0 -13
- data/lib/avo/concerns/has_cards.rb +0 -88
- data/lib/avo/concerns/has_model.rb +0 -11
- data/lib/avo/concerns/styles_cards.rb +0 -48
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: avo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adrian Marin
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2022-08-
|
12
|
+
date: 2022-08-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -805,8 +805,6 @@ files:
|
|
805
805
|
- app/components/avo/button_component.rb
|
806
806
|
- app/components/avo/card_component.html.erb
|
807
807
|
- app/components/avo/card_component.rb
|
808
|
-
- app/components/avo/cards_list_component.html.erb
|
809
|
-
- app/components/avo/cards_list_component.rb
|
810
808
|
- app/components/avo/common_field_wrapper_component.html.erb
|
811
809
|
- app/components/avo/common_field_wrapper_component.rb
|
812
810
|
- app/components/avo/dashboards/divider_component.html.erb
|
@@ -1073,8 +1071,8 @@ files:
|
|
1073
1071
|
- app/javascript/js/controllers/attachments_controller.js
|
1074
1072
|
- app/javascript/js/controllers/base_controller.js
|
1075
1073
|
- app/javascript/js/controllers/boolean_filter_controller.js
|
1076
|
-
- app/javascript/js/controllers/card_controller.js
|
1077
1074
|
- app/javascript/js/controllers/copy_to_clipboard_controller.js
|
1075
|
+
- app/javascript/js/controllers/dashboard_card_controller.js
|
1078
1076
|
- app/javascript/js/controllers/fields/belongs_to_field_controller.js
|
1079
1077
|
- app/javascript/js/controllers/fields/code_field_controller.js
|
1080
1078
|
- app/javascript/js/controllers/fields/date_field_controller.js
|
@@ -1178,14 +1176,12 @@ files:
|
|
1178
1176
|
- lib/avo/base_resource_tool.rb
|
1179
1177
|
- lib/avo/concerns/fetches_things.rb
|
1180
1178
|
- lib/avo/concerns/handles_field_args.rb
|
1181
|
-
- lib/avo/concerns/
|
1179
|
+
- lib/avo/concerns/has_editable_controls.rb
|
1182
1180
|
- lib/avo/concerns/has_fields.rb
|
1183
1181
|
- lib/avo/concerns/has_html_attributes.rb
|
1184
|
-
- lib/avo/concerns/has_model.rb
|
1185
1182
|
- lib/avo/concerns/has_stimulus_controllers.rb
|
1186
1183
|
- lib/avo/concerns/is_resource_item.rb
|
1187
1184
|
- lib/avo/concerns/model_class_constantized.rb
|
1188
|
-
- lib/avo/concerns/styles_cards.rb
|
1189
1185
|
- lib/avo/configuration.rb
|
1190
1186
|
- lib/avo/configuration/resource_configuration.rb
|
1191
1187
|
- lib/avo/dashboards/base_dashboard.rb
|
@@ -1248,6 +1244,7 @@ files:
|
|
1248
1244
|
- lib/avo/hosts/dashboard_visibility.rb
|
1249
1245
|
- lib/avo/hosts/ordering.rb
|
1250
1246
|
- lib/avo/hosts/record_host.rb
|
1247
|
+
- lib/avo/hosts/search_scope_host.rb
|
1251
1248
|
- lib/avo/hosts/view_record_host.rb
|
1252
1249
|
- lib/avo/html/builder.rb
|
1253
1250
|
- lib/avo/items_holder.rb
|
@@ -1273,6 +1270,16 @@ files:
|
|
1273
1270
|
- lib/avo/panel.rb
|
1274
1271
|
- lib/avo/panel_builder.rb
|
1275
1272
|
- lib/avo/reloader.rb
|
1273
|
+
- lib/avo/resources/controls/action.rb
|
1274
|
+
- lib/avo/resources/controls/actions_list.rb
|
1275
|
+
- lib/avo/resources/controls/back_button.rb
|
1276
|
+
- lib/avo/resources/controls/base_control.rb
|
1277
|
+
- lib/avo/resources/controls/delete_button.rb
|
1278
|
+
- lib/avo/resources/controls/detach_button.rb
|
1279
|
+
- lib/avo/resources/controls/edit_button.rb
|
1280
|
+
- lib/avo/resources/controls/execution_context.rb
|
1281
|
+
- lib/avo/resources/controls/items_holder.rb
|
1282
|
+
- lib/avo/resources/controls/link_to.rb
|
1276
1283
|
- lib/avo/services/authorization_service.rb
|
1277
1284
|
- lib/avo/services/uri_service.rb
|
1278
1285
|
- lib/avo/tab.rb
|
@@ -1379,9 +1386,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
1379
1386
|
version: 2.4.0
|
1380
1387
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
1381
1388
|
requirements:
|
1382
|
-
- - "
|
1389
|
+
- - ">="
|
1383
1390
|
- !ruby/object:Gem::Version
|
1384
|
-
version:
|
1391
|
+
version: '0'
|
1385
1392
|
requirements: []
|
1386
1393
|
rubygems_version: 3.3.3
|
1387
1394
|
signing_key:
|
@@ -1,16 +0,0 @@
|
|
1
|
-
<%= content_tag(:div, class: "grid gap-4 grid-cols-1 #{parent.class.cards_classes}") do %>
|
2
|
-
<% parent.cards.each do |card| %>
|
3
|
-
<% if card.is_divider? %>
|
4
|
-
<%= render Avo::Dashboards::DividerComponent.new(divider: card) %>
|
5
|
-
<% elsif card.is_card? %>
|
6
|
-
<%= content_tag(:div, class: "relative bg-white rounded shadow-panel space-y-2 overflow-hidden h-full #{card.card_classes}") do %>
|
7
|
-
<turbo-frame id="<%= card.turbo_frame %>"
|
8
|
-
src="<%= card.frame_url(enforced_range: @range, params: params) %>"
|
9
|
-
data-card-index="<%= card.index %>"
|
10
|
-
>
|
11
|
-
<%= render(Avo::LoadingComponent.new(title: card.label)) %>
|
12
|
-
</turbo-frame>
|
13
|
-
<% end %>
|
14
|
-
<% end %>
|
15
|
-
<% end %>
|
16
|
-
<% end %>
|
@@ -1,88 +0,0 @@
|
|
1
|
-
module Avo
|
2
|
-
module Concerns
|
3
|
-
module HasCards
|
4
|
-
extend ActiveSupport::Concern
|
5
|
-
|
6
|
-
included do
|
7
|
-
class_attribute :cards_holder
|
8
|
-
class_attribute :cards_index, default: 0
|
9
|
-
class_attribute :grid_cols, default: 3
|
10
|
-
|
11
|
-
delegate :item_at_index, to: :class
|
12
|
-
|
13
|
-
def cards
|
14
|
-
return [] if self.class.cards.blank?
|
15
|
-
|
16
|
-
view = self&.view
|
17
|
-
|
18
|
-
self.class.cards
|
19
|
-
.map do |card|
|
20
|
-
# Try to hydrate the card
|
21
|
-
card.hydrate(parent: self, params: params, view: view) if card.is_card?
|
22
|
-
|
23
|
-
card
|
24
|
-
end
|
25
|
-
.select do |card|
|
26
|
-
# If we don't get a view return all cards
|
27
|
-
return true if view.nil?
|
28
|
-
|
29
|
-
card.send("show_on_#{view}")
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
class_methods do
|
35
|
-
def card(klass, label: nil, description: nil, cols: nil, rows: nil, refresh_every: nil, options: {}, visible_on: nil, **args)
|
36
|
-
self.cards_holder ||= []
|
37
|
-
|
38
|
-
self.cards_holder << klass.new(
|
39
|
-
parent: self,
|
40
|
-
options: options,
|
41
|
-
index: cards_index,
|
42
|
-
label: label,
|
43
|
-
description: description,
|
44
|
-
cols: cols,
|
45
|
-
rows: rows,
|
46
|
-
refresh_every: refresh_every,
|
47
|
-
**args
|
48
|
-
)
|
49
|
-
self.cards_index += 1
|
50
|
-
end
|
51
|
-
|
52
|
-
def item_at_index(index)
|
53
|
-
cards.find do |item|
|
54
|
-
next if item.index.blank?
|
55
|
-
|
56
|
-
item.index == index
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
def divider(**args)
|
61
|
-
self.cards_holder ||= []
|
62
|
-
|
63
|
-
self.cards_holder << Avo::Dashboards::BaseDivider.new(**args)
|
64
|
-
self.cards_index += 1
|
65
|
-
end
|
66
|
-
|
67
|
-
def cards
|
68
|
-
self.cards_holder
|
69
|
-
end
|
70
|
-
|
71
|
-
def cards_classes
|
72
|
-
case grid_cols
|
73
|
-
when 3
|
74
|
-
"sm:grid-cols-3"
|
75
|
-
when 4
|
76
|
-
"sm:grid-cols-4"
|
77
|
-
when 5
|
78
|
-
"sm:grid-cols-5"
|
79
|
-
when 6
|
80
|
-
"sm:grid-cols-6"
|
81
|
-
else
|
82
|
-
"sm:grid-cols-3"
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
module Avo
|
2
|
-
module Concerns
|
3
|
-
module StylesCards
|
4
|
-
extend ActiveSupport::Concern
|
5
|
-
|
6
|
-
included do
|
7
|
-
class_attribute :cols, default: 1
|
8
|
-
class_attribute :rows, default: 1
|
9
|
-
|
10
|
-
def card_classes
|
11
|
-
result = ""
|
12
|
-
|
13
|
-
# Writing down the classes so TailwindCSS knows not to purge them
|
14
|
-
classes_for_cols = {
|
15
|
-
1 => " sm:col-span-1",
|
16
|
-
2 => " sm:col-span-2",
|
17
|
-
3 => " sm:col-span-3",
|
18
|
-
4 => " sm:col-span-4",
|
19
|
-
5 => " sm:col-span-5",
|
20
|
-
6 => " sm:col-span-6"
|
21
|
-
}
|
22
|
-
|
23
|
-
classes_for_rows = {
|
24
|
-
1 => " sm:row-span-1 min-h-[8rem]",
|
25
|
-
2 => " sm:row-span-2 min-h-[16rem]",
|
26
|
-
3 => " sm:row-span-3 min-h-[24rem]",
|
27
|
-
4 => " sm:row-span-4 min-h-[32rem]",
|
28
|
-
5 => " sm:row-span-5 min-h-[40rem]",
|
29
|
-
6 => " sm:row-span-6 min-h-[48rem]",
|
30
|
-
}
|
31
|
-
|
32
|
-
result += classes_for_cols[cols.to_i] if classes_for_cols[cols.to_i].present?
|
33
|
-
result += classes_for_rows[rows.to_i] if classes_for_rows[rows.to_i].present?
|
34
|
-
|
35
|
-
result
|
36
|
-
end
|
37
|
-
|
38
|
-
def cols
|
39
|
-
@cols || self.class.cols
|
40
|
-
end
|
41
|
-
|
42
|
-
def rows
|
43
|
-
@rows || self.class.rows
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|