avo 3.0.1.beta24 → 3.0.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.

Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +5 -5
  3. data/Gemfile.lock +164 -128
  4. data/README.md +19 -27
  5. data/app/components/avo/actions_component.rb +2 -2
  6. data/app/components/avo/fields/belongs_to_field/edit_component.html.erb +122 -104
  7. data/app/components/avo/fields/belongs_to_field/edit_component.rb +11 -0
  8. data/app/components/avo/fields/location_field/edit_component.html.erb +12 -10
  9. data/app/components/avo/index/grid_item_component.html.erb +1 -1
  10. data/app/components/avo/index/resource_table_component.html.erb +2 -2
  11. data/app/components/avo/index/resource_table_component.rb +16 -0
  12. data/app/components/avo/index/table_row_component.html.erb +1 -1
  13. data/app/components/avo/items/panel_component.html.erb +25 -0
  14. data/app/components/avo/items/panel_component.rb +43 -0
  15. data/app/components/avo/items/switcher_component.html.erb +17 -0
  16. data/app/components/avo/items/switcher_component.rb +79 -0
  17. data/app/components/avo/items/visible_items_component.html.erb +10 -0
  18. data/app/components/avo/items/visible_items_component.rb +11 -0
  19. data/app/components/avo/modal_component.html.erb +11 -7
  20. data/app/components/avo/modal_component.rb +21 -0
  21. data/app/components/avo/paginator_component.html.erb +29 -40
  22. data/app/components/avo/paginator_component.rb +18 -0
  23. data/app/components/avo/panel_component.html.erb +2 -2
  24. data/app/components/avo/referrer_params_component.html.erb +1 -0
  25. data/app/components/avo/resource_component.rb +8 -15
  26. data/app/components/avo/resource_sidebar_component.html.erb +11 -18
  27. data/app/components/avo/resource_sidebar_component.rb +4 -2
  28. data/app/components/avo/sidebar_profile_component.html.erb +1 -1
  29. data/app/components/avo/tab_group_component.html.erb +1 -1
  30. data/app/components/avo/views/resource_edit_component.html.erb +15 -32
  31. data/app/components/avo/views/resource_edit_component.rb +18 -6
  32. data/app/components/avo/views/resource_index_component.rb +1 -0
  33. data/app/components/avo/views/resource_show_component.html.erb +14 -33
  34. data/app/components/avo/views/resource_show_component.rb +11 -0
  35. data/app/controllers/avo/actions_controller.rb +6 -4
  36. data/app/controllers/avo/application_controller.rb +2 -33
  37. data/app/controllers/avo/base_controller.rb +25 -16
  38. data/app/helpers/avo/application_helper.rb +4 -0
  39. data/app/javascript/js/controllers/fields/reload_belongs_to_field_controller.js +51 -0
  40. data/app/javascript/js/controllers.js +2 -0
  41. data/app/views/avo/actions/show.html.erb +4 -3
  42. data/app/views/avo/base/_new_via_belongs_to.html.erb +12 -0
  43. data/app/views/avo/base/close_modal_and_reload_field.turbo_stream.erb +8 -0
  44. data/app/views/avo/base/create_fail_action.turbo_stream.erb +13 -0
  45. data/app/views/avo/partials/_flash_alerts.turbo_stream.erb +3 -0
  46. data/config/i18n-tasks.yml +1 -1
  47. data/config/initializers/pagy.rb +2 -0
  48. data/config/master.key +1 -0
  49. data/lib/avo/base_action.rb +44 -38
  50. data/lib/avo/base_resource.rb +7 -8
  51. data/lib/avo/concerns/borrow_items_holder.rb +35 -0
  52. data/lib/avo/concerns/has_items.rb +65 -47
  53. data/lib/avo/concerns/hydration.rb +17 -0
  54. data/lib/avo/concerns/is_resource_item.rb +2 -10
  55. data/lib/avo/concerns/pagination.rb +53 -0
  56. data/lib/avo/concerns/visible_items.rb +7 -30
  57. data/lib/avo/dsl/field_parser.rb +1 -1
  58. data/lib/avo/fields/concerns/is_searchable.rb +3 -1
  59. data/lib/avo/fields/location_field.rb +2 -2
  60. data/lib/avo/filters/base_filter.rb +1 -0
  61. data/lib/avo/html/builder.rb +1 -0
  62. data/lib/avo/licensing/h_q.rb +4 -6
  63. data/lib/avo/licensing/license.rb +4 -0
  64. data/lib/avo/plugin.rb +5 -1
  65. data/lib/avo/resources/items/holder.rb +29 -11
  66. data/lib/avo/resources/items/item_group.rb +4 -9
  67. data/lib/avo/resources/items/main_panel.rb +10 -0
  68. data/lib/avo/resources/items/row.rb +4 -16
  69. data/lib/avo/resources/items/sidebar.rb +9 -10
  70. data/lib/avo/resources/items/tab.rb +3 -9
  71. data/lib/avo/resources/items/tab_group.rb +6 -12
  72. data/lib/avo/version.rb +1 -1
  73. data/lib/generators/avo/templates/locales/avo.ar.yml +7 -6
  74. data/lib/generators/avo/templates/locales/avo.en.yml +2 -0
  75. data/lib/generators/avo/templates/locales/avo.es.yml +127 -0
  76. data/lib/generators/avo/templates/locales/avo.fr.yml +2 -0
  77. data/lib/generators/avo/templates/locales/avo.nb.yml +2 -0
  78. data/lib/generators/avo/templates/locales/avo.nn.yml +2 -0
  79. data/lib/generators/avo/templates/locales/avo.pt-BR.yml +2 -0
  80. data/lib/generators/avo/templates/locales/avo.pt.yml +2 -0
  81. data/lib/generators/avo/templates/locales/avo.ro.yml +2 -0
  82. data/lib/generators/avo/templates/locales/avo.tr.yml +2 -0
  83. data/public/avo-assets/avo.base.css +121 -4
  84. data/public/avo-assets/avo.base.js +86 -86
  85. data/public/avo-assets/avo.base.js.map +3 -3
  86. data/public/avo-assets/avo.css +9744 -0
  87. data/public/avo-assets/avo.js +513 -0
  88. data/public/avo-assets/avo.js.map +7 -0
  89. metadata +23 -8
  90. data/app/components/avo/item_switcher_component.html.erb +0 -27
  91. data/app/components/avo/item_switcher_component.rb +0 -48
  92. data/app/views/avo/actions/keep_modal_open.turbo_stream.erb +0 -5
  93. data/lib/avo/action_model.rb +0 -20
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: 3.0.1.beta24
4
+ version: 3.0.2
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: 2023-11-03 00:00:00.000000000 Z
12
+ date: 2023-11-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
@@ -1565,8 +1565,12 @@ files:
1565
1565
  - app/components/avo/index/resource_table_component.rb
