avo 0.5.0.beta9 → 0.5.0.beta14
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 +46 -50
- data/Gemfile.lock +1 -6
- data/Rakefile +14 -14
- data/app/components/avo/common/multiple_file_viewer_component.rb +1 -1
- data/app/components/avo/common/single_file_viewer_component.rb +1 -1
- data/app/components/avo/edit/field_wrapper_component.rb +3 -3
- data/app/components/avo/index/field_wrapper_component.rb +1 -1
- data/app/components/avo/index/grid_item_component.rb +10 -9
- data/app/components/avo/index/resource_controls_component.rb +2 -2
- data/app/components/avo/panel_component.rb +7 -6
- data/app/components/avo/resource_component.rb +4 -3
- data/app/components/avo/show/field_wrapper_component.rb +3 -3
- data/app/components/avo/views/resource_edit_component.rb +4 -3
- data/app/components/avo/views/resource_index_component.rb +8 -7
- data/app/components/avo/views/resource_new_component.rb +4 -3
- data/app/components/avo/views/resource_show_component.rb +21 -21
- data/app/controllers/avo/actions_controller.rb +30 -29
- data/app/controllers/avo/application_controller.rb +113 -126
- data/app/controllers/avo/attachments_controller.rb +3 -3
- data/app/controllers/avo/base_controller.rb +81 -80
- data/app/controllers/avo/home_controller.rb +2 -2
- data/app/controllers/avo/relations_controller.rb +29 -28
- data/app/controllers/avo/resources_controller.rb +1 -1
- data/app/controllers/avo/search_controller.rb +20 -19
- data/app/helpers/avo/application_helper.rb +48 -42
- data/app/helpers/avo/resources_helper.rb +11 -11
- data/app/mailers/avo/application_mailer.rb +2 -2
- data/app/packs/entrypoints/application.js +9 -7
- data/app/packs/images/logo.png +0 -0
- data/app/packs/js/controllers/fields/code_field_controller.js +14 -14
- data/app/packs/js/controllers/filter_controller.js +9 -8
- data/app/packs/js/toastr.js +1 -0
- data/avo.gemspec +30 -31
- data/config/initializers/pagy.rb +1 -1
- data/config/routes.rb +12 -12
- data/config/spring.rb +5 -5
- data/config/webpack/base.js +2 -2
- data/config/webpacker.yml +32 -0
- data/db/factories.rb +3 -5
- data/lib/avo.rb +6 -6
- data/lib/avo/app.rb +18 -18
- data/lib/avo/base_action.rb +20 -20
- data/lib/avo/base_resource.rb +41 -45
- data/lib/avo/configuration.rb +16 -18
- data/lib/avo/engine.rb +18 -18
- data/lib/avo/fields/badge_field.rb +2 -2
- data/lib/avo/fields/base_field.rb +25 -26
- data/lib/avo/fields/belongs_to_field.rb +13 -12
- data/lib/avo/fields/boolean_field.rb +4 -4
- data/lib/avo/fields/boolean_group_field.rb +3 -3
- data/lib/avo/fields/code_field.rb +4 -4
- data/lib/avo/fields/country_field.rb +2 -2
- data/lib/avo/fields/currency_field.rb +3 -3
- data/lib/avo/fields/date_field.rb +3 -3
- data/lib/avo/fields/date_time_field.rb +2 -2
- data/lib/avo/fields/external_image_field.rb +2 -2
- data/lib/avo/fields/field_extensions/has_field_name.rb +2 -2
- data/lib/avo/fields/field_extensions/visible_in_different_views.rb +34 -33
- data/lib/avo/fields/file_field.rb +1 -1
- data/lib/avo/fields/files_field.rb +2 -2
- data/lib/avo/fields/gravatar_field.rb +9 -9
- data/lib/avo/fields/has_and_belongs_to_many_field.rb +1 -1
- data/lib/avo/fields/has_many_field.rb +1 -1
- data/lib/avo/fields/has_one_field.rb +2 -2
- data/lib/avo/fields/heading_field.rb +2 -2
- data/lib/avo/fields/hidden_field.rb +1 -1
- data/lib/avo/fields/id_field.rb +3 -3
- data/lib/avo/fields/key_value_field.rb +12 -12
- data/lib/avo/fields/markdown_field.rb +2 -2
- data/lib/avo/fields/number_field.rb +3 -3
- data/lib/avo/fields/password_field.rb +1 -1
- data/lib/avo/fields/select_field.rb +8 -12
- data/lib/avo/fields/status_field.rb +4 -4
- data/lib/avo/fields/text_field.rb +2 -2
- data/lib/avo/fields/textarea_field.rb +2 -2
- data/lib/avo/fields/trix_field.rb +1 -1
- data/lib/avo/fields_collector.rb +4 -5
- data/lib/avo/filters/base_filter.rb +6 -6
- data/lib/avo/filters/boolean_filter.rb +1 -1
- data/lib/avo/filters/select_filter.rb +1 -1
- data/lib/avo/licensing/h_q.rb +56 -55
- data/lib/avo/licensing/license.rb +5 -5
- data/lib/avo/licensing/license_manager.rb +4 -4
- data/lib/avo/licensing/null_license.rb +2 -2
- data/lib/avo/licensing/pro_license.rb +1 -1
- data/lib/avo/loaders/fields_loader.rb +4 -4
- data/lib/avo/services/authorization_service.rb +2 -2
- data/lib/avo/services/panel_service.rb +4 -4
- data/lib/avo/version.rb +1 -1
- data/lib/generators/avo/action_generator.rb +4 -4
- data/lib/generators/avo/controller_generator.rb +4 -4
- data/lib/generators/avo/filter_generator.rb +5 -5
- data/lib/generators/avo/install_generator.rb +8 -8
- data/lib/generators/avo/locales_generator.rb +5 -5
- data/lib/generators/avo/partials_generator.rb +4 -4
- data/lib/generators/avo/resource_generator.rb +5 -5
- data/lib/generators/avo/templates/action.tt +0 -4
- data/lib/generators/avo/templates/resource/resource.tt +3 -13
- data/lib/tasks/avo_tasks.rake +0 -60
- data/public/avo-packs/css/{application-38e7e91b.css → application-9d115b7e.css} +44 -147
- data/public/avo-packs/css/application-9d115b7e.css.br +0 -0
- data/public/avo-packs/css/application-9d115b7e.css.gz +0 -0
- data/public/avo-packs/css/application-9d115b7e.css.map +1 -0
- data/public/avo-packs/css/application-9d115b7e.css.map.br +0 -0
- data/public/avo-packs/css/application-9d115b7e.css.map.gz +0 -0
- data/public/avo-packs/js/{application-2b90fe889f7d6df1ad92.js → application-4751feac1bb0404b9c47.js} +4 -4
- data/public/avo-packs/js/{application-2b90fe889f7d6df1ad92.js.LICENSE.txt → application-4751feac1bb0404b9c47.js.LICENSE.txt} +0 -0
- data/public/avo-packs/js/application-4751feac1bb0404b9c47.js.br +0 -0
- data/public/avo-packs/js/application-4751feac1bb0404b9c47.js.gz +0 -0
- data/public/avo-packs/js/application-4751feac1bb0404b9c47.js.map +1 -0
- data/public/avo-packs/js/application-4751feac1bb0404b9c47.js.map.br +0 -0
- data/public/avo-packs/js/application-4751feac1bb0404b9c47.js.map.gz +0 -0
- data/public/avo-packs/manifest.json +16 -16
- data/public/avo-packs/media/images/dadf2db36589607d107d.png +0 -0
- metadata +16 -31
- data/config/initializers/inline_svg.rb +0 -33
- data/public/avo-packs/css/application-38e7e91b.css.br +0 -0
- data/public/avo-packs/css/application-38e7e91b.css.gz +0 -0
- data/public/avo-packs/css/application-38e7e91b.css.map +0 -1
- data/public/avo-packs/css/application-38e7e91b.css.map.br +0 -0
- data/public/avo-packs/css/application-38e7e91b.css.map.gz +0 -0
- data/public/avo-packs/js/application-2b90fe889f7d6df1ad92.js.br +0 -0
- data/public/avo-packs/js/application-2b90fe889f7d6df1ad92.js.gz +0 -0
- data/public/avo-packs/js/application-2b90fe889f7d6df1ad92.js.map +0 -1
- data/public/avo-packs/js/application-2b90fe889f7d6df1ad92.js.map.br +0 -0
- data/public/avo-packs/js/application-2b90fe889f7d6df1ad92.js.map.gz +0 -0
- data/public/avo-packs/media/images/f1b4befac91a3336db9a.png +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 839449acaf247c7135ea8d6a80a6c163d86059f632d1c3ae40a03390be46c29d
|
4
|
+
data.tar.gz: a79e5d8d4d58b1c61e0a7c0a6738a5492e348a6e22049aebf7dc7886c67cb117
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b632623b228c41ceca6b253d1a0df8829a12572227f40d71740975c8692b8c406e5a4437be28a7223c271fce9b6629ffa927e357feb7d8189cae459bde1f0524
|
7
|
+
data.tar.gz: a37d1c79eee1ba3975f72598ba04e8d89835ad98d6be96a0f32b70ff49ec3a4a553508c5f1abff1e9a34831fc38c9db330713935e62b2c4475f5e4bc01b79398
|
data/Gemfile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
source
|
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,109 @@ 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
|
18
|
+
gem "webpacker", "6.0.0.beta.6"
|
19
19
|
|
20
|
-
|
21
|
-
gem 'inline_svg'
|
22
|
-
|
23
|
-
gem 'countries'
|
20
|
+
gem "countries"
|
24
21
|
|
25
22
|
# Authorization
|
26
|
-
gem
|
23
|
+
gem "pundit"
|
27
24
|
|
28
25
|
#
|
29
26
|
# Dependencies for dummy_app
|
30
27
|
#
|
31
28
|
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
32
|
-
gem
|
29
|
+
gem "rails", "~> 6.0.2", ">= 6.0.2.2"
|
33
30
|
# Use postgresql as the database for Active Record
|
34
|
-
gem
|
31
|
+
gem "pg", ">= 0.18", "< 2.0"
|
35
32
|
# Use Puma as the app server
|
36
|
-
gem
|
33
|
+
gem "puma", "~> 4.3.5"
|
37
34
|
# Use SCSS for stylesheets
|
38
|
-
gem
|
35
|
+
gem "sass-rails", ">= 6"
|
39
36
|
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
|
40
37
|
# gem 'turbolinks', '~> 5'
|
41
38
|
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
|
42
|
-
gem
|
39
|
+
gem "jbuilder", "~> 2.7"
|
43
40
|
# Use Redis adapter to run Action Cable in production
|
44
41
|
# gem 'redis', '~> 4.0'
|
45
42
|
# Use Active Model has_secure_password
|
46
43
|
# gem 'bcrypt', '~> 3.1.7'
|
47
44
|
|
48
45
|
# Use Active Storage variant
|
49
|
-
gem
|
46
|
+
gem "image_processing", "~> 1.2"
|
50
47
|
|
51
48
|
# Reduces boot times through caching; required in config/boot.rb
|
52
|
-
gem
|
49
|
+
gem "bootsnap", ">= 1.4.2", require: false
|
53
50
|
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
|
54
|
-
gem
|
55
|
-
gem
|
51
|
+
gem "byebug", platforms: [:mri, :mingw, :x64_mingw]
|
52
|
+
gem "dotenv-rails"
|
56
53
|
# Access an interactive console on exception pages or by calling 'console' anywhere in the code.
|
57
|
-
gem
|
58
|
-
gem
|
54
|
+
gem "web-console", ">= 3.3.0"
|
55
|
+
gem "listen", ">= 3.0.5", "< 3.2"
|
59
56
|
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
|
60
|
-
gem
|
57
|
+
gem "spring"
|
61
58
|
|
62
|
-
gem
|
59
|
+
gem "factory_bot_rails"
|
63
60
|
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
|
64
|
-
gem
|
61
|
+
gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby]
|
65
62
|
|
66
|
-
gem
|
67
|
-
gem
|
63
|
+
gem "devise"
|
64
|
+
gem "database_cleaner"
|
68
65
|
|
69
|
-
gem
|
70
|
-
gem
|
66
|
+
gem "ruby-debug-ide", require: false
|
67
|
+
gem "debase"
|
71
68
|
#
|
72
69
|
# END Dependencies for dummy_app
|
73
70
|
#
|
74
71
|
|
75
72
|
group :development do
|
76
|
-
gem
|
73
|
+
gem "standard"
|
77
74
|
|
78
75
|
# Release helper
|
79
|
-
gem
|
80
|
-
gem
|
76
|
+
gem "bump", require: false
|
77
|
+
gem "gem-release", require: false
|
81
78
|
|
82
79
|
# gem 'rack-mini-profiler'
|
83
80
|
# gem 'memory_profiler'
|
84
81
|
# gem 'stackprof'
|
85
82
|
# gem 'ruby-prof'
|
86
83
|
|
87
|
-
|
88
84
|
# gem 'pry-rails'
|
89
85
|
end
|
90
86
|
|
91
87
|
group :development, :test do
|
92
|
-
gem
|
88
|
+
gem "faker", require: false
|
93
89
|
end
|
94
90
|
|
95
91
|
group :test do
|
96
|
-
gem
|
97
|
-
gem
|
92
|
+
gem "rspec-rails", "~> 4.0.0"
|
93
|
+
gem "rails-controller-testing"
|
98
94
|
# Adds support for Capybara system testing and selenium driver
|
99
|
-
gem
|
100
|
-
gem
|
95
|
+
gem "capybara", ">= 2.15"
|
96
|
+
gem "selenium-webdriver"
|
101
97
|
# Easy installation and use of web drivers to run system tests with browsers
|
102
|
-
gem
|
103
|
-
gem
|
104
|
-
gem
|
105
|
-
gem
|
106
|
-
gem
|
107
|
-
gem
|
108
|
-
|
109
|
-
gem
|
98
|
+
gem "webdrivers"
|
99
|
+
gem "fuubar"
|
100
|
+
gem "simplecov", require: false
|
101
|
+
gem "simplecov-cobertura"
|
102
|
+
gem "webmock"
|
103
|
+
gem "spring-commands-rspec"
|
104
|
+
|
105
|
+
gem "test-prof"
|
110
106
|
end
|
111
107
|
|
112
|
-
gem
|
108
|
+
gem "zeitwerk", "~> 2.3"
|
113
109
|
|
114
110
|
# Pagination
|
115
|
-
gem
|
111
|
+
gem "pagy"
|
116
112
|
|
117
|
-
gem
|
113
|
+
gem "httparty"
|
118
114
|
|
119
|
-
gem
|
115
|
+
gem "iso"
|
120
116
|
|
121
|
-
gem
|
117
|
+
gem "hotwire-rails"
|
122
118
|
|
123
|
-
gem
|
119
|
+
gem "active_link_to"
|
124
120
|
|
125
|
-
gem
|
121
|
+
gem "view_component", require: "view_component/engine"
|
126
122
|
|
127
|
-
gem
|
123
|
+
gem "addressable"
|
data/Gemfile.lock
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
avo (0.5.0.
|
4
|
+
avo (0.5.0.beta14)
|
5
5
|
active_link_to
|
6
6
|
addressable
|
7
7
|
countries
|
8
8
|
hotwire-rails
|
9
9
|
httparty
|
10
10
|
image_processing
|
11
|
-
inline_svg
|
12
11
|
pagy
|
13
12
|
pundit
|
14
13
|
rails (>= 6.0)
|
@@ -148,9 +147,6 @@ GEM
|
|
148
147
|
image_processing (1.12.1)
|
149
148
|
mini_magick (>= 4.9.5, < 5)
|
150
149
|
ruby-vips (>= 2.0.17, < 3)
|
151
|
-
inline_svg (1.7.2)
|
152
|
-
activesupport (>= 3.0)
|
153
|
-
nokogiri (>= 1.6)
|
154
150
|
iso (0.3.0)
|
155
151
|
i18n
|
156
152
|
jbuilder (2.10.1)
|
@@ -376,7 +372,6 @@ DEPENDENCIES
|
|
376
372
|
hotwire-rails
|
377
373
|
httparty
|
378
374
|
image_processing (~> 1.2)
|
379
|
-
inline_svg
|
380
375
|
iso
|
381
376
|
jbuilder (~> 2.7)
|
382
377
|
listen (>= 3.0.5, < 3.2)
|
data/Rakefile
CHANGED
@@ -1,31 +1,31 @@
|
|
1
1
|
begin
|
2
|
-
require
|
2
|
+
require "bundler/setup"
|
3
3
|
rescue LoadError
|
4
|
-
puts
|
4
|
+
puts "You must `gem install bundler` and `bundle install` to run rake tasks"
|
5
5
|
end
|
6
6
|
|
7
|
-
require
|
7
|
+
require "rdoc/task"
|
8
8
|
|
9
9
|
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
-
rdoc.rdoc_dir =
|
11
|
-
rdoc.title
|
12
|
-
rdoc.options <<
|
13
|
-
rdoc.rdoc_files.include(
|
14
|
-
rdoc.rdoc_files.include(
|
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
|
18
|
+
load "rails/tasks/engine.rake"
|
19
19
|
|
20
|
-
load
|
20
|
+
load "rails/tasks/statistics.rake"
|
21
21
|
|
22
|
-
require
|
22
|
+
require "bundler/gem_tasks"
|
23
23
|
|
24
|
-
require
|
24
|
+
require "rake/testtask"
|
25
25
|
|
26
26
|
Rake::TestTask.new(:test) do |t|
|
27
|
-
t.libs <<
|
28
|
-
t.pattern =
|
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
|
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
|
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
|
16
|
-
@classes +=
|
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
|
-
|
19
|
-
|
20
|
-
|
15
|
+
def cover
|
16
|
+
@grid_fields.cover_field
|
17
|
+
end
|
18
|
+
|
19
|
+
def title
|
20
|
+
@grid_fields.title_field
|
21
|
+
end
|
21
22
|
|
22
|
-
|
23
|
-
|
24
|
-
|
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
|
-
|
13
|
-
|
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
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
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
|
-
|
12
|
-
|
13
|
-
|
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
|
12
|
-
@classes +=
|
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
|
-
|
21
|
-
|
22
|
-
|
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[
|
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
|
-
|
92
|
-
|
89
|
+
def simple_relation?
|
90
|
+
return @reflection.is_a? ::ActiveRecord::Reflection::HasManyReflection if @reflection.present?
|
91
|
+
|
92
|
+
true
|
93
|
+
end
|
93
94
|
end
|