avo 2.11.1.pre.1 → 2.11.1.pre.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.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a4b497f78cd0e73ec8262210e9c08a7363c79e7a26ba50487d2f7c1a276c2759
4
- data.tar.gz: 5935abd4525e9c013399f2997b964b0c1b37a44eb120b6ffa6cc263250b3e3fd
3
+ metadata.gz: 4bc7baa68c6256d8c8a26e4a40be36129d1187451015bc72c0ec2be65c3acd8b
4
+ data.tar.gz: 57a8ef18222e622ed7d3f45334b46c97183d10ea845b321044648cd1974faf22
5
5
  SHA512:
6
- metadata.gz: '09eab1ccd43a4c4985305190e0016037bbc8b4943898165464e9c4438243790e3fae6655941a4a412958fb9b1ad5adb4f7a919a216d52a4ec102e7a8220ba86b'
7
- data.tar.gz: c74c926431d190ca3c9ecb813d481c80867d8a52d4347bce32b372659d895653dd4bf1ca7a6b82e67e819ef3f0dc7d6baa0d7320ac7ab2fa326059f977cbad6a
6
+ metadata.gz: 3df946571876e5742a86eb9314fe1122ea2838bedd0c3af3027e754df24ca20a4c9961e62c46f50a399c9265ddbf2b1f2cb9b2fd2ffb43e13bdcf6595634d71c
7
+ data.tar.gz: 7d9b4560a2069d752f5e82bc66c0d0eb4e1e9df5d95261371e859c8907741ac80a43a7ba09ce5ed6f59da316723b9f1ab9dbb8de3931f98113fc5de1c619ee74
data/Gemfile CHANGED
@@ -121,8 +121,6 @@ gem "hotwire-rails"
121
121
 
122
122
  gem "active_link_to"
123
123
 
124
- gem "view_component"
125
-
126
124
  gem "addressable"
127
125
 
128
126
  gem "appraisal"
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- avo (2.11.1.pre.1)
4
+ avo (2.11.1.pre.2)
5
5
  active_link_to
6
6
  addressable
7
7
  breadcrumbs_on_rails
@@ -16,7 +16,7 @@ PATH
16
16
  pagy
17
17
  pundit
18
18
  rails (>= 6.0)
19
- view_component
19
+ view_component (= 2.60)
20
20
  zeitwerk
21
21
 
22
22
  GEM
@@ -201,7 +201,7 @@ GEM
201
201
  httparty (0.20.0)
202
202
  mime-types (~> 3.0)
203
203
  multi_xml (>= 0.5.2)
204
- i18n (1.11.0)
204
+ i18n (1.12.0)
205
205
  concurrent-ruby (~> 1.0)
206
206
  i18n_data (0.15.0)
207
207
  simple_po_parser (~> 1.1)
@@ -390,10 +390,10 @@ GEM
390
390
  turbo-rails (1.0.1)
391
391
  actionpack (>= 6.0.0)
392
392
  railties (>= 6.0.0)
393
- tzinfo (2.0.4)
393
+ tzinfo (2.0.5)
394
394
  concurrent-ruby (~> 1.0)
395
395
  unicode-display_width (2.1.0)
396
- view_component (2.57.1)
396
+ view_component (2.60.0)
397
397
  activesupport (>= 5.0.0, < 8.0)
398
398
  method_source (~> 1.0)
399
399
  warden (1.2.9)
@@ -483,7 +483,6 @@ DEPENDENCIES
483
483
  standard
484
484
  test-prof
485
485
  tzinfo-data
486
- view_component
487
486
  web-console (>= 3.3.0)
488
487
  webdrivers
489
488
  webmock
@@ -28,6 +28,8 @@ class Avo::ItemSwitcherComponent < Avo::BaseComponent
28
28
  return false if in_reflection? && item.hidden_in_reflection?
29
29
  end
30
30
 
31
+ return false if item.is_main_panel?
32
+
31
33
  true
32
34
  end
33
35
 
@@ -34,10 +34,8 @@
34
34
  </div>
35
35
  <% end %>
36
36
  <% if footer_tools? %>
37
- <div class="<%= white_panel_classes %> p-4 flex-1 flex flex-col xl:flex-row justify-between mt-6">
38
- <div class="flex-1 w-full flex flex-col sm:flex-row xl:justify-end sm:items-end space-y-2 sm:space-y-0 sm:space-x-2 mt-4 xl:mt-0">
39
- <%= footer_tools %>
40
- </div>
37
+ <div class="flex-1 w-full flex flex-col sm:flex-row xl:justify-end sm:items-end space-y-2 sm:space-y-0 sm:space-x-2 mt-4 xl:mt-0">
38
+ <%= footer_tools %>
41
39
  </div>
42
40
  <% end %>
43
41
  <% if footer? %>
@@ -47,8 +47,4 @@ class Avo::PanelComponent < ViewComponent::Base
47
47
  def render_header?
48
48
  @name.present? || description.present? || tools.present? || display_breadcrumbs?
