avo 0.5.0.beta9 → 0.5.0.beta10

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 +47 -48
  3. data/Gemfile.lock +1 -1
  4. data/Rakefile +14 -14
  5. data/app/components/avo/common/multiple_file_viewer_component.rb +1 -1
  6. data/app/components/avo/common/single_file_viewer_component.rb +1 -1
  7. data/app/components/avo/edit/field_wrapper_component.rb +3 -3
  8. data/app/components/avo/index/field_wrapper_component.rb +1 -1
  9. data/app/components/avo/index/grid_item_component.rb +10 -9
  10. data/app/components/avo/index/resource_controls_component.rb +2 -2
  11. data/app/components/avo/panel_component.rb +7 -6
  12. data/app/components/avo/resource_component.rb +4 -3
  13. data/app/components/avo/show/field_wrapper_component.rb +3 -3
  14. data/app/components/avo/views/resource_edit_component.rb +4 -3
  15. data/app/components/avo/views/resource_index_component.rb +8 -7
  16. data/app/components/avo/views/resource_new_component.rb +4 -3
  17. data/app/components/avo/views/resource_show_component.rb +21 -21
  18. data/app/controllers/avo/actions_controller.rb +30 -29
  19. data/app/controllers/avo/application_controller.rb +113 -126
  20. data/app/controllers/avo/attachments_controller.rb +3 -3
  21. data/app/controllers/avo/base_controller.rb +81 -80
  22. data/app/controllers/avo/home_controller.rb +2 -2
  23. data/app/controllers/avo/relations_controller.rb +29 -28
  24. data/app/controllers/avo/resources_controller.rb +1 -1
  25. data/app/controllers/avo/search_controller.rb +20 -19
  26. data/app/helpers/avo/application_helper.rb +48 -42
  27. data/app/helpers/avo/resources_helper.rb +11 -11
  28. data/app/mailers/avo/application_mailer.rb +2 -2
  29. data/app/packs/entrypoints/application.js +9 -7
  30. data/app/packs/js/controllers/fields/code_field_controller.js +14 -14
  31. data/app/packs/js/controllers/filter_controller.js +9 -8
  32. data/app/packs/js/toastr.js +1 -0
  33. data/avo.gemspec +31 -31
  34. data/config/initializers/inline_svg.rb +1 -1
  35. data/config/initializers/pagy.rb +1 -1
  36. data/config/routes.rb +12 -12
  37. data/config/spring.rb +5 -5
  38. data/db/factories.rb +3 -5
  39. data/lib/avo.rb +6 -6
  40. data/lib/avo/app.rb +18 -18
  41. data/lib/avo/base_action.rb +20 -20
  42. data/lib/avo/base_resource.rb +41 -45
  43. data/lib/avo/configuration.rb +16 -18
  44. data/lib/avo/engine.rb +18 -18
  45. data/lib/avo/fields/badge_field.rb +2 -2
  46. data/lib/avo/fields/base_field.rb +24 -25
  47. data/lib/avo/fields/belongs_to_field.rb +13 -12
  48. data/lib/avo/fields/boolean_field.rb +4 -4
  49. data/lib/avo/fields/boolean_group_field.rb +3 -3
  50. data/lib/avo/fields/code_field.rb +4 -4
  51. data/lib/avo/fields/country_field.rb +2 -2
  52. data/lib/avo/fields/currency_field.rb +3 -3
  53. data/lib/avo/fields/date_field.rb +3 -3
  54. data/lib/avo/fields/date_time_field.rb +2 -2
  55. data/lib/avo/fields/external_image_field.rb +2 -2
  56. data/lib/avo/fields/field_extensions/has_field_name.rb +2 -2
  57. data/lib/avo/fields/field_extensions/visible_in_different_views.rb +34 -33
  58. data/lib/avo/fields/file_field.rb +1 -1
  59. data/lib/avo/fields/files_field.rb +2 -2
  60. data/lib/avo/fields/gravatar_field.rb +9 -9
  61. data/lib/avo/fields/has_and_belongs_to_many_field.rb +1 -1
  62. data/lib/avo/fields/has_many_field.rb +1 -1
  63. data/lib/avo/fields/has_one_field.rb +2 -2
  64. data/lib/avo/fields/heading_field.rb +2 -2
  65. data/lib/avo/fields/hidden_field.rb +1 -1
  66. data/lib/avo/fields/id_field.rb +3 -3
  67. data/lib/avo/fields/key_value_field.rb +12 -12
  68. data/lib/avo/fields/markdown_field.rb +2 -2
  69. data/lib/avo/fields/number_field.rb +3 -3
  70. data/lib/avo/fields/password_field.rb +1 -1
  71. data/lib/avo/fields/select_field.rb +8 -12
  72. data/lib/avo/fields/status_field.rb +4 -4
  73. data/lib/avo/fields/text_field.rb +2 -2
  74. data/lib/avo/fields/textarea_field.rb +2 -2
  75. data/lib/avo/fields/trix_field.rb +1 -1
  76. data/lib/avo/fields_collector.rb +4 -5
  77. data/lib/avo/filters/base_filter.rb +6 -6
  78. data/lib/avo/filters/boolean_filter.rb +1 -1
  79. data/lib/avo/filters/select_filter.rb +1 -1
  80. data/lib/avo/licensing/h_q.rb +56 -55
  81. data/lib/avo/licensing/license.rb +5 -5
  82. data/lib/avo/licensing/license_manager.rb +4 -4
  83. data/lib/avo/licensing/null_license.rb +2 -2
  84. data/lib/avo/licensing/pro_license.rb +1 -1
  85. data/lib/avo/loaders/fields_loader.rb +4 -4
  86. data/lib/avo/services/authorization_service.rb +2 -2
  87. data/lib/avo/services/panel_service.rb +4 -4
  88. data/lib/avo/version.rb +1 -1
  89. data/lib/generators/avo/action_generator.rb +4 -4
  90. data/lib/generators/avo/controller_generator.rb +4 -4
  91. data/lib/generators/avo/filter_generator.rb +5 -5
  92. data/lib/generators/avo/install_generator.rb +8 -8
  93. data/lib/generators/avo/locales_generator.rb +5 -5
  94. data/lib/generators/avo/partials_generator.rb +4 -4
  95. data/lib/generators/avo/resource_generator.rb +5 -5
  96. data/lib/tasks/avo_tasks.rake +52 -53
  97. data/public/avo-packs/css/{application-38e7e91b.css → application-4e16d6a6.css} +4 -4
  98. data/public/avo-packs/css/application-4e16d6a6.css.br +0 -0
  99. data/public/avo-packs/css/{application-38e7e91b.css.gz → application-4e16d6a6.css.gz} +0 -0
  100. data/public/avo-packs/css/{application-38e7e91b.css.map → application-4e16d6a6.css.map} +1 -1
  101. data/public/avo-packs/css/application-4e16d6a6.css.map.br +0 -0
  102. data/public/avo-packs/css/application-4e16d6a6.css.map.gz +0 -0
  103. data/public/avo-packs/js/{application-2b90fe889f7d6df1ad92.js → application-8eb130a4688f2c667703.js} +4 -4
  104. data/public/avo-packs/js/{application-2b90fe889f7d6df1ad92.js.LICENSE.txt → application-8eb130a4688f2c667703.js.LICENSE.txt} +0 -0
  105. data/public/avo-packs/js/application-8eb130a4688f2c667703.js.br +0 -0
  106. data/public/avo-packs/js/application-8eb130a4688f2c667703.js.gz +0 -0
  107. data/public/avo-packs/js/application-8eb130a4688f2c667703.js.map +1 -0
  108. data/public/avo-packs/js/application-8eb130a4688f2c667703.js.map.br +0 -0
  109. data/public/avo-packs/js/application-8eb130a4688f2c667703.js.map.gz +0 -0
  110. data/public/avo-packs/manifest.json +15 -15
  111. metadata +15 -15
  112. data/public/avo-packs/css/application-38e7e91b.css.br +0 -0
  113. data/public/avo-packs/css/application-38e7e91b.css.map.br +0 -0
  114. data/public/avo-packs/css/application-38e7e91b.css.map.gz +0 -0
  115. data/public/avo-packs/js/application-2b90fe889f7d6df1ad92.js.br +0 -0
  116. data/public/avo-packs/js/application-2b90fe889f7d6df1ad92.js.gz +0 -0
  117. data/public/avo-packs/js/application-2b90fe889f7d6df1ad92.js.map +0 -1
  118. data/public/avo-packs/js/application-2b90fe889f7d6df1ad92.js.map.br +0 -0
  119. data/public/avo-packs/js/application-2b90fe889f7d6df1ad92.js.map.gz +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fd4edf66c902806aea55c609cf7265acc8d3242704c3f81f688c804357034343
