avo 3.0.0.pre19 → 3.0.1.beta1
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 +2 -2
- data/Gemfile.lock +25 -23
- data/Rakefile +0 -2
- data/app/assets/stylesheets/avo.base.css +0 -1
- data/app/components/avo/actions_component.rb +1 -1
- data/app/components/avo/field_wrapper_component.html.erb +1 -1
- data/app/components/avo/field_wrapper_component.rb +7 -1
- data/app/components/avo/fields/boolean_field/index_component.html.erb +1 -1
- data/app/components/avo/fields/common/badge_viewer_component.html.erb +24 -1
- data/app/components/avo/fields/common/badge_viewer_component.rb +0 -24
- data/app/components/avo/fields/common/boolean_check_component.html.erb +12 -1
- data/app/components/avo/fields/common/boolean_check_component.rb +1 -2
- data/app/components/avo/fields/common/gravatar_viewer_component.html.erb +1 -1
- data/app/components/avo/fields/common/gravatar_viewer_component.rb +2 -2
- data/app/components/avo/fields/common/heading_component.html.erb +8 -3
- data/app/components/avo/fields/common/heading_component.rb +3 -1
- data/app/components/avo/fields/common/key_value_component.html.erb +2 -2
- data/app/components/avo/fields/common/key_value_component.rb +2 -2
- data/app/components/avo/fields/common/progress_bar_component.rb +9 -3
- data/app/components/avo/fields/common/status_viewer_component.html.erb +0 -3
- data/app/components/avo/fields/edit_component.rb +1 -1
- data/app/components/avo/fields/external_image_field/index_component.html.erb +1 -1
- data/app/components/avo/fields/file_field/index_component.html.erb +2 -2
- data/app/components/avo/fields/gravatar_field/index_component.html.erb +1 -1
- data/app/components/avo/fields/heading_field/edit_component.html.erb +1 -1
- data/app/components/avo/fields/heading_field/show_component.html.erb +1 -1
- data/app/components/avo/fields/id_field/index_component.html.erb +1 -1
- data/app/components/avo/fields/index_component.rb +1 -1
- data/app/components/avo/fields/show_component.rb +1 -1
- data/app/components/avo/fields/text_field/index_component.html.erb +1 -1
- data/app/components/avo/index/field_wrapper_component.rb +1 -1
- data/app/components/avo/index/resource_controls_component.rb +1 -1
- data/app/components/avo/index/resource_table_component.rb +9 -3
- data/app/components/avo/resource_component.rb +4 -9
- data/app/components/avo/sidebar_profile_component.html.erb +4 -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 +20 -9
- data/app/components/avo/views/resource_edit_component.rb +5 -5
- 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/components/avo/views/resource_show_component.rb +1 -1
- data/app/controllers/avo/actions_controller.rb +20 -9
- data/app/controllers/avo/application_controller.rb +5 -5
- data/app/controllers/avo/base_controller.rb +1 -39
- data/app/controllers/avo/search_controller.rb +2 -19
- data/app/controllers/concerns/avo/initializes_avo.rb +0 -1
- data/app/helpers/avo/resources_helper.rb +1 -1
- data/app/helpers/avo/url_helpers.rb +1 -1
- data/app/views/avo/base/edit.html.erb +1 -1
- data/app/views/avo/base/index.html.erb +1 -1
- data/app/views/avo/base/new.html.erb +1 -1
- data/app/views/avo/base/show.html.erb +1 -1
- data/app/views/layouts/avo/application.html.erb +2 -10
- data/bin/dev +0 -2
- data/config/master.key +1 -0
- data/config/routes.rb +3 -4
- data/db/factories.rb +1 -1
- data/lib/avo/base_action.rb +26 -21
- data/lib/avo/base_resource.rb +7 -13
- data/lib/avo/concerns/filters_session_handler.rb +3 -3
- data/lib/avo/concerns/has_items.rb +5 -1
- data/lib/avo/concerns/visible_in_different_views.rb +1 -7
- data/lib/avo/configuration.rb +4 -28
- data/lib/avo/current.rb +6 -1
- data/lib/avo/dsl/field_parser.rb +1 -1
- data/lib/avo/execution_context.rb +1 -4
- data/lib/avo/fields/badge_field.rb +1 -1
- data/lib/avo/fields/base_field.rb +44 -21
- data/lib/avo/fields/belongs_to_field.rb +1 -1
- data/lib/avo/fields/concerns/has_html_attributes.rb +0 -2
- data/lib/avo/fields/external_image_field.rb +2 -2
- data/lib/avo/fields/file_field.rb +2 -2
- data/lib/avo/fields/gravatar_field.rb +2 -2
- data/lib/avo/fields/has_base_field.rb +2 -2
- data/lib/avo/fields/heading_field.rb +13 -5
- data/lib/avo/fields/id_field.rb +2 -2
- data/lib/avo/fields/status_field.rb +1 -3
- data/lib/avo/fields/text_field.rb +2 -2
- data/lib/avo/filters/base_filter.rb +1 -1
- data/lib/avo/html/builder.rb +1 -1
- data/lib/avo/licensing/h_q.rb +1 -1
- data/lib/avo/licensing/license_manager.rb +1 -1
- data/lib/avo/resources/items/holder.rb +6 -0
- data/lib/avo/resources/items/item_group.rb +2 -2
- data/lib/avo/resources/items/row.rb +3 -3
- data/lib/avo/resources/items/sidebar.rb +1 -1
- data/lib/avo/resources/items/tab.rb +2 -2
- data/lib/avo/resources/items/tab_group.rb +1 -1
- data/lib/avo/resources/resource_manager.rb +1 -6
- data/lib/avo/version.rb +1 -1
- data/lib/avo.rb +0 -9
- data/lib/generators/avo/controller_generator.rb +0 -3
- data/lib/generators/avo/eject_generator.rb +15 -180
- data/lib/generators/avo/field_generator.rb +2 -49
- data/lib/generators/avo/js/install_generator.rb +2 -2
- data/lib/generators/avo/resource_generator.rb +7 -10
- data/lib/generators/avo/tailwindcss/install_generator.rb +12 -58
- data/lib/generators/avo/templates/initializer/avo.tt +1 -6
- data/lib/generators/avo/templates/resource/controller.tt +1 -1
- data/lib/generators/avo/templates/tailwindcss/avo.tailwind.css +3 -5
- data/lib/tasks/avo_tasks.rake +5 -33
- data/public/avo-assets/avo.base.css +4146 -75
- data/{app/assets/builds/avo.base.css → public/avo-assets/avo.css} +3808 -547
- data/public/avo-assets/avo.js +513 -0
- data/public/avo-assets/avo.js.map +7 -0
- metadata +6 -14
- data/app/assets/builds/avo.base.js +0 -124556
- data/app/assets/builds/avo.base.js.map +0 -7
- data/app/assets/builds/avo.custom.js +0 -6
- data/app/assets/builds/avo.custom.js.map +0 -7
- data/app/assets/stylesheets/css/fields/tags.css +0 -32
- data/lib/avo/concerns/has_helpers.rb +0 -18
- data/lib/avo/concerns/visible_items.rb +0 -43
- data/lib/avo/fields/concerns/use_view_components.rb +0 -45
- data/lib/avo/view_inquirer.rb +0 -36
- data/lib/generators/avo/concerns/parent_controller.rb +0 -20
- data/lib/generators/avo/templates/tailwindcss/tailwind.config.js +0 -11
@@ -1,45 +0,0 @@
|
|
1
|
-
module Avo
|
2
|
-
module Fields
|
3
|
-
module Concerns
|
4
|
-
module UseViewComponents
|
5
|
-
extend ActiveSupport::Concern
|
6
|
-
|
7
|
-
included do
|
8
|
-
attr_reader :components
|
9
|
-
end
|
10
|
-
|
11
|
-
def view_component_name
|
12
|
-
"#{type.camelize}Field"
|
13
|
-
end
|
14
|
-
|
15
|
-
# For custom components the namespace will be different than Avo::Fields so we should take that into account.
|
16
|
-
def view_component_namespace
|
17
|
-
"#{self.class.to_s.deconstantize}::#{view_component_name}"
|
18
|
-
end
|
19
|
-
|
20
|
-
# Try and build the component class or fallback to a blank one
|
21
|
-
def component_for_view(view = :index)
|
22
|
-
# Use the edit variant for all "update" views
|
23
|
-
view = :edit if view.in? [:new, :create, :update]
|
24
|
-
|
25
|
-
custom_components = Avo::ExecutionContext.new(
|
26
|
-
target: components,
|
27
|
-
resource: @resource,
|
28
|
-
record: @record,
|
29
|
-
view: view
|
30
|
-
).handle
|
31
|
-
|
32
|
-
component_class = custom_components.dig("#{view}_component".to_sym) || "#{view_component_namespace}::#{view.to_s.camelize}Component"
|
33
|
-
component_class.to_s.constantize
|
34
|
-
rescue
|
35
|
-
unless Rails.env.test?
|
36
|
-
Avo.logger.info "Failed to find component for the `#{self.class}` field on the `#{view}` view."
|
37
|
-
end
|
38
|
-
# When returning nil, a race condition happens and throws an error in some environments.
|
39
|
-
# See https://github.com/avo-hq/avo/pull/365
|
40
|
-
::Avo::BlankFieldComponent
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
data/lib/avo/view_inquirer.rb
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
# Allows to check the the view type by using `view.index?` or `view.edit?` etc...
|
2
|
-
# It also allows to check if the view is a form or a display view by using `view.form?` or `view.display?`
|
3
|
-
module Avo
|
4
|
-
class ViewInquirer < ActiveSupport::StringInquirer
|
5
|
-
DISPLAY_VIEWS = %w[index show]
|
6
|
-
FORM_VIEWS = %w[new edit]
|
7
|
-
|
8
|
-
def initialize(view)
|
9
|
-
super(view.to_s)
|
10
|
-
|
11
|
-
@display = in? DISPLAY_VIEWS
|
12
|
-
@form = in? FORM_VIEWS
|
13
|
-
end
|
14
|
-
|
15
|
-
def display?
|
16
|
-
@display
|
17
|
-
end
|
18
|
-
|
19
|
-
def form?
|
20
|
-
@form
|
21
|
-
end
|
22
|
-
|
23
|
-
# To avoid breaking changes we allow the comparison with symbols
|
24
|
-
def ==(other)
|
25
|
-
if other.is_a? Symbol
|
26
|
-
to_sym == other
|
27
|
-
else
|
28
|
-
super(other)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def in?(another_object)
|
33
|
-
super another_object.map(&:to_s)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
module Generators
|
2
|
-
module Avo
|
3
|
-
module Concerns
|
4
|
-
module ParentController
|
5
|
-
extend ActiveSupport::Concern
|
6
|
-
|
7
|
-
included do
|
8
|
-
class_option "parent-controller",
|
9
|
-
desc: "The name of the parent controller.",
|
10
|
-
type: :string,
|
11
|
-
required: false
|
12
|
-
end
|
13
|
-
|
14
|
-
def parent_controller
|
15
|
-
options["parent-controller"] || ::Avo.configuration.resource_parent_controller
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|