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.

Files changed (119) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -2
  3. data/Gemfile.lock +25 -23
  4. data/Rakefile +0 -2
  5. data/app/assets/stylesheets/avo.base.css +0 -1
  6. data/app/components/avo/actions_component.rb +1 -1
  7. data/app/components/avo/field_wrapper_component.html.erb +1 -1
  8. data/app/components/avo/field_wrapper_component.rb +7 -1
  9. data/app/components/avo/fields/boolean_field/index_component.html.erb +1 -1
  10. data/app/components/avo/fields/common/badge_viewer_component.html.erb +24 -1
  11. data/app/components/avo/fields/common/badge_viewer_component.rb +0 -24
  12. data/app/components/avo/fields/common/boolean_check_component.html.erb +12 -1
  13. data/app/components/avo/fields/common/boolean_check_component.rb +1 -2
  14. data/app/components/avo/fields/common/gravatar_viewer_component.html.erb +1 -1
  15. data/app/components/avo/fields/common/gravatar_viewer_component.rb +2 -2
  16. data/app/components/avo/fields/common/heading_component.html.erb +8 -3
  17. data/app/components/avo/fields/common/heading_component.rb +3 -1
  18. data/app/components/avo/fields/common/key_value_component.html.erb +2 -2
  19. data/app/components/avo/fields/common/key_value_component.rb +2 -2
  20. data/app/components/avo/fields/common/progress_bar_component.rb +9 -3
  21. data/app/components/avo/fields/common/status_viewer_component.html.erb +0 -3
  22. data/app/components/avo/fields/edit_component.rb +1 -1
  23. data/app/components/avo/fields/external_image_field/index_component.html.erb +1 -1
  24. data/app/components/avo/fields/file_field/index_component.html.erb +2 -2
  25. data/app/components/avo/fields/gravatar_field/index_component.html.erb +1 -1
  26. data/app/components/avo/fields/heading_field/edit_component.html.erb +1 -1
  27. data/app/components/avo/fields/heading_field/show_component.html.erb +1 -1
  28. data/app/components/avo/fields/id_field/index_component.html.erb +1 -1
  29. data/app/components/avo/fields/index_component.rb +1 -1
  30. data/app/components/avo/fields/show_component.rb +1 -1
  31. data/app/components/avo/fields/text_field/index_component.html.erb +1 -1
  32. data/app/components/avo/index/field_wrapper_component.rb +1 -1
  33. data/app/components/avo/index/resource_controls_component.rb +1 -1
  34. data/app/components/avo/index/resource_table_component.rb +9 -3
  35. data/app/components/avo/resource_component.rb +4 -9
  36. data/app/components/avo/sidebar_profile_component.html.erb +4 -4
  37. data/app/components/avo/tab_group_component.html.erb +1 -1
  38. data/app/components/avo/tab_switcher_component.rb +2 -2
  39. data/app/components/avo/views/resource_edit_component.html.erb +20 -9
  40. data/app/components/avo/views/resource_edit_component.rb +5 -5
  41. data/app/components/avo/views/resource_index_component.rb +1 -1
  42. data/app/components/avo/views/resource_show_component.html.erb +1 -1
  43. data/app/components/avo/views/resource_show_component.rb +1 -1
  44. data/app/controllers/avo/actions_controller.rb +20 -9
  45. data/app/controllers/avo/application_controller.rb +5 -5
  46. data/app/controllers/avo/base_controller.rb +1 -39
  47. data/app/controllers/avo/search_controller.rb +2 -19
  48. data/app/controllers/concerns/avo/initializes_avo.rb +0 -1
  49. data/app/helpers/avo/resources_helper.rb +1 -1
  50. data/app/helpers/avo/url_helpers.rb +1 -1
  51. data/app/views/avo/base/edit.html.erb +1 -1
  52. data/app/views/avo/base/index.html.erb +1 -1
  53. data/app/views/avo/base/new.html.erb +1 -1
  54. data/app/views/avo/base/show.html.erb +1 -1
  55. data/app/views/layouts/avo/application.html.erb +2 -10
  56. data/bin/dev +0 -2
  57. data/config/master.key +1 -0
  58. data/config/routes.rb +3 -4
  59. data/db/factories.rb +1 -1
  60. data/lib/avo/base_action.rb +26 -21
  61. data/lib/avo/base_resource.rb +7 -13
  62. data/lib/avo/concerns/filters_session_handler.rb +3 -3
  63. data/lib/avo/concerns/has_items.rb +5 -1
  64. data/lib/avo/concerns/visible_in_different_views.rb +1 -7
  65. data/lib/avo/configuration.rb +4 -28
  66. data/lib/avo/current.rb +6 -1
  67. data/lib/avo/dsl/field_parser.rb +1 -1
  68. data/lib/avo/execution_context.rb +1 -4
  69. data/lib/avo/fields/badge_field.rb +1 -1
  70. data/lib/avo/fields/base_field.rb +44 -21
  71. data/lib/avo/fields/belongs_to_field.rb +1 -1
  72. data/lib/avo/fields/concerns/has_html_attributes.rb +0 -2
  73. data/lib/avo/fields/external_image_field.rb +2 -2
  74. data/lib/avo/fields/file_field.rb +2 -2
  75. data/lib/avo/fields/gravatar_field.rb +2 -2
  76. data/lib/avo/fields/has_base_field.rb +2 -2
  77. data/lib/avo/fields/heading_field.rb +13 -5
  78. data/lib/avo/fields/id_field.rb +2 -2
  79. data/lib/avo/fields/status_field.rb +1 -3
  80. data/lib/avo/fields/text_field.rb +2 -2
  81. data/lib/avo/filters/base_filter.rb +1 -1
  82. data/lib/avo/html/builder.rb +1 -1
  83. data/lib/avo/licensing/h_q.rb +1 -1
  84. data/lib/avo/licensing/license_manager.rb +1 -1
  85. data/lib/avo/resources/items/holder.rb +6 -0
  86. data/lib/avo/resources/items/item_group.rb +2 -2
  87. data/lib/avo/resources/items/row.rb +3 -3
  88. data/lib/avo/resources/items/sidebar.rb +1 -1
  89. data/lib/avo/resources/items/tab.rb +2 -2
  90. data/lib/avo/resources/items/tab_group.rb +1 -1
  91. data/lib/avo/resources/resource_manager.rb +1 -6
  92. data/lib/avo/version.rb +1 -1
  93. data/lib/avo.rb +0 -9
  94. data/lib/generators/avo/controller_generator.rb +0 -3
  95. data/lib/generators/avo/eject_generator.rb +15 -180
  96. data/lib/generators/avo/field_generator.rb +2 -49
  97. data/lib/generators/avo/js/install_generator.rb +2 -2
  98. data/lib/generators/avo/resource_generator.rb +7 -10
  99. data/lib/generators/avo/tailwindcss/install_generator.rb +12 -58
  100. data/lib/generators/avo/templates/initializer/avo.tt +1 -6
  101. data/lib/generators/avo/templates/resource/controller.tt +1 -1
  102. data/lib/generators/avo/templates/tailwindcss/avo.tailwind.css +3 -5
  103. data/lib/tasks/avo_tasks.rake +5 -33
  104. data/public/avo-assets/avo.base.css +4146 -75
  105. data/{app/assets/builds/avo.base.css → public/avo-assets/avo.css} +3808 -547
  106. data/public/avo-assets/avo.js +513 -0
  107. data/public/avo-assets/avo.js.map +7 -0
  108. metadata +6 -14
  109. data/app/assets/builds/avo.base.js +0 -124556
  110. data/app/assets/builds/avo.base.js.map +0 -7
  111. data/app/assets/builds/avo.custom.js +0 -6
  112. data/app/assets/builds/avo.custom.js.map +0 -7
  113. data/app/assets/stylesheets/css/fields/tags.css +0 -32
  114. data/lib/avo/concerns/has_helpers.rb +0 -18
  115. data/lib/avo/concerns/visible_items.rb +0 -43
  116. data/lib/avo/fields/concerns/use_view_components.rb +0 -45
  117. data/lib/avo/view_inquirer.rb +0 -36
  118. data/lib/generators/avo/concerns/parent_controller.rb +0 -20
  119. 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
@@ -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
@@ -1,11 +0,0 @@
1
- const avoPreset = require('../../tmp/avo/tailwind.preset.js')
2
-
3
- module.exports = {
4
- presets: [avoPreset],
5
- content: [
6
- ...avoPreset.content,
7
- './app/views/**/*.html.erb',
8
- './app/helpers/**/*.rb',
9
- './app/javascript/**/*.js',
10
- ]
11
- }