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
@@ -6,12 +6,21 @@ module Avo
|
|
6
6
|
attr_accessor :show_on_show
|
7
7
|
attr_accessor :show_on_new
|
8
8
|
attr_accessor :show_on_edit
|
9
|
+
attr_accessor :show_on_dashboard
|
9
10
|
|
10
|
-
def
|
11
|
+
def initialize_visibility(args = {})
|
12
|
+
# def initialize(id = nil, **args, &block)
|
11
13
|
@show_on_index = @show_on_index.nil? ? true : @show_on_index
|
12
14
|
@show_on_show = @show_on_show.nil? ? true : @show_on_show
|
13
15
|
@show_on_new = @show_on_new.nil? ? true : @show_on_new
|
14
16
|
@show_on_edit = @show_on_edit.nil? ? true : @show_on_edit
|
17
|
+
@show_on_dashboard = @show_on_dashboard.nil? ? true : @show_on_dashboard
|
18
|
+
|
19
|
+
# Set the visibility
|
20
|
+
show_on args[:show_on] if args[:show_on].present?
|
21
|
+
hide_on args[:hide_on] if args[:hide_on].present?
|
22
|
+
only_on args[:only_on] if args[:only_on].present?
|
23
|
+
except_on args[:except_on] if args[:except_on].present?
|
15
24
|
end
|
16
25
|
|
17
26
|
# Validates if the field is visible on certain view
|
@@ -82,6 +91,7 @@ module Avo
|
|
82
91
|
end
|
83
92
|
|
84
93
|
def show_on_all
|
94
|
+
@show_on_dashboard = true
|
85
95
|
@show_on_index = true
|
86
96
|
@show_on_show = true
|
87
97
|
@show_on_edit = true
|
@@ -89,6 +99,7 @@ module Avo
|
|
89
99
|
end
|
90
100
|
|
91
101
|
def hide_on_all
|
102
|
+
@show_on_dashboard = false
|
92
103
|
@show_on_index = false
|
93
104
|
@show_on_show = false
|
94
105
|
@show_on_edit = false
|
data/lib/avo/tab.rb
CHANGED
@@ -13,7 +13,7 @@ class Avo::Tab
|
|
13
13
|
|
14
14
|
def initialize(name: nil, description: nil, view: nil, holds_one_field: false, **args)
|
15
15
|
# Initialize the visibility markers
|
16
|
-
super
|
16
|
+
# super
|
17
17
|
|
18
18
|
@name = name
|
19
19
|
@description = description
|
@@ -25,6 +25,8 @@ class Avo::Tab
|
|
25
25
|
hide_on args[:hide_on] if args[:hide_on].present?
|
26
26
|
only_on args[:only_on] if args[:only_on].present?
|
27
27
|
except_on args[:except_on] if args[:except_on].present?
|
28
|
+
|
29
|
+
initialize_visibility args
|
28
30
|
end
|
29
31
|
|
30
32
|
def hydrate(view: nil)
|
data/lib/avo/version.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
class <%= class_name.camelize %> < Avo::BaseAction
|
2
|
-
self.name =
|
2
|
+
self.name = '<%= name.underscore.humanize %>'
|
3
3
|
|
4
4
|
def handle(**args)
|
5
5
|
models, fields, current_user, resource = args.values_at(:models, :fields, :current_user, :resource)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<div class="flex-1 flex p-4">
|
2
2
|
<div class="place-self-end">
|
3
|
-
|
3
|
+
Parent ID: <%%= @parent.id %>
|
4
4
|
<br />
|
5
5
|
<br />
|
6
6
|
Customize this partial under <code class='p-1 rounded bg-gray-500 text-white text-sm'>app/views/avo/cards/_<%= name.underscore %>.html.erb</code>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<div class="flex flex-col">
|
2
2
|
<%%= render Avo::PanelComponent.new(name: "<%= human_name %>") do |c| %>
|
3
3
|
<%% c.tools do %>
|
4
|
-
<%%= a_link('/avo', icon: 'heroicons/solid/academic-cap',
|
4
|
+
<%%= a_link('/avo', icon: 'heroicons/solid/academic-cap', style: :primary) do %>
|
5
5
|
Dummy link
|
6
6
|
<%% end %>
|
7
7
|
<%% end %>
|