4
- data.tar.gz: f8ccf103ffbb145d5b5263105ba24329290e6d005c28ff7c9c3371a96fedf0d0
3
+ metadata.gz: bbc5163742282b121c065a97fc808446b8d7e1dfe05ff3a85eb46c86bc0e5794
4
+ data.tar.gz: 5ee2eba0895df8227d2ab6630e50759f177c291efe672b79a1dedf143e5ad25d
5
5
  SHA512:
6
- metadata.gz: b4ac9daac031f9e81cf5e4bd19797e3e811cbe6b629aff1cefd069b906b7952561798fc4301cd929a2a973678ad889393c058983bc494e6d3e40d37a9d5b3651
7
- data.tar.gz: bb58f96475ccf2d3c719fa1b6292a9f76f71c95186fa357e7703963b160d0d9d2e3cf80da8f4355af6a9f48a9930d0c437e8e62d4a580695ba6933a7198bcb7c
6
+ metadata.gz: 3bfbe17a6b34aa4fd206ca6688fdca752e0fdebf6fcfcc38945af4b0e9cbe48a468b6643124cd0d65f9a7cfe0f2376f4a00271eeb8bcbf7346a0c6b12f5ccce4
7
+ data.tar.gz: 17dd64588f184560a367f54f29b40a802ab1dc530fb8ccae5785be415a1fd8ff10ea1a37aac3597690cb525eac78c28f2c86d9103dacb786197057b9b12a3716
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
  git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3