49
49
  end
50
-
51
- def render_footer_tools?
52
- footer_tools.present?
53
- end
54
50
  end
@@ -58,33 +58,14 @@ class Avo::ResourceComponent < Avo::BaseComponent
58
58
  association_policy
59
59
  end
60
60
 
61
- def split_panel_fields
62
- initialize_panels
63
- @resource.get_fields.each do |field|
64
- case field.class.to_s
65
- when "Avo::Fields::HasOneField"
66
- @has_one_panels << field
67
- when "Avo::Fields::HasManyField"
68
- @has_many_panels << field
69
- when "Avo::Fields::HasAndBelongsToManyField"
70
- @has_as_belongs_to_many_panels << field
71
- else
72
- @fields_by_panel[field.panel_name] ||= []
73
- @fields_by_panel[field.panel_name] << field
74
- end
61
+ def main_panel
62
+ @resource.get_items.find do |item|
63
+ item.is_main_panel?
75
64
  end
76
65
  end
77
66
 
78
67
  private
79
68
 
80
- def initialize_panels
81
- @fields_by_panel = {}
82
- @has_one_panels = []
83
- @has_many_panels = []
84
- @has_as_belongs_to_many_panels = []
85
- @resource_tools = @resource.tools
86
- end
87
-
88
69
  def via_resource?
89
70
  params[:via_resource_class].present? && params[:via_resource_id].present?
90
71
  end
@@ -14,7 +14,10 @@ class Avo::Sidebar::LinkComponent < ViewComponent::Base
14
14
  end
15
15
 
16
16
  def is_external?
17
- URI(path).scheme.present?
17
+ # If the path contains the scheme, check if it includes the root path or not
18
+ return !path.include?(Avo::App.root_path) if URI(path).scheme.present?
19
+
20
+ false
18
21
  end
19
22
 
20
23
  # For external links active_link_to marks them all as active.
@@ -5,8 +5,7 @@
5
5
  controller: "tabs",
6
6
  tabs_view_value: view,
7
7
  tabs_active_tab_value: active_tab_name
8
- },
9
- class: 'space-y-12' do %>
8
+ } do %>
10
9
  <% visible_tabs.each_with_index do |tab, index| %>
11
10
  <%