1566
1566
  - app/components/avo/index/table_row_component.html.erb
1567
1567
  - app/components/avo/index/table_row_component.rb
1568
- - app/components/avo/item_switcher_component.html.erb
1569
- - app/components/avo/item_switcher_component.rb
1568
+ - app/components/avo/items/panel_component.html.erb
1569
+ - app/components/avo/items/panel_component.rb
1570
+ - app/components/avo/items/switcher_component.html.erb
1571
+ - app/components/avo/items/switcher_component.rb
1572
+ - app/components/avo/items/visible_items_component.html.erb
1573
+ - app/components/avo/items/visible_items_component.rb
1570
1574
  - app/components/avo/loading_component.html.erb
1571
1575
  - app/components/avo/loading_component.rb
1572
1576
  - app/components/avo/modal_component.html.erb
@@ -1640,6 +1644,7 @@ files:
1640
1644
  - app/javascript/js/controllers/fields/easy_mde_controller.js
1641
1645
  - app/javascript/js/controllers/fields/key_value_controller.js
1642
1646
  - app/javascript/js/controllers/fields/progress_bar_field_controller.js
1647
+ - app/javascript/js/controllers/fields/reload_belongs_to_field_controller.js
1643
1648
  - app/javascript/js/controllers/fields/tags_field_helpers.js
1644
1649
  - app/javascript/js/controllers/fields/trix_field_controller.js
1645
1650
  - app/javascript/js/controllers/filter_controller.js
@@ -1668,14 +1673,16 @@ files:
1668
1673
  - app/javascript/js/custom-stream-actions.js
1669
1674
  - app/javascript/js/helpers/cast_boolean.js