3
 
4
4
  # Declare your gem's dependencies in avo.gemspec.
@@ -15,113 +15,112 @@ gemspec
15
15
  # gem 'byebug', group: [:development, :test]
16
16
 
17
17
  # Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
18
- gem 'webpacker', '6.0.0.beta.6'
18
+ gem "webpacker", "6.0.0.beta.6"
19
19
 
20
20
  # SVGs
21
- gem 'inline_svg'
21
+ gem "inline_svg"
22
22
 
23
- gem 'countries'
23
+ gem "countries"
24
24
 
25
25
  # Authorization
26
- gem 'pundit'
26
+ gem "pundit"
27
27
 
28
28
  #
29
29
  # Dependencies for dummy_app
30
30
  #
31
31
  # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
32
- gem 'rails', '~> 6.0.2', '>= 6.0.2.2'
32
+ gem "rails", "~> 6.0.2", ">= 6.0.2.2"
33
33
  # Use postgresql as the database for Active Record
34
- gem 'pg', '>= 0.18', '< 2.0'
34
+ gem "pg", ">= 0.18", "< 2.0"
35
35
  # Use Puma as the app server
36
- gem 'puma', '~> 4.3.5'
36
+ gem "puma", "~> 4.3.5"
37
37
  # Use SCSS for stylesheets
38
- gem 'sass-rails', '>= 6'
38
+ gem "sass-rails", ">= 6"
39
39
  # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
40
40
  # gem 'turbolinks', '~> 5'
41
41
  # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
42
- gem 'jbuilder', '~> 2.7'
42
+ gem "jbuilder", "~> 2.7"
43
43
  # Use Redis adapter to run Action Cable in production
44
44
  # gem 'redis', '~> 4.0'
45
45
  # Use Active Model has_secure_password
