avo 3.0.0.pre11 → 3.0.0.pre13
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/assets/stylesheets/avo.base.css +1 -1
- data/app/components/avo/actions_component.html.erb +1 -1
- data/app/components/avo/actions_component.rb +40 -16
- data/app/components/avo/alert_component.html.erb +1 -1
- data/app/components/avo/field_wrapper_component.html.erb +2 -2
- data/app/components/avo/fields/common/heading_component.html.erb +1 -1
- data/app/components/avo/fields/markdown_field/edit_component.html.erb +3 -3
- data/app/components/avo/fields/markdown_field/show_component.html.erb +3 -3
- data/app/components/avo/fields/trix_field/edit_component.html.erb +1 -1
- data/app/components/avo/fields/trix_field/show_component.html.erb +1 -1
- data/app/components/avo/index/field_wrapper_component.html.erb +1 -1
- data/app/components/avo/index/grid_item_component.html.erb +9 -35
- data/app/components/avo/index/grid_item_component.rb +36 -10
- data/app/components/avo/panel_component.html.erb +1 -1
- data/app/components/avo/profile_item_component.html.erb +17 -2
- data/app/components/avo/profile_item_component.rb +13 -1
- data/app/components/avo/resource_component.rb +1 -0
- data/app/components/avo/sidebar_profile_component.html.erb +27 -27
- data/app/components/avo/views/resource_edit_component.html.erb +1 -1
- data/app/components/avo/views/resource_index_component.rb +1 -1
- data/app/components/avo/views/resource_show_component.html.erb +1 -1
- data/app/controllers/avo/actions_controller.rb +12 -8
- data/app/controllers/avo/associations_controller.rb +1 -1
- data/app/controllers/avo/base_controller.rb +15 -3
- data/app/controllers/avo/home_controller.rb +1 -1
- data/app/controllers/avo/search_controller.rb +7 -11
- data/app/javascript/js/controllers/fields/{simple_mde_controller.js → easy_mde_controller.js} +3 -3
- data/app/javascript/js/controllers/search_controller.js +3 -1
- data/app/javascript/js/controllers.js +2 -2
- data/app/views/avo/actions/show.html.erb +2 -1
- data/app/views/avo/partials/_profile_menu_extra.html.erb +2 -0
- data/lib/avo/app.rb +1 -1
- data/lib/avo/base_action.rb +8 -1
- data/lib/avo/base_resource.rb +81 -112
- data/lib/avo/concerns/breadcrumbs.rb +2 -2
- data/lib/avo/concerns/filters_session_handler.rb +5 -4
- data/lib/avo/concerns/has_description.rb +23 -0
- data/lib/avo/concerns/has_items.rb +8 -8
- data/lib/avo/configuration.rb +6 -2
- data/lib/avo/engine.rb +5 -0
- data/lib/avo/fields/base_field.rb +0 -4
- data/lib/avo/fields/belongs_to_field.rb +14 -8
- data/lib/avo/fields/has_base_field.rb +1 -1
- data/lib/avo/resources/controls/actions_list.rb +2 -1
- data/lib/avo/services/debug_service.rb +1 -1
- data/lib/avo/version.rb +1 -1
- data/lib/generators/avo/eject_generator.rb +1 -0
- data/lib/generators/avo/install_generator.rb +0 -1
- data/lib/generators/avo/resource_generator.rb +4 -1
- data/lib/generators/avo/templates/initializer/avo.tt +1 -1
- data/lib/generators/avo/templates/resource/resource.tt +3 -4
- data/lib/tasks/avo_tasks.rake +27 -0
- data/public/avo-assets/avo.base.css +273 -138
- data/public/avo-assets/avo.base.js +245 -217
- data/public/avo-assets/avo.base.js.map +3 -3
- metadata +5 -4
- data/lib/avo/grid_collector.rb +0 -40
@@ -2,13 +2,14 @@ module Avo
|
|
2
2
|
module Resources
|
3
3
|
module Controls
|
4
4
|
class ActionsList < BaseControl
|
5
|
-
attr_reader :color, :exclude, :style
|
5
|
+
attr_reader :color, :exclude, :include, :style
|
6
6
|
|
7
7
|
def initialize(**args)
|
8
8
|
super(**args)
|
9
9
|
|
10
10
|
@color = args[:color] || :primary
|
11
11
|
@exclude = args[:exclude] || []
|
12
|
+
@include = args[:include] || []
|
12
13
|
@style = args[:style] || :outline
|
13
14
|
end
|
14
15
|
end
|
@@ -55,7 +55,7 @@ class Avo::Services::DebugService
|
|
55
55
|
fields_per_resource: fields_per_resource,
|
56
56
|
custom_fields_count: custom_fields_count,
|
57
57
|
field_types: field_types,
|
58
|
-
**other_metadata(:actions),
|
58
|
+
# **other_metadata(:actions), #FIEXME: this is fetching actions without hydration
|
59
59
|
**other_metadata(:filters),
|
60
60
|
main_menu_present: Avo.configuration.main_menu.present?,
|
61
61
|
profile_menu_present: Avo.configuration.profile_menu.present?,
|
data/lib/avo/version.rb
CHANGED
@@ -17,6 +17,7 @@ module Generators
|
|
17
17
|
pre_head: "app/views/avo/partials/_pre_head.html.erb",
|
18
18
|
scripts: "app/views/avo/partials/_scripts.html.erb",
|
19
19
|
sidebar_extra: "app/views/avo/partials/_sidebar_extra.html.erb",
|
20
|
+
profile_menu_extra: "app/views/avo/partials/_profile_menu_extra.html.erb",
|
20
21
|
}
|
21
22
|
|
22
23
|
def handle
|
@@ -135,6 +135,9 @@ module Generators
|
|
135
135
|
fields_string = ""
|
136
136
|
|
137
137
|
fields.each do |field_name, field_options|
|
138
|
+
# if field_options are not available (likely a missing resource for an association), skip the field
|
139
|
+
fields_string += "\n # Could not generate a field for #{field_name}" and next unless field_options
|
140
|
+
|
138
141
|
options = ""
|
139
142
|
field_options[:options].each { |k, v| options += ", #{k}: #{v}" } if field_options[:options].present?
|
140
143
|
|
@@ -181,7 +184,7 @@ module Generators
|
|
181
184
|
end
|
182
185
|
|
183
186
|
def field_from_through_association(association)
|
184
|
-
if association.through_reflection.is_a? ActiveRecord::Reflection::
|
187
|
+
if association.through_reflection.is_a?(ActiveRecord::Reflection::HasManyReflection) || association.through_reflection.is_a?(ActiveRecord::Reflection::ThroughReflection)
|
185
188
|
{
|
186
189
|
field: "has_many",
|
187
190
|
options: {
|
@@ -51,7 +51,7 @@ Avo.configure do |config|
|
|
51
51
|
## permanent enable or disable cache_resource_filters, default value is false
|
52
52
|
# config.cache_resource_filters = false
|
53
53
|
## provide a lambda to enable or disable cache_resource_filters per user/resource.
|
54
|
-
# config.cache_resource_filters = ->
|
54
|
+
# config.cache_resource_filters = -> { current_user.cache_resource_filters? }
|
55
55
|
|
56
56
|
## == Customization ==
|
57
57
|
# config.app_name = 'Avocadelicious'
|
@@ -1,9 +1,8 @@
|
|
1
1
|
class Avo::Resources::<%= resource_class %> < Avo::BaseResource
|
2
|
-
self.title = :id
|
3
2
|
self.includes = []<%= model_class_from_args %>
|
4
|
-
# self.
|
5
|
-
# query.ransack(id_eq: params[:q], m: "or").result(distinct: false)
|
6
|
-
#
|
3
|
+
# self.search = {
|
4
|
+
# query: -> { query.ransack(id_eq: params[:q], m: "or").result(distinct: false) }
|
5
|
+
# }
|
7
6
|
|
8
7
|
def fields
|
9
8
|
field :id, as: :id<%= generate_fields %>
|
data/lib/tasks/avo_tasks.rake
CHANGED
@@ -63,3 +63,30 @@ task "avo:gem_paths" do
|
|
63
63
|
# avo:/Users/adrian/work/avocado/avo-3,avo_filters:/Users/adrian/work/avocado/advanced/avo_filters
|
64
64
|
puts result
|
65
65
|
end
|
66
|
+
|
67
|
+
desc "Symlink registered gems in `./tmp/gems` so their views, etc. can be inspected by Tailwind CSS."
|
68
|
+
task "avo:link" do
|
69
|
+
Avo::App.boot
|
70
|
+
abort Avo.plugin_manager.plugins.inspect
|
71
|
+
if Dir.exist?("tmp/gems")
|
72
|
+
puts "Removing previously linked gems."
|
73
|
+
`rm -f tmp/gems/*`
|
74
|
+
else
|
75
|
+
if File.exist?("tmp/gems")
|
76
|
+
raise "A file named `tmp/gems` already exists? It has to be removed before we can create the required directory."
|
77
|
+
end
|
78
|
+
|
79
|
+
puts "Creating 'tmp/gems' directory."
|
80
|
+
`mkdir tmp/gems`
|
81
|
+
end
|
82
|
+
|
83
|
+
`touch tmp/gems/.keep`
|
84
|
+
|
85
|
+
Avo.plugin_manager.plugins.each do |linked_gem|
|
86
|
+
target = `bundle show #{linked_gem}`.chomp
|
87
|
+
if target.present?
|
88
|
+
puts "Linking '#{linked_gem}' to '#{target}'."
|
89
|
+
`ln -s #{target} tmp/gems/#{linked_gem}`
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|