1670
1675
  - app/javascript/js/helpers/debounce_promise.js
1671
- - app/views/avo/actions/keep_modal_open.turbo_stream.erb
1672
1676
  - app/views/avo/actions/show.html.erb
1673
1677
  - app/views/avo/associations/new.html.erb
1674
1678
  - app/views/avo/attachments/destroy.turbo_stream.erb
1675
1679
  - app/views/avo/base/_boolean_filter.html.erb
1676
1680
  - app/views/avo/base/_multiple_select_filter.html.erb
1681
+ - app/views/avo/base/_new_via_belongs_to.html.erb
1677
1682
  - app/views/avo/base/_select_filter.html.erb
1678
1683
  - app/views/avo/base/_text_filter.html.erb
1684
+ - app/views/avo/base/close_modal_and_reload_field.turbo_stream.erb
1685
+ - app/views/avo/base/create_fail_action.turbo_stream.erb
1679
1686
  - app/views/avo/base/edit.html.erb
1680
1687
  - app/views/avo/base/index.html.erb
1681
1688
  - app/views/avo/base/new.html.erb
@@ -1693,6 +1700,7 @@ files:
1693
1700
  - app/views/avo/home/index.html.erb
1694
1701
  - app/views/avo/partials/_branding.html.erb
1695
1702
  - app/views/avo/partials/_custom_tools_alert.html.erb
1703
+ - app/views/avo/partials/_flash_alerts.turbo_stream.erb
1696
1704
  - app/views/avo/partials/_footer.html.erb
1697
1705
  - app/views/avo/partials/_head.html.erb
1698
1706
  - app/views/avo/partials/_header.html.erb
@@ -1726,15 +1734,16 @@ files:
1726
1734
  - config/credentials.yml.enc
1727
1735
  - config/i18n-tasks.yml
1728
1736
  - config/initializers/pagy.rb
1737
+ - config/master.key
1729
1738
  - config/routes.rb
1730
1739
  - config/spring.rb
1731
1740
  - db/factories.rb
1732
1741
  - lib/avo.rb
1733
- - lib/avo/action_model.rb
1734
1742
  - lib/avo/asset_manager.rb
1735
1743
  - lib/avo/base_action.rb
1736
1744
  - lib/avo/base_resource.rb
1737
1745
  - lib/avo/base_resource_tool.rb
1746
+ - lib/avo/concerns/borrow_items_holder.rb
1738
1747
  - lib/avo/concerns/breadcrumbs.rb
1739
1748
  - lib/avo/concerns/can_replace_items.rb
1740
1749
  - lib/avo/concerns/filters_session_handler.rb
@@ -1744,9 +1753,11 @@ files:
1744
1753
  - lib/avo/concerns/has_item_type.rb
1745
1754
  - lib/avo/concerns/has_items.rb
1746
1755
  - lib/avo/concerns/has_stimulus_controllers.rb
1756
+ - lib/avo/concerns/hydration.rb
1747
1757
  - lib/avo/concerns/is_resource_item.rb
1748
1758
  - lib/avo/concerns/is_visible.rb
1749
1759
  - lib/avo/concerns/model_class_constantized.rb
1760
+ - lib/avo/concerns/pagination.rb
1750
1761
  - lib/avo/concerns/visible_in_different_views.rb
1751
1762
  - lib/avo/concerns/visible_items.rb
1752
1763
  - lib/avo/configuration.rb
@@ -1900,6 +1911,7 @@ files:
1900
1911
  - lib/generators/avo/templates/initializer/avo.tt
1901
1912
  - lib/generators/avo/templates/locales/avo.ar.yml
1902
1913
  - lib/generators/avo/templates/locales/avo.en.yml
1914
+ - lib/generators/avo/templates/locales/avo.es.yml
1903
1915
  - lib/generators/avo/templates/locales/avo.fr.yml
1904
1916
  - lib/generators/avo/templates/locales/avo.nb.yml
1905
1917
  - lib/generators/avo/templates/locales/avo.nn.yml
@@ -1929,6 +1941,9 @@ files:
1929
1941
  - public/avo-assets/avo.base.css
1930
1942
  - public/avo-assets/avo.base.js
1931
1943
  - public/avo-assets/avo.base.js.map