46
46
  # gem 'bcrypt', '~> 3.1.7'
47
47
 
48
48
  # Use Active Storage variant
49
- gem 'image_processing', '~> 1.2'
49
+ gem "image_processing", "~> 1.2"
50
50
 
51
51
  # Reduces boot times through caching; required in config/boot.rb
52
- gem 'bootsnap', '>= 1.4.2', require: false
52
+ gem "bootsnap", ">= 1.4.2", require: false
53
53
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
54
- gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
55
- gem 'dotenv-rails'
54
+ gem "byebug", platforms: [:mri, :mingw, :x64_mingw]
55
+ gem "dotenv-rails"
56
56
  # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
57
- gem 'web-console', '>= 3.3.0'
58
- gem 'listen', '>= 3.0.5', '< 3.2'
57
+ gem "web-console", ">= 3.3.0"
58
+ gem "listen", ">= 3.0.5", "< 3.2"
59
59
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
60
- gem 'spring'
60
+ gem "spring"
61
61
 
62
- gem 'factory_bot_rails'
62
+ gem "factory_bot_rails"
63
63
  # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
64
- gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
64
+ gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby]
65
65
 
66
- gem 'devise'
67
- gem 'database_cleaner'
66
+ gem "devise"
67
+ gem "database_cleaner"
68
68
 
69
- gem 'ruby-debug-ide', require: false
70
- gem 'debase'
69
+ gem "ruby-debug-ide", require: false
70
+ gem "debase"
71
71
  #
72
72
  # END Dependencies for dummy_app
73
73
  #
74
74
 
75
75
  group :development do
76
- gem 'standard'
76
+ gem "standard"
77
77
 
78
78
  # Release helper
79
- gem 'bump', require: false
80
- gem 'gem-release', require: false
79
+ gem "bump", require: false
80
+ gem "gem-release", require: false
81
81
 
82
82
  # gem 'rack-mini-profiler'
83
83
  # gem 'memory_profiler'
84
84
  # gem 'stackprof'
85
85
  # gem 'ruby-prof'
86
86
 
87
-
88
87
  # gem 'pry-rails'
89
88
  end
90
89
 
91
90
  group :development, :test do
92
- gem 'faker', require: false
91
+ gem "faker", require: false
93
92
  end
94
93
 
95
94
  group :test do
96
- gem 'rspec-rails', '~> 4.0.0'
97
- gem 'rails-controller-testing'
95
+ gem "rspec-rails", "~> 4.0.0"
96
+ gem "rails-controller-testing"
98
97
  # Adds support for Capybara system testing and selenium driver
99
- gem 'capybara', '>= 2.15'
100
- gem 'selenium-webdriver'
98
+ gem "capybara", ">= 2.15"
99
+ gem "selenium-webdriver"
101
100
  # Easy installation and use of web drivers to run system tests with browsers
102
- gem 'webdrivers'
103
- gem 'fuubar'
104
- gem 'simplecov', require: false
105
- gem 'simplecov-cobertura'
106
- gem 'webmock'
107
- gem 'spring-commands-rspec'
108
-
109
- gem 'test-prof'
101
+ gem "webdrivers"
102
+ gem "fuubar"
103
+ gem "simplecov", require: false
104
+ gem "simplecov-cobertura"
105
+ gem "webmock"
106
+ gem "spring-commands-rspec"
107
+
108
+ gem "test-prof"
110
109
  end
111
110
 
112
- gem 'zeitwerk', '~> 2.3'
111
+ gem "zeitwerk", "~> 2.3"
113
112
 
114
113
  # Pagination
115
- gem 'pagy'
114
+ gem "pagy"
116
115
 
117
- gem 'httparty'
116
+ gem "httparty"
118
117
 
119
- gem 'iso'
118
+ gem "iso"
120
119
 
121
- gem 'hotwire-rails'
120
+ gem "hotwire-rails"
122
121
 
123
- gem 'active_link_to'
122
+ gem "active_link_to"
124
123
 
