avo 2.15.3 → 2.16.1.pre.1.nativefields

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 (116) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +0 -2
  3. data/Gemfile.lock +78 -86
  4. data/app/components/avo/base_component.rb +7 -1
  5. data/app/components/avo/field_wrapper_component.html.erb +40 -0
  6. data/app/components/avo/field_wrapper_component.rb +102 -0
  7. data/app/components/avo/fields/badge_field/show_component.html.erb +1 -1
  8. data/app/components/avo/fields/belongs_to_field/edit_component.html.erb +3 -3
  9. data/app/components/avo/fields/belongs_to_field/index_component.html.erb +2 -1
  10. data/app/components/avo/fields/belongs_to_field/show_component.html.erb +2 -2
  11. data/app/components/avo/fields/belongs_to_field/show_component.rb +8 -0
  12. data/app/components/avo/fields/boolean_field/edit_component.html.erb +1 -1
  13. data/app/components/avo/fields/boolean_field/show_component.html.erb +1 -1
  14. data/app/components/avo/fields/boolean_group_field/edit_component.html.erb +1 -1
  15. data/app/components/avo/fields/boolean_group_field/show_component.html.erb +1 -1
  16. data/app/components/avo/fields/code_field/edit_component.html.erb +2 -2
  17. data/app/components/avo/fields/code_field/show_component.html.erb +2 -2
  18. data/app/components/avo/fields/country_field/edit_component.html.erb +1 -1
  19. data/app/components/avo/fields/country_field/show_component.html.erb +1 -1
  20. data/app/components/avo/fields/date_field/edit_component.html.erb +1 -1
  21. data/app/components/avo/fields/date_field/show_component.html.erb +1 -1
  22. data/app/components/avo/fields/date_time_field/edit_component.html.erb +1 -1
  23. data/app/components/avo/fields/date_time_field/show_component.html.erb +1 -1
  24. data/app/components/avo/fields/edit_component.rb +22 -4
  25. data/app/components/avo/fields/external_image_field/edit_component.html.erb +1 -1
  26. data/app/components/avo/fields/external_image_field/index_component.html.erb +1 -1
  27. data/app/components/avo/fields/external_image_field/show_component.html.erb +1 -1
  28. data/app/components/avo/fields/file_field/edit_component.html.erb +1 -1
  29. data/app/components/avo/fields/file_field/index_component.html.erb +2 -2
  30. data/app/components/avo/fields/file_field/show_component.html.erb +1 -1
  31. data/app/components/avo/fields/files_field/edit_component.html.erb +1 -1
  32. data/app/components/avo/fields/files_field/show_component.html.erb +1 -1
  33. data/app/components/avo/fields/gravatar_field/index_component.html.erb +1 -1
  34. data/app/components/avo/fields/gravatar_field/show_component.html.erb +1 -1
  35. data/app/components/avo/fields/has_one_field/show_component.html.erb +14 -1
  36. data/app/components/avo/fields/has_one_field/show_component.rb +21 -0
  37. data/app/components/avo/fields/id_field/edit_component.html.erb +1 -1
  38. data/app/components/avo/fields/id_field/index_component.html.erb +1 -1
  39. data/app/components/avo/fields/id_field/show_component.html.erb +1 -1
  40. data/app/components/avo/fields/index_component.rb +9 -4
  41. data/app/components/avo/fields/key_value_field/edit_component.html.erb +2 -2
  42. data/app/components/avo/fields/key_value_field/show_component.html.erb +1 -1
  43. data/app/components/avo/fields/markdown_field/edit_component.html.erb +2 -2
  44. data/app/components/avo/fields/markdown_field/show_component.html.erb +1 -1
  45. data/app/components/avo/fields/number_field/edit_component.html.erb +1 -1
  46. data/app/components/avo/fields/number_field/show_component.html.erb +1 -1
  47. data/app/components/avo/fields/password_field/edit_component.html.erb +1 -1
  48. data/app/components/avo/fields/progress_bar_field/edit_component.html.erb +1 -1
  49. data/app/components/avo/fields/progress_bar_field/show_component.html.erb +1 -1
  50. data/app/components/avo/fields/select_field/edit_component.html.erb +1 -2
  51. data/app/components/avo/fields/select_field/show_component.html.erb +1 -1
  52. data/app/components/avo/fields/show_component.rb +36 -1
  53. data/app/components/avo/fields/status_field/edit_component.html.erb +1 -1
  54. data/app/components/avo/fields/status_field/show_component.html.erb +1 -1
  55. data/app/components/avo/fields/tags_field/edit_component.html.erb +1 -5
  56. data/app/components/avo/fields/tags_field/show_component.html.erb +1 -1
  57. data/app/components/avo/fields/text_field/edit_component.html.erb +2 -2
  58. data/app/components/avo/fields/text_field/index_component.html.erb +1 -1
  59. data/app/components/avo/fields/text_field/show_component.html.erb +1 -1
  60. data/app/components/avo/fields/textarea_field/edit_component.html.erb +1 -1
  61. data/app/components/avo/fields/textarea_field/show_component.html.erb +1 -1
  62. data/app/components/avo/fields/trix_field/edit_component.html.erb +13 -13
  63. data/app/components/avo/fields/trix_field/edit_component.rb +19 -1
  64. data/app/components/avo/fields/trix_field/show_component.html.erb +1 -1
  65. data/app/components/avo/index/grid_item_component.html.erb +6 -6
  66. data/app/components/avo/index/grid_item_component.rb +15 -0
  67. data/app/components/avo/index/resource_controls_component.rb +3 -0
  68. data/app/components/avo/index/resource_grid_component.rb +1 -1
  69. data/app/components/avo/resource_component.rb +5 -1
  70. data/app/components/avo/sidebar/item_switcher_component.html.erb +3 -3
  71. data/app/components/avo/sidebar/link_component.html.erb +2 -2
  72. data/app/components/avo/sidebar/link_component.rb +3 -1
  73. data/app/components/avo/views/resource_edit_component.html.erb +47 -28
  74. data/app/components/avo/views/resource_edit_component.rb +26 -9
  75. data/app/components/avo/views/resource_show_component.rb +0 -8
  76. data/app/controllers/avo/actions_controller.rb +7 -5
  77. data/app/controllers/avo/application_controller.rb +22 -3
  78. data/app/controllers/avo/associations_controller.rb +2 -2
  79. data/app/controllers/avo/base_controller.rb +24 -11
  80. data/app/helpers/avo/application_helper.rb +31 -3
  81. data/app/helpers/avo/resources_helper.rb +4 -8
  82. data/app/helpers/avo/url_helpers.rb +8 -0
  83. data/app/javascript/js/controllers/action_controller.js +3 -1
  84. data/app/javascript/js/controllers/fields/date_field_controller.js +21 -1
  85. data/app/javascript/js/controllers/search_controller.js +122 -118
  86. data/app/views/avo/actions/show.html.erb +5 -1
  87. data/avo.gemspec +1 -1
  88. data/config/master.key +1 -0
  89. data/lib/avo/base_action.rb +25 -6
  90. data/lib/avo/base_resource.rb +6 -4
  91. data/lib/avo/base_resource_tool.rb +1 -1
  92. data/lib/avo/concerns/fetches_things.rb +2 -0
  93. data/lib/avo/configuration.rb +2 -0
  94. data/lib/avo/fields/base_field.rb +5 -1
  95. data/lib/avo/fields/belongs_to_field.rb +1 -1
  96. data/lib/avo/fields/has_and_belongs_to_many_field.rb +1 -1
  97. data/lib/avo/fields/has_base_field.rb +5 -1
  98. data/lib/avo/fields/has_many_field.rb +1 -1
  99. data/lib/avo/fields/select_field.rb +1 -0
  100. data/lib/avo/menu/base_item.rb +1 -0
  101. data/lib/avo/menu/builder.rb +4 -2
  102. data/lib/avo/menu/menu.rb +2 -0
  103. data/lib/avo/services/authorization_service.rb +24 -20
  104. data/lib/avo/version.rb +1 -1
  105. data/lib/generators/avo/templates/field/components/edit_component.html.erb.tt +1 -1
  106. data/lib/generators/avo/templates/field/components/show_component.html.erb.tt +1 -1
  107. data/public/avo-assets/avo.base.css +26 -8
  108. data/public/avo-assets/avo.base.js +79 -79
  109. data/public/avo-assets/avo.base.js.map +3 -3
  110. metadata +8 -11
  111. data/app/components/avo/common_field_wrapper_component.html.erb +0 -26
  112. data/app/components/avo/common_field_wrapper_component.rb +0 -46
  113. data/app/components/avo/edit/field_wrapper_component.html.erb +0 -11
  114. data/app/components/avo/edit/field_wrapper_component.rb +0 -21
  115. data/app/components/avo/show/field_wrapper_component.html.erb +0 -9
  116. data/app/components/avo/show/field_wrapper_component.rb +0 -12
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.15.3
4
+ version: 2.16.1.pre.1.nativefields
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrian Marin
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-09-15 00:00:00.000000000 Z
12
+ date: 2022-09-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -138,7 +138,7 @@ dependencies:
138
138
  - !ruby/object:Gem::Version