1944
+ - public/avo-assets/avo.css
1945
+ - public/avo-assets/avo.js
1946
+ - public/avo-assets/avo.js.map
1932
1947
  - public/avo-assets/favicon.ico
1933
1948
  - public/avo-assets/fonts/inter-v7-latin-500.eot
1934
1949
  - public/avo-assets/fonts/inter-v7-latin-500.svg
@@ -1976,9 +1991,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
1976
1991
  version: 3.0.0
1977
1992
  required_rubygems_version: !ruby/object:Gem::Requirement
1978
1993
  requirements:
1979
- - - ">"
1994
+ - - ">="
1980
1995
  - !ruby/object:Gem::Version
1981
- version: 1.3.1
1996
+ version: '0'
1982
1997
  requirements: []
1983
1998
  rubygems_version: 3.4.6
1984
1999
  signing_key:
@@ -1,27 +0,0 @@
1
- <% if item.is_tool? %>
2
- <% if item&.partial.present? %>
3
- <%= render item.partial, tool: item, form: @form %>
4
- <% end %>
5
- <% elsif item.is_panel? %>
6
- <%= render Avo::PanelComponent.new(name: item.name, description: item.description, index: index) do |c| %>
7
- <% c.with_body do %>
8
- <div class="divide-y">
9
- <% item.visible_items.each_with_index do |field, index| %>
10
- <%= render Avo::ItemSwitcherComponent.new resource: @resource, item: field, index: index, view: @view, form: form %>
11
- <% end %>
12
- </div>
13
- <% end %>
14
- <% end %>
15
- <% elsif item.is_tab_group? %>
16
- <%= render tab_group_component %>
17
- <% elsif item.is_field? %>
18
- <%= render field_component %>
19
- <% elsif item.is_row? %>
20
- <%= render Avo::RowComponent.new do |c| %>
21
- <% c.with_body do %>
22
- <% item.visible_items.each_with_index do |field, index| %>
23
- <%= render Avo::ItemSwitcherComponent.new resource: @resource, item: field, index: index, view: @view, form: form %>
24
- <% end %>
25
- <% end %>
26
- <% end %>
27
- <% end %>
@@ -1,48 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class Avo::ItemSwitcherComponent < Avo::BaseComponent
4
- include Turbo::FramesHelper
5
-
6
- attr_reader :resource
7
- attr_reader :reflection
8
- attr_reader :index
9
- attr_reader :item
10
- attr_reader :view
11
-
12
- def initialize(resource: nil, reflection: nil, item: nil, index: nil, view: nil, form: nil)
13
- @resource = resource
14
- @reflection = reflection
15
- @form = form
16
- @index = index
17
- @item = item
18
- @view = view
19
- end
20
-
21
- def form
22
- @form || nil
23
- end
24
-
25
- def render?
26
- # Stops rendering if the field should be hidden in reflections
27
- if item.is_field?
28
- return false if in_reflection? && item.hidden_in_reflection?
29
- end
30
-
31
- return false if item.is_main_panel?
32
-
33
- true
34
- end
35
-
36
- def in_reflection?
37
- @reflection.present?
38
- end
39
-
40
- def tab_group_component
41
- Avo::TabGroupComponent.new resource: @resource, group: item.hydrate(view: view), index: index, params: params, form: form, view: view
42
- end
43
-
44
- def field_component
45
- final_item = item.dup.hydrate(resource: @resource, record: @resource.record, user: resource.user, view: view)
46
- final_item.component_for_view(@view).new(field: final_item, resource: @resource, index: index, form: form)
47
- end
48
- end
@@ -1,5 +0,0 @@
1
- <turbo-stream action="append" target="alerts">
2
- <template>
3
- <%= render Avo::FlashAlertsComponent.new flashes: flash %>
4
- </template>
5
- </turbo-stream>
@@ -1,20 +0,0 @@
1
- module Avo
2
- class ActionModel
3
- include ActiveModel::Model
4
-
5
- # This class augments a model the action form declaration.
6
- def initialize(attributes = {})
7
- set_attr_accessors attributes
8
-
9
- super(attributes)
10
- end
11
-
12
- private
13
-
14
- def set_attr_accessors(attributes)
15
- attributes.each do |k, v|
16
- self.class.class_eval { attr_accessor k }
17
- end
18
- end
19
- end
20
- end