125
- gem 'view_component', require: 'view_component/engine'
124
+ gem "view_component", require: "view_component/engine"
126
125
 
127
- gem 'addressable'
126
+ gem "addressable"
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- avo (0.5.0.beta9)
4
+ avo (0.5.0.beta10)
5
5
  active_link_to
6
6
  addressable
7
7
  countries
data/Rakefile CHANGED
@@ -1,31 +1,31 @@
1
1
  begin
2
- require 'bundler/setup'
2
+ require "bundler/setup"
3
3
  rescue LoadError
4
- puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
4
+ puts "You must `gem install bundler` and `bundle install` to run rake tasks"
5
5
  end
6
6
 
7
- require 'rdoc/task'
7
+ require "rdoc/task"
8
8
 
9
9
  RDoc::Task.new(:rdoc) do |rdoc|
10
- rdoc.rdoc_dir = 'rdoc'
11
- rdoc.title = 'Avo'
12
- rdoc.options << '--line-numbers'
13
- rdoc.rdoc_files.include('README.md')
14
- rdoc.rdoc_files.include('lib/**/*.rb')
10
+ rdoc.rdoc_dir = "rdoc"
11
+ rdoc.title = "Avo"
12
+ rdoc.options << "--line-numbers"
13
+ rdoc.rdoc_files.include("README.md")
14
+ rdoc.rdoc_files.include("lib/**/*.rb")
15
15
  end
16
16
 
17
17
  APP_RAKEFILE = File.expand_path("spec/dummy/Rakefile", __dir__)
18
- load 'rails/tasks/engine.rake'
18
+ load "rails/tasks/engine.rake"
19
19
 
20
- load 'rails/tasks/statistics.rake'
20
+ load "rails/tasks/statistics.rake"
21
21
 
22
- require 'bundler/gem_tasks'
22
+ require "bundler/gem_tasks"
23
23
 
24
- require 'rake/testtask'
24
+ require "rake/testtask"
25
25
 
26
26
  Rake::TestTask.new(:test) do |t|
27
- t.libs << 'test'
28
- t.pattern = 'test/**/*_test.rb'
27
+ t.libs << "test"
28
+ t.pattern = "test/**/*_test.rb"
29
29
  t.verbose = false
30
30
  end
31
31
 
@@ -3,7 +3,7 @@
3
3
  class Avo::Common::MultipleFileViewerComponent < ViewComponent::Base
4
4
  include Avo::ApplicationHelper
5
5
 
6
- def initialize(id:, file:, is_image:, button_size: :md, resource:)
6
+ def initialize(id:, file:, is_image:, resource:, button_size: :md)
7
7
  @id = id
8
8
  @file = file
9
9
  @is_image = is_image
@@ -3,7 +3,7 @@
3
3
  class Avo::Common::SingleFileViewerComponent < ViewComponent::Base
4
4
  include Avo::ApplicationHelper
5
5
 
6
- def initialize(id:, file:, is_image:, button_size: :md, resource:)
6
+ def initialize(id:, file:, is_image:, resource:, button_size: :md)
7
7
  @id = id
8
8
  @file = file
9
9
  @is_image = is_image
@@ -4,7 +4,7 @@ class Avo::Edit::FieldWrapperComponent < ViewComponent::Base
4
4
  def initialize(field: nil, dash_if_blank: true, full_width: false, displayed_in_modal: false, form: nil, resource: {}, **args)
5
5
  @field = field
6
6
  @dash_if_blank = dash_if_blank
7
- @classes = args[:class].present? ? args[:class] : ''
7
+ @classes = args[:class].present? ? args[:class] : ""
8
8
  @args = args
9
9
  @displayed_in_modal = displayed_in_modal
10
10
  @form = form
@@ -12,8 +12,8 @@ class Avo::Edit::FieldWrapperComponent < ViewComponent::Base
12
12
  @model = resource.present? ? resource.model : nil
13
13
  @full_width = full_width
14
14
 
15
- if @index != 0 or @displayed_in_modal
16
- @classes += ' border-t'
15
+ if (@index != 0) || @displayed_in_modal
16
+ @classes += " border-t"
17
17
  end