139
139
  version: '2.60'
140
140
  - !ruby/object:Gem::Dependency
141
- name: hotwire-rails
141
+ name: turbo-rails
142
142
  requirement: !ruby/object:Gem::Requirement
143
143
  requirements:
144
144
  - - ">="
@@ -1387,14 +1387,12 @@ files:
1387
1387
  - app/components/avo/button_component.rb
1388
1388
  - app/components/avo/card_component.html.erb
1389
1389
  - app/components/avo/card_component.rb
1390
- - app/components/avo/common_field_wrapper_component.html.erb
1391
- - app/components/avo/common_field_wrapper_component.rb
1392
1390
  - app/components/avo/dashboards/divider_component.html.erb
1393
1391
  - app/components/avo/dashboards/divider_component.rb
1394
- - app/components/avo/edit/field_wrapper_component.html.erb
1395
- - app/components/avo/edit/field_wrapper_component.rb
1396
1392
  - app/components/avo/empty_state_component.html.erb
1397
1393
  - app/components/avo/empty_state_component.rb
1394
+ - app/components/avo/field_wrapper_component.html.erb
1395
+ - app/components/avo/field_wrapper_component.rb
1398
1396
  - app/components/avo/fields/badge_field/index_component.html.erb
1399
1397
  - app/components/avo/fields/badge_field/index_component.rb