12
11
  args = {
@@ -33,20 +33,42 @@
33
33
  <% end %>
34
34
  <% end %>
35
35
  <% end %>
36
+ <%# Extract the main panel and display the fields here. %>
37
+ <%# This way we'll be able to render the footer buttons under the main fields. %>
38
+ <% if main_panel.present? %>
39
+ <% c.body do %>
40
+ <div class="divide-y">
41
+ <% main_panel.items.each_with_index do |field, index| %>
42
+ <%= render field.hydrate(resource: @resource, model: @resource.model, user: @resource.user, view: view)
43
+ .component_for_view(view)
44
+ .new(field: field, resource: @resource, index: index, form: form)
45
+ %>
46
+ <% end %>
47
+ </div>
48
+ <% end %>
49
+ <% end %>
36
50
  <% if Avo.configuration.buttons_on_form_footers %>
37
51
  <% c.footer_tools do %>
38
- <%= a_link back_path, icon: 'arrow-left' do %>
39
- <%= t('avo.cancel').capitalize %>
40
- <% end %>
41
- <% if can_see_the_save_button? %>
42
- <%= a_button color: :green, loading: true, type: :submit, icon: 'save' do %>
43
- <%= t('avo.save').capitalize %>
52
+ <div class="mt-4">
53
+ <%= a_link back_path,
54
+ style: :text,
55
+ icon: 'arrow-left' do %>
56
+ <%= t('avo.cancel').capitalize %>
44
57
  <% end %>
45
- <% end %>
58
+ <% if can_see_the_save_button? %>
59
+ <%= a_button color: :primary,
60
+ style: :primary,
61
+ loading: true,
62
+ type: :submit,
63
+ icon: 'save' do %>
64
+ <%= t('avo.save').capitalize %>
65
+ <% end %>
66
+ <% end %>
67
+ </div>
46
68
  <% end %>
47
69
  <% end %>
48
70
  <% end %>
49
- <%= content_tag :div, class: 'space-y-12' do %>
71
+ <%= content_tag :div, class: 'space-y-12 mt-12' do %>
50
72
  <% @resource.get_items.each_with_index do |item, index| %>
51
73
  <% next if item.nil? %>
52
74
  <%= render Avo::ItemSwitcherComponent.new resource: @resource, item: item, index: index + 1, view: @view, form: form %>
@@ -11,8 +11,6 @@ class Avo::Views::ResourceEditComponent < Avo::ResourceComponent
11
11
  @model = model
12
12
  @actions = actions
13
13
  @view = view
14
-
15
- split_panel_fields
16
14
  end
17
15
 
18
16
  def title
@@ -64,8 +64,20 @@
64
64
  <% end %>
65
65
  <% end %>
66
66
  <% end %>
67
+ <% if main_panel.present? %>
68
+ <% c.body do %>
69
+ <div class="divide-y">
70
+ <% main_panel.items.each_with_index do |field, index| %>
71
+ <%= render field.hydrate(resource: @resource, model: @resource.model, user: @resource.user, view: view)
72
+ .component_for_view(view)
73
+ .new(field: field, resource: @resource, index: index)
74
+ %>
75
+ <% end %>
76
+ </div>
77
+ <% end %>
78
+ <% end %>
67
79
  <% end %>
68
- <%= content_tag :div, class: 'space-y-12' do %>
80
+ <%= content_tag :div, class: 'space-y-12 mt-12' do %>
69
81
  <% @resource.get_items.each_with_index do |item, index| %>
70
82
  <% next if item.nil? %>
71
83
  <%= render Avo::ItemSwitcherComponent.new resource: @resource, reflection: @reflection, item: item, index: index + 1, view: @view %>
@@ -10,8 +10,6 @@ class Avo::Views::ResourceShowComponent < Avo::ResourceComponent
10
10
  @resource_panel = resource_panel
11
11
  @actions = actions
12
12
  @view = :show
13
-
14
- split_panel_fields
15
13
  end
16
14
 
17
15
  def title
@@ -320,7 +320,9 @@ module Avo
320
320
  .map do |action|
321
321
  action.new(model: @model, resource: @resource, view: @view)
322
322
  end
323
- .select { |action| action.visible_in_view }
323
+ .select do |action|
324
+ action.visible_in_view
325
+ end
324
326
  end
325
327
 
326
328
  def set_applied_filters
@@ -380,7 +382,6 @@ module Avo
380
382
 
381
383
  add_breadcrumb via_resource.plural_name, resources_path(resource: @resource)
382
384
  add_breadcrumb via_resource.model_title, resource_path(model: via_model, resource: via_resource)
383
- puts ["via_resource.model_title->", via_resource.model_title].inspect
384
385
 
385
386
  last_crumb_args = {
386
387
  via_resource_class: params[:via_resource_class],
@@ -1,2 +1 @@
1
1
  <%= render Avo::Views::ResourceEditComponent.new(resource: @resource, view: @view, actions: @actions) %>
2
-
data/avo.gemspec CHANGED
@@ -40,7 +40,7 @@ Gem::Specification.new do |spec|
40
40
  spec.add_dependency "httparty"
41
41
  spec.add_dependency "active_link_to"
42
42
  spec.add_dependency "image_processing"
43
- spec.add_dependency "view_component"
43
+ spec.add_dependency "view_component", "2.60"
44
44
  spec.add_dependency "hotwire-rails"
45
45
  spec.add_dependency "addressable"
46
46
  spec.add_dependency "meta-tags"
data/lib/avo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Avo
2
- VERSION = "2.11.1.pre.1" unless const_defined?(:VERSION)
2
+ VERSION = "2.11.1.pre.2" unless const_defined?(:VERSION)
3
3
  end
@@ -6461,10 +6461,6 @@ trix-editor .attachment__metadata .attachment__size {
6461
6461
  margin-bottom:0.5rem
6462
6462
  }
6463
6463
 
6464
- .mt-6{
6465
- margin-top:1.5rem
6466
- }
6467
-
6468
6464
  .ml-1\/2{
6469
6465
  margin-left:50%
6470
6466
  }
@@ -6481,6 +6477,10 @@ trix-editor .attachment__metadata .attachment__size {
6481
6477
  margin-left:auto
6482
6478
  }
6483
6479
 
6480
+ .mt-12{
6481
+ margin-top:3rem
6482
+ }
6483
+
6484
6484
  .-mb-2{
6485
6485
  margin-bottom:-0.5rem
6486
6486
  }
@@ -6489,6 +6489,10 @@ trix-editor .attachment__metadata .attachment__size {
6489
6489
  margin-top:0px
6490
6490
  }
6491
6491
 
6492
+ .mt-6{
6493
+ margin-top:1.5rem
6494
+ }
6495
+
6492
6496
  .mr-px{
6493
6497
  margin-right:1px
6494
6498
  }
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.11.1.pre.1
4
+ version: 2.11.1.pre.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: 2022-07-20 00:00:00.000000000 Z
12
+ date: 2022-07-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -127,16 +127,16 @@ dependencies:
127
127
  name: view_component
128
128
  requirement: !ruby/object:Gem::Requirement
129
129
  requirements:
130
- - - ">="
130
+ - - '='
131
131
  - !ruby/object:Gem::Version
132
- version: '0'
132
+ version: '2.60'
133
133
  type: :runtime
134
134
  prerelease: false
135
135
  version_requirements: !ruby/object:Gem::Requirement
136
136
  requirements:
137
- - - ">="
137
+ - - '='
138
138
  - !ruby/object:Gem::Version
139
- version: '0'
139
+ version: '2.60'
140
140
  - !ruby/object:Gem::Dependency
141
141
  name: hotwire-rails
142
142
  requirement: !ruby/object:Gem::Requirement