18
18
  end
19
19
  end
@@ -4,7 +4,7 @@ class Avo::Index::FieldWrapperComponent < ViewComponent::Base
4
4
  def initialize(field: nil, dash_if_blank: true, **args)
5
5
  @field = field
6
6
  @dash_if_blank = dash_if_blank
7
- @classes = args[:class].present? ? args[:class] : ''
7
+ @classes = args[:class].present? ? args[:class] : ""
8
8
  @args = args
9
9
  end
10
10
  end
@@ -11,15 +11,16 @@ class Avo::Index::GridItemComponent < ViewComponent::Base
11
11
  end
12
12
 
13
13
  private
14
- def cover
15
- @grid_fields.cover_field
16
- end
17
14
 
18
- def title
19
- @grid_fields.title_field
20
- end
15
+ def cover
16
+ @grid_fields.cover_field
17
+ end
18
+
19
+ def title
20
+ @grid_fields.title_field
21
+ end
21
22
 
22
- def body
23
- @grid_fields.body_field
24
- end
23
+ def body
24
+ @grid_fields.body_field
25
+ end
25
26
  end
@@ -9,8 +9,8 @@ class Avo::Index::ResourceControlsComponent < Avo::ResourceComponent
9
9
 
10
10
  def can_detach?
11
11
  @reflection.present? &&
12
- @resource.model.present? &&
13
- (@reflection.is_a?(::ActiveRecord::Reflection::HasManyReflection) || @reflection.is_a?(::ActiveRecord::Reflection::ThroughReflection))
12
+ @resource.model.present? &&
13
+ (@reflection.is_a?(::ActiveRecord::Reflection::HasManyReflection) || @reflection.is_a?(::ActiveRecord::Reflection::ThroughReflection))
14
14
  end
15
15
 
16
16
  def can_edit?
@@ -10,11 +10,12 @@ class Avo::PanelComponent < ViewComponent::Base
10
10
  end
11
11
 
12
12
  private
13
- def data_attributes
14
- return if @data.blank?
15
13
 
16
- @data.map do |key, value|
17
- " data-#{key}=\"#{value}\""
18
- end.join
19
- end
14
+ def data_attributes
15
+ return if @data.blank?
16
+
17
+ @data.map do |key, value|
18
+ " data-#{key}=\"#{value}\""
19
+ end.join
20
+ end
20
21
  end
@@ -8,7 +8,8 @@ class Avo::ResourceComponent < ViewComponent::Base
8
8
  end
9
9
 
10
10
  private
11
- def simple_relation?
12
- @reflection.is_a? ::ActiveRecord::Reflection::HasManyReflection
13
- end
11
+
12
+ def simple_relation?
13
+ @reflection.is_a? ::ActiveRecord::Reflection::HasManyReflection
14
+ end
14
15
  end
@@ -4,12 +4,12 @@ class Avo::Show::FieldWrapperComponent < ViewComponent::Base
4
4
  def initialize(field: nil, dash_if_blank: true, full_width: false, **args)
5
5
  @field = field
6
6
  @dash_if_blank = dash_if_blank
7
- @classes = args[:class].present? ? args[:class] : ''
7
+ @classes = args[:class].present? ? args[:class] : ""
8
8
  @args = args
9
9
  @full_width = full_width
10
10
 
11
- if @index != 0 or @displayed_in_modal
12
- @classes += ' border-t'
11
+ if (@index != 0) || @displayed_in_modal
12
+ @classes += " border-t"
13
13
  end
14
14
  end
15
15
  end
@@ -17,7 +17,8 @@ class Avo::Views::ResourceEditComponent < ViewComponent::Base
17
17
  end
18
18
 
19
19
  private
20
- def via_resource?
21
- params[:via_resource_class].present? and params[:via_resource_id].present?
22
- end
20
+
21
+ def via_resource?
22
+ params[:via_resource_class].present? && params[:via_resource_id].present?
23
+ end
23
24
  end