1400
1398
  - app/components/avo/fields/badge_field/show_component.html.erb
@@ -1599,8 +1597,6 @@ files:
1599
1597
  - app/components/avo/referrer_params_component.html.erb
1600
1598
  - app/components/avo/referrer_params_component.rb
1601
1599
  - app/components/avo/resource_component.rb
1602
- - app/components/avo/show/field_wrapper_component.html.erb
1603
- - app/components/avo/show/field_wrapper_component.rb
1604
1600
  - app/components/avo/sidebar/base_item_component.rb
1605
1601
  - app/components/avo/sidebar/group_component.html.erb
1606
1602
  - app/components/avo/sidebar/group_component.rb
@@ -1743,6 +1739,7 @@ files:
1743
1739
  - config/cable.yml
1744
1740
  - config/credentials.yml.enc
1745
1741
  - config/initializers/pagy.rb
1742
+ - config/master.key
1746
1743
  - config/routes.rb
1747
1744
  - config/spring.rb
1748
1745
  - db/factories.rb
@@ -1975,9 +1972,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
1975
1972
  version: 2.4.0
1976
1973
  required_rubygems_version: !ruby/object:Gem::Requirement
1977
1974
  requirements:
1978
- - - ">="
1975
+ - - ">"
1979
1976
  - !ruby/object:Gem::Version
1980
- version: '0'
1977
+ version: 1.3.1
1981
1978
  requirements: []
1982
1979
  rubygems_version: 3.3.3
1983
1980
  signing_key:
@@ -1,26 +0,0 @@
1
- <%= content_tag :div,
2
- class: classes("relative flex flex-col md:flex-row md:items-center pb-2 md:pb-0 leading-tight min-h-14"),
3
- style: style,
4
- data: {
5
- field_id: @field.id,
6
- field_type: @field.type,
7
- **stimulus_attributes,
8
- } do %>
9
- <div class="h-full pt-4 md:pt-0 md:h-14 flex self-start items-center text-slate-800">
10
- <div class="<% if @displayed_in_modal %> md:w-48 <% else %> md:w-64 px-6 md:px-6 <% end %> w-48 flex uppercase font-semibold text-gray-500 text-sm" data-slot="label">
11
- <% if @form.present? %>
12
- <%= @form.label @field.id, label %>
13
- <% else %>
14
- <%= @field.name %>
15
- <% end %>
16
- <% if @view != :show && @field.is_required? %> <span class="text-red-600 ml-1">*</span> <% end %>
17
- </div>
18
- </div>
19
- <div class="flex-1 flex flex-row md:min-h-inherit py-2 <% unless @displayed_in_modal %> px-6 <% end %>">
20
- <%= content %>
21
- </div>
22
- <% if params[:avo_debug].present? %>
23
- <!-- Raw value: -->
24
- <!-- <%== @field.value.inspect %> -->
25
- <% end %>
26
- <% end %>
@@ -1,46 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class Avo::CommonFieldWrapperComponent < ViewComponent::Base
4
- attr_reader :view
5
-
6
- def initialize(field: nil, dash_if_blank: true, full_width: false, displayed_in_modal: false, form: nil, resource: nil, label: nil, view: nil, **args)
7
- @field = field
8
- @dash_if_blank = dash_if_blank
9
- @classes = args[:class].present? ? args[:class] : ""
10
- @args = args
11
- @displayed_in_modal = displayed_in_modal
12
- @form = form
13
- @resource = resource
14
- @model = resource.present? ? resource.model : nil
15
- @full_width = full_width
16
- @label = label
17
- @view = view
18
- end
19
-
20
- def classes(extra_classes = "")
21
- "#{@classes || ""} #{extra_classes || ""} #{@field.get_html(:classes, view: view, element: :wrapper)}"
22
- end
23
-
24
- def style
25
- @field.get_html(:style, view: view, element: :wrapper)
26
- end
27
-
28
- def label
29
- @label || @field.name
30
- end
31
-
32
- def stimulus_attributes
33
- attributes = {}
34
-
35
- @resource.get_stimulus_controllers.split(" ").each do |controller|
36
- attributes["#{controller}-target"] = "#{@field.id.to_s.underscore}_#{@field.type.to_s.underscore}_wrapper".camelize(:lower)
37
- end
38
-
39
- wrapper_data_attributes = @field.get_html :data, view: view, element: :wrapper
40
- if wrapper_data_attributes.present?
41
- attributes.merge! wrapper_data_attributes
42
- end
43
-
44
- attributes
45
- end
46
- end
@@ -1,11 +0,0 @@
1
- <%= render Avo::CommonFieldWrapperComponent.new(field: @field, resource: @resource, index: @index, form: @form, displayed_in_modal: @displayed_in_modal, label: @label, view: @resource.view, class: @classes) do %>
2
- <div class="self-center <% if @displayed_in_modal or @full_width %> w-full <% else %> w-full md:w-8/12 <% end %>" data-slot="value">
3
- <%= content %>
4
- <% if @model.present? and @model.errors.include? @field.id %>
5
- <div class="text-red-600 mt-2 text-sm"><%= @model.errors.full_messages_for(@field.id).to_sentence %></div>
6
- <% end %>
7
- <% if help.present? %>
8
- <div class="text-gray-600 mt-2 text-sm"><%== help %></div>
9
- <% end %>
10
- </div>
11
- <% end %>
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class Avo::Edit::FieldWrapperComponent < ViewComponent::Base
4
- def initialize(field: nil, dash_if_blank: true, full_width: false, displayed_in_modal: false, form: nil, resource: {}, label: nil, help: nil, **args)
5
- @field = field
6
- @dash_if_blank = dash_if_blank
7
- @classes = args[:class].present? ? args[:class] : ""
8
- @args = args
9
- @displayed_in_modal = displayed_in_modal
10
- @form = form
11
- @resource = resource
12
- @model = resource.present? ? resource.model : nil
13
- @full_width = full_width
14
- @label = label
15
- @help = help
16
- end
17
-
18
- def help
19
- @help || @field.help
20
- end
21
- end
@@ -1,9 +0,0 @@
1
- <%= render Avo::CommonFieldWrapperComponent.new(field: @field, resource: @resource, dash_if_blank: @dash_if_blank, full_width: @full_width, view: :show) do %>
2
- <div class="self-center <% if @full_width %> w-full <% else %> w-full md:w-8/12 <% end %>" data-slot="value">
3
- <% if @field.value.blank? and @dash_if_blank %>
4
-
5
- <% else %>
6
- <%= content %>
7
- <% end %>
8
- </div>
9
- <% end %>
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class Avo::Show::FieldWrapperComponent < ViewComponent::Base
4
- def initialize(field: nil, resource: nil, dash_if_blank: true, full_width: false, **args)
5
- @field = field
6
- @resource = resource
7
- @dash_if_blank = dash_if_blank
8
- @classes = args[:class].present? ? args[:class] : ""
9
- @args = args
10
- @full_width = full_width
11
- end
12
- end