avo 2.11.3.pre.1 → 2.11.3.pre.2
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 +1 -1
- data/app/components/avo/actions_component.html.erb +3 -3
- data/app/components/avo/actions_component.rb +3 -12
- data/app/components/avo/button_component.rb +3 -1
- data/app/components/avo/card_component.html.erb +8 -8
- data/app/components/avo/cards_list_component.html.erb +16 -0
- data/app/components/avo/cards_list_component.rb +13 -0
- data/app/components/avo/panel_component.html.erb +1 -1
- data/app/components/avo/resource_component.rb +4 -6
- data/app/components/avo/sidebar_component.html.erb +1 -1
- data/app/components/avo/views/resource_edit_component.rb +20 -0
- data/app/components/avo/views/resource_index_component.html.erb +90 -42
- data/app/components/avo/views/resource_show_component.html.erb +50 -137
- data/app/components/avo/views/resource_show_component.rb +0 -1
- data/app/controllers/avo/application_controller.rb +2 -2
- data/app/controllers/avo/associations_controller.rb +1 -1
- data/app/controllers/avo/base_controller.rb +7 -3
- data/app/controllers/avo/cards_controller.rb +18 -5
- data/app/controllers/avo/dashboards_controller.rb +4 -2
- data/app/javascript/js/controllers/{dashboard_card_controller.js → card_controller.js} +0 -0
- data/app/javascript/js/controllers.js +2 -2
- data/app/views/avo/cards/_metric_card.html.erb +2 -2
- data/app/views/avo/dashboards/show.html.erb +2 -19
- data/app/views/avo/debug/report.html.erb +0 -1
- data/app/views/avo/private/design.html.erb +1 -1
- data/app/views/layouts/avo/application.html.erb +1 -1
- data/config/routes.rb +3 -0
- data/lib/avo/base_card.rb +40 -20
- data/lib/avo/base_resource.rb +2 -5
- data/lib/avo/concerns/has_cards.rb +88 -0
- data/lib/avo/concerns/has_model.rb +11 -0
- data/lib/avo/concerns/styles_cards.rb +48 -0
- data/lib/avo/dashboards/base_dashboard.rb +15 -50
- data/lib/avo/dashboards/base_divider.rb +5 -1
- data/lib/avo/dashboards/chartkick_card.rb +3 -3
- data/lib/avo/fields/base_field.rb +2 -6
- data/lib/avo/fields/field_extensions/visible_in_different_views.rb +12 -1
- data/lib/avo/hosts/dashboard_card.rb +1 -1
- data/lib/avo/licensing/pro_license.rb +0 -1
- data/lib/avo/tab.rb +3 -1
- 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/resource_tools/partial.tt +1 -1
- data/lib/generators/avo/templates/standalone_action.tt +1 -1
- data/public/avo-assets/avo.css +150 -594
- data/public/avo-assets/avo.js +6 -6
- data/public/avo-assets/avo.js.map +3 -3
- metadata +7 -13
- data/lib/avo/concerns/has_editable_controls.rb +0 -34
- data/lib/avo/resources/controls/action.rb +0 -32
- data/lib/avo/resources/controls/actions_list.rb +0 -19
- data/lib/avo/resources/controls/back_button.rb +0 -13
- data/lib/avo/resources/controls/base_control.rb +0 -59
- data/lib/avo/resources/controls/delete_button.rb +0 -13
- data/lib/avo/resources/controls/detach_button.rb +0 -13
- data/lib/avo/resources/controls/edit_button.rb +0 -13
- data/lib/avo/resources/controls/execution_context.rb +0 -59
- data/lib/avo/resources/controls/items_holder.rb +0 -19
- data/lib/avo/resources/controls/link_to.rb +0 -27
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.11.3.pre.
|
4
|
+
version: 2.11.3.pre.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adrian Marin
|
@@ -805,6 +805,8 @@ 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
|
808
810
|
- app/components/avo/common_field_wrapper_component.html.erb
|
809
811
|
- app/components/avo/common_field_wrapper_component.rb
|
810
812
|
- app/components/avo/dashboards/divider_component.html.erb
|
@@ -1071,8 +1073,8 @@ files:
|
|
1071
1073
|
- app/javascript/js/controllers/attachments_controller.js
|
1072
1074
|
- app/javascript/js/controllers/base_controller.js
|
1073
1075
|
- app/javascript/js/controllers/boolean_filter_controller.js
|
1076
|
+
- app/javascript/js/controllers/card_controller.js
|
1074
1077
|
- app/javascript/js/controllers/copy_to_clipboard_controller.js
|
1075
|
-
- app/javascript/js/controllers/dashboard_card_controller.js
|
1076
1078
|
- app/javascript/js/controllers/fields/belongs_to_field_controller.js
|
1077
1079
|
- app/javascript/js/controllers/fields/code_field_controller.js
|
1078
1080
|
- app/javascript/js/controllers/fields/date_field_controller.js
|
@@ -1176,12 +1178,14 @@ files:
|
|
1176
1178
|
- lib/avo/base_resource_tool.rb
|
1177
1179
|
- lib/avo/concerns/fetches_things.rb
|
1178
1180
|
- lib/avo/concerns/handles_field_args.rb
|
1179
|
-
- lib/avo/concerns/
|
1181
|
+
- lib/avo/concerns/has_cards.rb
|
1180
1182
|
- lib/avo/concerns/has_fields.rb
|
1181
1183
|
- lib/avo/concerns/has_html_attributes.rb
|
1184
|
+
- lib/avo/concerns/has_model.rb
|
1182
1185
|
- lib/avo/concerns/has_stimulus_controllers.rb
|
1183
1186
|
- lib/avo/concerns/is_resource_item.rb
|
1184
1187
|
- lib/avo/concerns/model_class_constantized.rb
|
1188
|
+
- lib/avo/concerns/styles_cards.rb
|
1185
1189
|
- lib/avo/configuration.rb
|
1186
1190
|
- lib/avo/configuration/resource_configuration.rb
|
1187
1191
|
- lib/avo/dashboards/base_dashboard.rb
|
@@ -1269,16 +1273,6 @@ files:
|
|
1269
1273
|
- lib/avo/panel.rb
|
1270
1274
|
- lib/avo/panel_builder.rb
|
1271
1275
|
- lib/avo/reloader.rb
|
1272
|
-
- lib/avo/resources/controls/action.rb
|
1273
|
-
- lib/avo/resources/controls/actions_list.rb
|
1274
|
-
- lib/avo/resources/controls/back_button.rb
|
1275
|
-
- lib/avo/resources/controls/base_control.rb
|
1276
|
-
- lib/avo/resources/controls/delete_button.rb
|
1277
|
-
- lib/avo/resources/controls/detach_button.rb
|
1278
|
-
- lib/avo/resources/controls/edit_button.rb
|
1279
|
-
- lib/avo/resources/controls/execution_context.rb
|
1280
|
-
- lib/avo/resources/controls/items_holder.rb
|
1281
|
-
- lib/avo/resources/controls/link_to.rb
|
1282
1276
|
- lib/avo/services/authorization_service.rb
|
1283
1277
|
- lib/avo/services/uri_service.rb
|
1284
1278
|
- lib/avo/tab.rb
|
@@ -1,34 +0,0 @@
|
|
1
|
-
module Avo
|
2
|
-
module Concerns
|
3
|
-
module HasEditableControls
|
4
|
-
extend ActiveSupport::Concern
|
5
|
-
|
6
|
-
included do
|
7
|
-
class_attribute :show_controls
|
8
|
-
class_attribute :show_controls_holder
|
9
|
-
class_attribute :show_controls_holder_called, default: false
|
10
|
-
end
|
11
|
-
|
12
|
-
def has_show_controls?
|
13
|
-
return false if ::Avo::App.license.lacks_with_trial(:resource_show_controls)
|
14
|
-
|
15
|
-
self.class.show_controls.present?
|
16
|
-
end
|
17
|
-
|
18
|
-
def render_show_controls
|
19
|
-
return [] if ::Avo::App.license.lacks_with_trial(:resource_show_controls)
|
20
|
-
|
21
|
-
if show_controls.present?
|
22
|
-
Avo::Resources::Controls::ExecutionContext.new(
|
23
|
-
block: show_controls,
|
24
|
-
resource: self,
|
25
|
-
model: model,
|
26
|
-
view: view
|
27
|
-
).handle.items
|
28
|
-
else
|
29
|
-
[]
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
module Avo
|
2
|
-
module Resources
|
3
|
-
module Controls
|
4
|
-
class Action < BaseControl
|
5
|
-
attr_reader :klass
|
6
|
-
|
7
|
-
def initialize(klass, model: nil, resource: nil, view: nil, **args)
|
8
|
-
super(**args)
|
9
|
-
|
10
|
-
@klass = klass
|
11
|
-
@resource = resource
|
12
|
-
@model = model
|
13
|
-
@view = view
|
14
|
-
end
|
15
|
-
|
16
|
-
def action
|
17
|
-
return @instance if @instance.present?
|
18
|
-
|
19
|
-
@instance = @klass.new(model: @model, resource: @resource, view: @view)
|
20
|
-
end
|
21
|
-
|
22
|
-
def path
|
23
|
-
Avo::Services::URIService.parse(@resource.record_path).append_paths("actions", action.param_id).to_s
|
24
|
-
end
|
25
|
-
|
26
|
-
def label
|
27
|
-
@args[:label] || action.action_name
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
module Avo
|
2
|
-
module Resources
|
3
|
-
module Controls
|
4
|
-
class ActionsList < BaseControl
|
5
|
-
def exclude
|
6
|
-
Array.wrap(@args[:exclude]) || []
|
7
|
-
end
|
8
|
-
|
9
|
-
def color
|
10
|
-
@args[:color] || :primary
|
11
|
-
end
|
12
|
-
|
13
|
-
def style
|
14
|
-
@args[:style] || :outline
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,59 +0,0 @@
|
|
1
|
-
module Avo
|
2
|
-
module Resources
|
3
|
-
module Controls
|
4
|
-
class BaseControl
|
5
|
-
def initialize(**args)
|
6
|
-
@args = args
|
7
|
-
end
|
8
|
-
|
9
|
-
def label
|
10
|
-
@args[:label] || @label
|
11
|
-
end
|
12
|
-
|
13
|
-
def title
|
14
|
-
@args[:title]
|
15
|
-
end
|
16
|
-
|
17
|
-
def color
|
18
|
-
@args[:color] || :gray
|
19
|
-
end
|
20
|
-
|
21
|
-
def style
|
22
|
-
@args[:style] || :text
|
23
|
-
end
|
24
|
-
|
25
|
-
def icon
|
26
|
-
@args[:icon] || nil
|
27
|
-
end
|
28
|
-
|
29
|
-
def back_button?
|
30
|
-
is_a? Avo::Resources::Controls::BackButton
|
31
|
-
end
|
32
|
-
|
33
|
-
def edit_button?
|
34
|
-
is_a? Avo::Resources::Controls::EditButton
|
35
|
-
end
|
36
|
-
|
37
|
-
def delete_button?
|
38
|
-
is_a? Avo::Resources::Controls::DeleteButton
|
39
|
-
end
|
40
|
-
|
41
|
-
def actions_list?
|
42
|
-
is_a? Avo::Resources::Controls::ActionsList
|
43
|
-
end
|
44
|
-
|
45
|
-
def link_to?
|
46
|
-
is_a? Avo::Resources::Controls::LinkTo
|
47
|
-
end
|
48
|
-
|
49
|
-
def detach_button?
|
50
|
-
is_a? Avo::Resources::Controls::DetachButton
|
51
|
-
end
|
52
|
-
|
53
|
-
def action?
|
54
|
-
is_a? Avo::Resources::Controls::Action
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
@@ -1,59 +0,0 @@
|
|
1
|
-
require "dry-initializer"
|
2
|
-
|
3
|
-
# This object holds some data tha is usually needed to compute blocks around the app.
|
4
|
-
module Avo
|
5
|
-
module Resources
|
6
|
-
module Controls
|
7
|
-
class ExecutionContext
|
8
|
-
extend Dry::Initializer
|
9
|
-
|
10
|
-
option :context, default: proc { Avo::App.context }
|
11
|
-
option :params, default: proc { Avo::App.params }
|
12
|
-
option :view_context, default: proc { Avo::App.view_context }
|
13
|
-
option :current_user, default: proc { Avo::App.current_user }
|
14
|
-
option :items_holder, default: proc { Avo::Resources::Controls::ItemsHolder.new }
|
15
|
-
option :resource, optional: true
|
16
|
-
option :model, optional: true
|
17
|
-
option :view, optional: true
|
18
|
-
option :block, optional: true
|
19
|
-
|
20
|
-
delegate :authorize, to: Avo::Services::AuthorizationService
|
21
|
-
|
22
|
-
def handle
|
23
|
-
instance_exec(&block)
|
24
|
-
end
|
25
|
-
|
26
|
-
private
|
27
|
-
|
28
|
-
def back_button(**args)
|
29
|
-
items_holder.add_item Avo::Resources::Controls::BackButton.new(**args)
|
30
|
-
end
|
31
|
-
|
32
|
-
def delete_button(**args)
|
33
|
-
items_holder.add_item Avo::Resources::Controls::DeleteButton.new(**args)
|
34
|
-
end
|
35
|
-
|
36
|
-
def detach_button(**args)
|
37
|
-
items_holder.add_item Avo::Resources::Controls::DetachButton.new(**args)
|
38
|
-
end
|
39
|
-
|
40
|
-
def edit_button(**args)
|
41
|
-
items_holder.add_item Avo::Resources::Controls::EditButton.new(**args)
|
42
|
-
end
|
43
|
-
|
44
|
-
def link_to(label, path, **args)
|
45
|
-
items_holder.add_item Avo::Resources::Controls::LinkTo.new(label: label, path: path, **args)
|
46
|
-
end
|
47
|
-
|
48
|
-
def actions_list(**args)
|
49
|
-
items_holder.add_item Avo::Resources::Controls::ActionsList.new(**args)
|
50
|
-
end
|
51
|
-
|
52
|
-
def action(klass, **args)
|
53
|
-
# abort model.inspect
|
54
|
-
items_holder.add_item Avo::Resources::Controls::Action.new(klass, model: model, resource: resource, view: view, **args)
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
module Avo
|
2
|
-
module Resources
|
3
|
-
module Controls
|
4
|
-
class LinkTo < BaseControl
|
5
|
-
def initialize(**args)
|
6
|
-
super(**args)
|
7
|
-
end
|
8
|
-
|
9
|
-
def path
|
10
|
-
@args[:path]
|
11
|
-
end
|
12
|
-
|
13
|
-
def target
|
14
|
-
@args[:target] || nil
|
15
|
-
end
|
16
|
-
|
17
|
-
def data
|
18
|
-
@args[:data] || {}
|
19
|
-
end
|
20
|
-
|
21
|
-
def class
|
22
|
-
@args[:class] || nil
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|