@@ -13,7 +13,7 @@ class Avo::Views::ResourceIndexComponent < Avo::ResourceComponent
13
13
  filters: [],
14
14
  actions: [],
15
15
  reflection: nil,
16
- turbo_frame: '',
16
+ turbo_frame: "",
17
17
  parent_model: nil
18
18
  )
19
19
  @resource = resource
@@ -63,7 +63,7 @@ class Avo::Views::ResourceIndexComponent < Avo::ResourceComponent
63
63
  if @reflection.present?
64
64
  path_args = {
65
65
  via_relation_class: @parent_model.model_name,
66
- via_resource_id: @parent_model.id,
66
+ via_resource_id: @parent_model.id
67
67
  }
68
68
 
69
69
  if @reflection.inverse_of.present?
@@ -77,7 +77,7 @@ class Avo::Views::ResourceIndexComponent < Avo::ResourceComponent
77
77
  end
78
78
 
79
79
  def attach_path
80
- "#{Avo.configuration.root_path}#{request.env['PATH_INFO']}/new"
80
+ "#{Avo.configuration.root_path}#{request.env["PATH_INFO"]}/new"
81
81
  end
82
82
 
83
83
  def detach_path
@@ -85,9 +85,10 @@ class Avo::Views::ResourceIndexComponent < Avo::ResourceComponent
85
85
  end
86
86
 
87
87
  private
88
- def simple_relation?
89
- return @reflection.is_a? ::ActiveRecord::Reflection::HasManyReflection if @reflection.present?
90
88
 
91
- true
92
- end
89
+ def simple_relation?
90
+ return @reflection.is_a? ::ActiveRecord::Reflection::HasManyReflection if @reflection.present?
91
+
92
+ true
93
+ end
93
94
  end
@@ -21,7 +21,8 @@ class Avo::Views::ResourceNewComponent < ViewComponent::Base
21
21
  end
22
22
 
23
23
  private
24
- def via_resource?
25
- params[:via_relation_class].present? and params[:via_resource_id].present?
26
- end
24
+
25
+ def via_resource?
26
+ params[:via_relation_class].present? && params[:via_resource_id].present?
27
+ end
27
28
  end
@@ -38,29 +38,29 @@ class Avo::Views::ResourceShowComponent < Avo::ResourceComponent
38
38
  end
39
39
 
40
40
  private
41
- def via_resource?
42
- params[:via_resource_class].present? and params[:via_resource_id].present?
43
- end
44
41
 
45
- def split_panel_fields
46
- @fields_by_panel = {}
47
- @has_one_panels = []
48
- @has_many_panels = []
49
- @has_as_belongs_to_many_panels = []
42
+ def via_resource?
43
+ params[:via_resource_class].present? && params[:via_resource_id].present?
44
+ end
50
45
 
51
- @resource.get_fields.each do |field|
52
- case field.class.to_s
53
- when 'Avo::Fields::HasOneField'
54
- @has_one_panels << field
55
- when 'Avo::Fields::HasManyField'
56
- @has_many_panels << field
57
- when 'Avo::Fields::HasAndBelongsToManyField'
58
- @has_as_belongs_to_many_panels << field
59
- else
60
- @fields_by_panel[field.panel_name] ||= []
61
- @fields_by_panel[field.panel_name] << field
62
- end
63
- end
46
+ def split_panel_fields
47
+ @fields_by_panel = {}
48
+ @has_one_panels = []
49
+ @has_many_panels = []
50
+ @has_as_belongs_to_many_panels = []
64
51
 
52
+ @resource.get_fields.each do |field|
53
+ case field.class.to_s
54
+ when "Avo::Fields::HasOneField"
55
+ @has_one_panels << field
56
+ when "Avo::Fields::HasManyField"
57
+ @has_many_panels << field
58
+ when "Avo::Fields::HasAndBelongsToManyField"
59
+ @has_as_belongs_to_many_panels << field
60
+ else
61
+ @fields_by_panel[field.panel_name] ||= []
62
+ @fields_by_panel[field.panel_name] << field
63
+ end
65
64
  end
65
+ end
66
66
  end