avo 2.30.0 → 2.30.1.pre1.pr1683

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 (25) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +3 -3
  3. data/app/components/avo/fields/common/files/controls_component.html.erb +29 -0
  4. data/app/components/avo/fields/common/files/controls_component.rb +19 -0
  5. data/app/components/avo/fields/common/files/list_viewer_component.html.erb +14 -0
  6. data/app/components/avo/fields/common/files/list_viewer_component.rb +26 -0
  7. data/app/components/avo/fields/common/files/view_type/grid_component.html.erb +27 -0
  8. data/app/components/avo/fields/common/{single_file_viewer_component.rb → files/view_type/grid_component.rb} +2 -9
  9. data/app/components/avo/fields/common/files/view_type/list_component.html.erb +22 -0
  10. data/app/components/avo/fields/common/files/view_type/list_component.rb +15 -0
  11. data/app/components/avo/fields/file_field/edit_component.html.erb +1 -1
  12. data/app/components/avo/fields/file_field/show_component.html.erb +1 -1
  13. data/app/components/avo/fields/files_field/edit_component.html.erb +2 -2
  14. data/app/components/avo/fields/files_field/show_component.html.erb +2 -2
  15. data/app/views/avo/partials/_view_toggle_button.html.erb +4 -0
  16. data/config/master.key +1 -0
  17. data/lib/avo/fields/base_field.rb +4 -2
  18. data/lib/avo/fields/files_field.rb +11 -0
  19. data/lib/avo/fields/id_field.rb +2 -1
  20. data/lib/avo/version.rb +1 -1
  21. data/public/avo-assets/avo.base.css +29 -22
  22. metadata +13 -8
  23. data/app/components/avo/fields/common/files_list_viewer_component.html.erb +0 -5
  24. data/app/components/avo/fields/common/files_list_viewer_component.rb +0 -8
  25. data/app/components/avo/fields/common/single_file_viewer_component.html.erb +0 -57
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 47a6931f5fd184bfb437e0541849e04f4452764059b23582ca000a977f805bc8
4
- data.tar.gz: ba1137efa1e302b64bb86635b7c6327cd145d0fa68b787f8540bd5089a9e8bd9
3
+ metadata.gz: c3c650833493f18162beff6fcb0244af4a5a2a6d91041a9be0b0103cb027f85b
4
+ data.tar.gz: af1f9219ac03dc7bfe05812010d025e26d5f26fec0b59feb56519045ae6385d3
5
5
  SHA512:
6
- metadata.gz: d0a68869c9647f57f3d3ffe1699e7e6fd1a2c0cc4fcbceadb127b1312893cf53eb8d2a89df9c160a058a824846bd128ed9e681eecbe06dd90c61bd91641a5132
7
- data.tar.gz: e92694271216d763281657edc6b128f05dd8ff104b7228eabeca8570bb86dad6c91a2712410655a744f600db466fea2a25f349182881ab32fecceef3d1763669
6
+ metadata.gz: 2a5b5b6e180b2d66d218b5e3d3f9f32622cacbb44104ac4a2d0e5ab6e0725d8e469ea0c5c830d04c0a489f9265bd6f2483ad92a2ec3c343d86a379bce63a8914
7
+ data.tar.gz: fd0a75e4c866d6a8562045ac0626378528a0751260788a9c9c3cf80183a4a698a0ac188396bba5c19e370b40a9831b1ce9d1d56e17bebc4638b0e8dbe7bffaec
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- avo (2.30.0)
4
+ avo (2.30.1.pre1.pr1683)
5
5
  actionview (>= 6.0)
6
6
  active_link_to
7
7
  activerecord (>= 6.0)
@@ -269,10 +269,10 @@ GEM
269
269
  net-smtp (0.3.3)
270
270
  net-protocol
271
271
  nio4r (2.5.8)
272
- nokogiri (1.14.2)
272
+ nokogiri (1.14.3)
273
273
  mini_portile2 (~> 2.8.0)
274
274
  racc (~> 1.4)
275
- nokogiri (1.14.2-x86_64-linux)
275
+ nokogiri (1.14.3-x86_64-linux)
276
276
  racc (~> 1.4)
277
277
  orm_adapter (0.5.0)
278
278
  pagy (6.0.3)
@@ -0,0 +1,29 @@
1
+ <div class="flex">
2
+ <% if can_download_file? %>
3
+ <%= a_link Rails.application.routes.url_helpers.rails_blob_path(file, only_path: true, disposition: :attachment),
4
+ icon: 'heroicons/outline/download',
5
+ color: :primary,
6
+ download: true,
7
+ class: 'text-center',
8
+ title: t('avo.download_file'),
9
+ data: { tippy: :tooltip },
10
+ compact: true,
11
+ size: :xs %>
12
+ <% end %>
13
+ </div>
14
+ <div>
15
+ <% if can_delete_file? %>
16
+ <%= a_link destroy_path,
17
+ icon: 'heroicons/outline/trash',
18
+ color: :red,
19
+ compact: true,
20
+ size: :xs,
21
+ class: 'text-center',
22
+ title: t('avo.delete_file', item: file.filename),
23
+ data: {
24
+ turbo_method: :delete,
25
+ turbo_confirm: t('avo.are_you_sure'),
26
+ tippy: :tooltip
27
+ } %>
28
+ <% end %>
29
+ </div>
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Avo::Fields::Common::Files::ControlsComponent < ViewComponent::Base
4
+ include Avo::ApplicationHelper
5
+ include Avo::Fields::Concerns::FileAuthorization
6
+
7
+ attr_reader :file, :field, :resource
8
+ delegate :id, to: :field
9
+
10
+ def initialize(field:, file:, resource:)
11
+ @field = field
12
+ @file = file
13
+ @resource = resource
14
+ end
15
+
16
+ def destroy_path
17
+ Avo::Services::URIService.parse(@resource.record_path).append_paths("active_storage_attachments", id, file.id).to_s
18
+ end
19
+ end
@@ -0,0 +1,14 @@
1
+ <div class="-mt-9">
2
+ <%= turbo_frame_tag @field.id do %>
3
+ <% unless @field.hide_view_type_changer %>
4
+ <div class="justify-self-end flex justify-end items-center space-x-3">
5
+ <%= render partial: 'avo/partials/view_toggle_button', locals: { available_view_types: available_view_types, view_type: @field.view_type, turbo_frame: @field.id } %>
6
+ </div>
7
+ <% end %>
8
+ <div class="<%= classes %>">
9
+ <% @field.value.attachments.each do |file| %>
10
+ <%= render @field.viewer_component.new field: @field, resource: @resource, file: file %>
11
+ <% end %>
12
+ </div>
13
+ <% end %>
14
+ </div>
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Avo::Fields::Common::Files::ListViewerComponent < ViewComponent::Base
4
+ include Turbo::FramesHelper
5
+
6
+ def initialize(field:, resource:)
7
+ @field = field
8
+ @resource = resource
9
+ end
10
+
11
+ def classes
12
+ base_classes = "py-4 rounded-xl"
13
+
14
+ view_type_classes = if @field.view_type == :list
15
+ "flex flex-col space-y-2"
16
+ else
17
+ "relative grid xs:grid-cols-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-6 gap-6"
18
+ end
19
+
20
+ "#{base_classes} #{view_type_classes}"
21
+ end
22
+
23
+ def available_view_types
24
+ [:list, :grid]
25
+ end
26
+ end
@@ -0,0 +1,27 @@
1
+ <div class="relative min-h-full max-w-full flex-1 flex flex-col justify-between space-y-2">
2
+ <% if file.present? %>
3
+ <div class="flex flex-col justify-between h-full">
4
+ <% if file.representable? && is_image? %>
5
+ <%= image_tag helpers.main_app.url_for(file), class: 'rounded-lg object-cover w-full aspect-video' %>
6
+ <% elsif is_audio? %>
7
+ <%= audio_tag(helpers.main_app.url_for(file), controls: true, preload: false, class: 'w-full') %>
8
+ <% elsif is_video? %>
9
+ <%= video_tag(helpers.main_app.url_for(file), controls: true, preload: false, class: 'w-full') %>
10
+ <% else %>
11
+ <div class="relative flex flex-col justify-evenly items-center px-2 rounded-lg border bg-white border-gray-500 min-h-24">
12
+ <div class="flex flex-col justify-center items-center w-full">
13
+ <%= helpers.svg 'document-text', class: 'h-10 text-gray-600 mb-2' %>
14
+ </div>
15
+ </div>
16
+ <% end %>
17
+ <% if field.display_filename %>
18
+ <span class="text-gray-500 mt-1 text-sm truncate" title="<%= file.filename %>"><%= file.filename %></span>
19
+ <% end %>
20
+ </div>
21
+ <div class="flex space-x-2">
22
+ <%= render Avo::Fields::Common::Files::ControlsComponent.new(field: field, file: file, resource: resource) %>
23
+ </div>
24
+ <% else %>
25
+
26
+ <% end %>
27
+ </div>
@@ -1,10 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class Avo::Fields::Common::SingleFileViewerComponent < ViewComponent::Base
4
- include Avo::ApplicationHelper
5
- include Avo::Fields::Concerns::FileAuthorization
6
-
7
- attr_reader :field
3
+ class Avo::Fields::Common::Files::ViewType::GridComponent < ViewComponent::Base
4
+ attr_reader :field, :resource
8
5
 
9
6
  def initialize(field:, resource:, file: nil)
10
7
  @file = file
@@ -12,10 +9,6 @@ class Avo::Fields::Common::SingleFileViewerComponent < ViewComponent::Base
12
9
  @resource = resource
13
10
  end
14
11
 
15
- def destroy_path
16
- Avo::Services::URIService.parse(@resource.record_path).append_paths("active_storage_attachments", id, file.id).to_s
17
- end
18
-
19
12
  def id
20
13
  field.id
21
14
  end
@@ -0,0 +1,22 @@
1
+ <div class="relative min-h-full max-w-full flex-1 flex">
2
+ <% if file.present? %>
3
+ <div class="flex gap-2 items-center max-w-full w-full">
4
+ <div class="flex-1 flex flex-row col-span-7 items-center text-gray-700 truncate">
5
+ <div class="rounded-full bg-slate-100 border border-gray-500 p-1.5 flex items-center justify-center">
6
+ <%= helpers.svg icon_for_file, class: "h-5 text-gray-600" %>
7
+ </div>
8
+ <p class="overflow-x-scroll items-center h-full p-2 whitespace-nowrap">
9
+ <%= file.filename %>
10
+ </p>
11
+ </div>
12
+ <div class="col-span-4 text-gray-700 flex-shrink-0 text-sm">
13
+ <%= helpers.number_to_human_size(file.byte_size) %>
14
+ </div>
15
+ <div class="flex space-x-2 justify-end col-span-1 flex-shrink-0">
16
+ <%= render Avo::Fields::Common::Files::ControlsComponent.new(field: field, file: file, resource: resource) %>
17
+ </div>
18
+ </div>
19
+ <% else %>
20
+
21
+ <% end %>
22
+ </div>
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Avo::Fields::Common::Files::ViewType::ListComponent < Avo::Fields::Common::Files::ViewType::GridComponent
4
+ def icon_for_file
5
+ if is_image?
6
+ "photo"
7
+ elsif is_audio?
8
+ "speaker-wave"
9
+ elsif is_video?
10
+ "video-camera"
11
+ else
12
+ "document"
13
+ end
14
+ end
15
+ end
@@ -1,7 +1,7 @@
1
1
  <%= field_wrapper **field_wrapper_args do %>
2
2
  <% if @field.value.present? %>
3
3
  <div class="mb-2">
4
- <%= render Avo::Fields::Common::SingleFileViewerComponent.new resource: @resource, field: @field %>
4
+ <%= render Avo::Fields::Common::Files::ViewType::GridComponent.new resource: @resource, field: @field %>
5
5
  </div>
6
6
  <% end %>
7
7
 
@@ -1,3 +1,3 @@
1
1
  <%= field_wrapper **field_wrapper_args do %>
2
- <%= render Avo::Fields::Common::SingleFileViewerComponent.new resource: @resource, field: @field %>
2
+ <%= render Avo::Fields::Common::Files::ViewType::GridComponent.new resource: @resource, field: @field %>
3
3
  <% end %>
@@ -1,5 +1,5 @@
1
- <%= field_wrapper **field_wrapper_args, full_width: true do %>
2
- <%= render Avo::Fields::Common::FilesListViewerComponent.new(field: @field, resource: @resource) if @field.value.present? %>
1
+ <%= field_wrapper **field_wrapper_args, stacked: true do %>
2
+ <%= render Avo::Fields::Common::Files::ListViewerComponent.new(field: @field, resource: @resource) if @field.value.present? %>
3
3
 
4
4
  <% if can_upload_file? %>
5
5
  <div class="mt-2">
@@ -1,3 +1,3 @@
1
- <%= field_wrapper **field_wrapper_args, full_width: true do %>
2
- <%= render Avo::Fields::Common::FilesListViewerComponent.new(field: @field, resource: @resource) if @field.value.present? %>
1
+ <%= field_wrapper **field_wrapper_args, stacked: true do %>
2
+ <%= render Avo::Fields::Common::Files::ListViewerComponent.new(field: @field, resource: @resource) if @field.value.present? %>
3
3
  <% end %>
@@ -11,6 +11,10 @@
11
11
  new_icon: 'grid-view-type',
12
12
  translation_key: 'avo.grid_view',
13
13
  },
14
+ list: {
15
+ new_view_type: 'list',
16
+ new_icon: 'queue-list',
17
+ },
14
18
  }
15
19
  %>
16
20
  <div class="flex">
data/config/master.key ADDED
@@ -0,0 +1 @@
1
+ 2aeb23d82b909d9c6b5abb62f7058c2a
@@ -73,7 +73,7 @@ module Avo
73
73
  @placeholder = args[:placeholder]
74
74
  @help = args[:help] || nil
75
75
  @default = args[:default] || nil
76
- @visible = args[:visible] || true
76
+ @visible = args[:visible]
77
77
  @as_label = args[:as_label] || false
78
78
  @as_avatar = args[:as_avatar] || false
79
79
  @as_description = args[:as_description] || false
@@ -156,7 +156,9 @@ module Avo
156
156
  end
157
157
 
158
158
  def visible?
159
- if visible.present? && visible.respond_to?(:call)
159
+ return true if visible.nil?
160
+
161
+ if visible.respond_to?(:call)
160
162
  visible.call resource: @resource
161
163
  else
162
164
  visible
@@ -6,6 +6,7 @@ module Avo
6
6
  attr_accessor :direct_upload
7
7
  attr_accessor :accept
8
8
  attr_reader :display_filename
9
+ attr_reader :hide_view_type_changer
9
10
 
10
11
  def initialize(id, **args, &block)
11
12
  super(id, **args, &block)
@@ -15,6 +16,8 @@ module Avo
15
16
  @direct_upload = args[:direct_upload].present? ? args[:direct_upload] : false
16
17
  @accept = args[:accept].present? ? args[:accept] : nil
17
18
  @display_filename = args[:display_filename].nil? ? true : args[:display_filename]
19
+ @view_type = args[:view_type] || :grid
20
+ @hide_view_type_changer = args[:hide_view_type_changer]
18
21
  end
19
22
 
20
23
  def view_component_name
@@ -37,6 +40,14 @@ module Avo
37
40
 
38
41
  model
39
42
  end
43
+
44
+ def viewer_component
45
+ "Avo::Fields::Common::Files::ViewType::#{view_type.to_s.capitalize}Component".constantize
46
+ end
47
+
48
+ def view_type
49
+ (@resource.params.dig(:view_type) || @view_type).to_sym
50
+ end
40
51
  end
41
52
  end
42
53
  end
@@ -5,12 +5,13 @@ module Avo
5
5
 
6
6
  def initialize(id, **args, &block)
7
7
  args[:readonly] = true
8
- args[:sortable] = true
9
8
 
10
9
  hide_on [:edit, :new]
11
10
 
12
11
  super(id, **args, &block)
13
12
 
13
+ add_boolean_prop args, :sortable, true
14
+
14
15
  @link_to_resource = args[:link_to_resource].present? ? args[:link_to_resource] : false
15
16
  end
16
17
  end
data/lib/avo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Avo
2
- VERSION = "2.30.0" unless const_defined?(:VERSION)
2
+ VERSION = "2.30.1.pre1.pr1683" unless const_defined?(:VERSION)
3
3
  end
@@ -6386,6 +6386,14 @@ trix-toolbar .trix-button-group:not(:first-child){
6386
6386
  grid-column:1 / -1
6387
6387
  }
6388
6388
 
6389
+ .col-span-7{
6390
+ grid-column:span 7 / span 7
6391
+ }
6392
+
6393
+ .col-span-4{
6394
+ grid-column:span 4 / span 4
6395
+ }
6396
+
6389
6397
  .float-right{
6390
6398
  float:right
6391
6399
  }
@@ -6595,6 +6603,10 @@ trix-toolbar .trix-button-group:not(:first-child){
6595
6603
  margin-bottom:0.25rem
6596
6604
  }
6597
6605
 
6606
+ .-mt-9{
6607
+ margin-top:-2.25rem
6608
+ }
6609
+
6598
6610
  .block{
6599
6611
  display:block
6600
6612
  }
@@ -6631,6 +6643,10 @@ trix-toolbar .trix-button-group:not(:first-child){
6631
6643
  aspect-ratio:1 / 1
6632
6644
  }
6633
6645
 
6646
+ .aspect-video{
6647
+ aspect-ratio:16 / 9
6648
+ }
6649
+
6634
6650
  .h-36{
6635
6651
  height:9rem
6636
6652
  }
@@ -6711,10 +6727,6 @@ trix-toolbar .trix-button-group:not(:first-child){
6711
6727
  height:2.25rem
6712
6728
  }
6713
6729
 
6714
- .max-h-\[42rem\]{
6715
- max-height:42rem
6716
- }
6717
-
6718
6730
  .max-h-full{
6719
6731
  max-height:100%
6720
6732
  }
@@ -6998,10 +7010,6 @@ trix-toolbar .trix-button-group:not(:first-child){
6998
7010
  gap:1.5rem
6999
7011
  }
7000
7012
 
7001
- .gap-3{
7002
- gap:0.75rem
7003
- }
7004
-
7005
7013
  .gap-1{
7006
7014
  gap:0.25rem
7007
7015
  }
@@ -7066,12 +7074,6 @@ trix-toolbar .trix-button-group:not(:first-child){
7066
7074
  margin-left:calc(0.75rem * calc(1 - var(--tw-space-x-reverse)))
7067
7075
  }
7068
7076
 
7069
- .space-y-3 > :not([hidden]) ~ :not([hidden]){
7070
- --tw-space-y-reverse:0;
7071
- margin-top:calc(0.75rem * calc(1 - var(--tw-space-y-reverse)));
7072
- margin-bottom:calc(0.75rem * var(--tw-space-y-reverse))
7073
- }
7074
-
7075
7077
  .divide-y > :not([hidden]) ~ :not([hidden]){
7076
7078
  --tw-divide-y-reverse:0;
7077
7079
  border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));
@@ -7111,6 +7113,10 @@ trix-toolbar .trix-button-group:not(:first-child){
7111
7113
  overflow-x:auto
7112
7114
  }
7113
7115
 
7116
+ .overflow-x-scroll{
7117
+ overflow-x:scroll
7118
+ }
7119
+
7114
7120
  .truncate{
7115
7121
  overflow:hidden;
7116
7122
  text-overflow:ellipsis;
@@ -7561,6 +7567,11 @@ trix-toolbar .trix-button-group:not(:first-child){
7561
7567
  background-color:rgb(94 100 110 / var(--tw-bg-opacity))
7562
7568
  }
7563
7569
 
7570
+ .bg-slate-100{
7571
+ --tw-bg-opacity:1;
7572
+ background-color:rgb(241 245 249 / var(--tw-bg-opacity))
7573
+ }
7574
+
7564
7575
  .bg-opacity-25{
7565
7576
  --tw-bg-opacity:0.25
7566
7577
  }
@@ -7601,6 +7612,10 @@ trix-toolbar .trix-button-group:not(:first-child){
7601
7612
  padding:0.25rem
7602
7613
  }
7603
7614
 
7615
+ .p-1\.5{
7616
+ padding:0.375rem
7617
+ }
7618
+
7604
7619
  .px-1{
7605
7620
  padding-left:0.25rem;
7606
7621
  padding-right:0.25rem
@@ -9702,10 +9717,6 @@ trix-editor {
9702
9717
  grid-template-columns:repeat(4, minmax(0, 1fr))
9703
9718
  }
9704
9719
 
9705
- .xl\:grid-cols-3{
9706
- grid-template-columns:repeat(3, minmax(0, 1fr))
9707
- }
9708
-
9709
9720
  .xl\:flex-row{
9710
9721
  flex-direction:row
9711
9722
  }
@@ -9764,8 +9775,4 @@ trix-editor {
9764
9775
  .\32xl\:grid-cols-6{
9765
9776
  grid-template-columns:repeat(6, minmax(0, 1fr))
9766
9777
  }
9767
-
9768
- .\32xl\:grid-cols-4{
9769
- grid-template-columns:repeat(4, minmax(0, 1fr))
9770
- }
9771
9778
  }
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.30.0
4
+ version: 2.30.1.pre1.pr1683
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-04-11 00:00:00.000000000 Z
12
+ date: 2023-04-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
@@ -1371,8 +1371,14 @@ files:
1371
1371
  - app/components/avo/fields/common/boolean_check_component.rb
1372
1372
  - app/components/avo/fields/common/boolean_group_component.html.erb
1373
1373
  - app/components/avo/fields/common/boolean_group_component.rb
1374
- - app/components/avo/fields/common/files_list_viewer_component.html.erb
1375
- - app/components/avo/fields/common/files_list_viewer_component.rb
1374
+ - app/components/avo/fields/common/files/controls_component.html.erb
1375
+ - app/components/avo/fields/common/files/controls_component.rb
1376
+ - app/components/avo/fields/common/files/list_viewer_component.html.erb
1377
+ - app/components/avo/fields/common/files/list_viewer_component.rb
1378
+ - app/components/avo/fields/common/files/view_type/grid_component.html.erb
1379
+ - app/components/avo/fields/common/files/view_type/grid_component.rb
1380
+ - app/components/avo/fields/common/files/view_type/list_component.html.erb
1381
+ - app/components/avo/fields/common/files/view_type/list_component.rb
1376
1382
  - app/components/avo/fields/common/gravatar_viewer_component.html.erb
1377
1383
  - app/components/avo/fields/common/gravatar_viewer_component.rb
1378
1384
  - app/components/avo/fields/common/heading_component.html.erb
@@ -1381,8 +1387,6 @@ files:
1381
1387
  - app/components/avo/fields/common/key_value_component.rb
1382
1388
  - app/components/avo/fields/common/progress_bar_component.html.erb
1383
1389
  - app/components/avo/fields/common/progress_bar_component.rb
1384
- - app/components/avo/fields/common/single_file_viewer_component.html.erb
1385
- - app/components/avo/fields/common/single_file_viewer_component.rb
1386
1390
  - app/components/avo/fields/common/status_viewer_component.html.erb
1387
1391
  - app/components/avo/fields/common/status_viewer_component.rb
1388
1392
  - app/components/avo/fields/concerns/item_labels.rb
@@ -1700,6 +1704,7 @@ files:
1700
1704
  - config/credentials.yml.enc
1701
1705
  - config/i18n-tasks.yml
1702
1706
  - config/initializers/pagy.rb
1707
+ - config/master.key
1703
1708
  - config/routes.rb
1704
1709
  - config/spring.rb
1705
1710
  - db/factories.rb
@@ -1961,9 +1966,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
1961
1966
  version: 2.6.0
1962
1967
  required_rubygems_version: !ruby/object:Gem::Requirement
1963
1968
  requirements:
1964
- - - ">="
1969
+ - - ">"
1965
1970
  - !ruby/object:Gem::Version
1966
- version: '0'
1971
+ version: 1.3.1
1967
1972
  requirements: []
1968
1973
  rubygems_version: 3.3.3
1969
1974
  signing_key:
@@ -1,5 +0,0 @@
1
- <div class="relative py-3 grid xs:grid-cols-2 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 gap-3 rounded-xl">
2
- <% @field.value.attachments.each do |file| %>
3
- <%= render Avo::Fields::Common::SingleFileViewerComponent.new field: @field, resource: @resource, file: file %>
4
- <% end %>
5
- </div>
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class Avo::Fields::Common::FilesListViewerComponent < ViewComponent::Base
4
- def initialize(field:, resource:)
5
- @field = field
6
- @resource = resource
7
- end
8
- end
@@ -1,57 +0,0 @@
1
- <div class="relative min-h-full max-w-full flex-1 flex flex-col justify-between space-y-3">
2
- <% if file.present? %>
3
- <div class="flex flex-col justify-between h-full">
4
- <% if file.representable? && is_image? %>
5
- <div class="max-h-[42rem] h-full flex">
6
- <%= image_tag helpers.main_app.url_for(file), class: 'rounded-lg object-cover' %>
7
- </div>
8
- <% elsif is_audio? %>
9
- <%= audio_tag(helpers.main_app.url_for(file), controls: true, preload: false, class: 'w-full') %>
10
- <% elsif is_video? %>
11
- <%= video_tag(helpers.main_app.url_for(file), controls: true, preload: false, class: 'w-full') %>
12
- <% else %>
13
- <div class="relative flex flex-col justify-evenly items-center px-2 rounded-lg border bg-white border-gray-500 min-h-24">
14
- <div class="flex flex-col justify-center items-center w-full">
15
- <%= helpers.svg 'document-text', class: 'h-10 text-gray-600 mb-2' %>
16
- </div>
17
- </div>
18
- <% end %>
19
- <% if field.display_filename %>
20
- <span class="text-gray-500 mt-2 text-sm truncate" title="<%= file.filename %>"><%= file.filename %></span>
21
- <% end %>
22
- </div>
23
- <div class="flex space-x-2">
24
- <div class="flex">
25
- <% if can_download_file? %>
26
- <%= a_link Rails.application.routes.url_helpers.rails_blob_path(file, only_path: true, disposition: :attachment),
27
- icon: 'heroicons/outline/download',
28
- color: :primary,
29
- download: true,
30
- class: 'text-center',
31
- title: t('avo.download_file'),
32
- data: { tippy: :tooltip },
33
- compact: true,
34
- size: :xs %>
35
- <% end %>
36
- </div>
37
- <div>
38
- <% if can_delete_file? %>
39
- <%= a_link destroy_path,
40
- icon: 'heroicons/outline/trash',
41
- color: :red,
42
- compact: true,
43
- size: :xs,
44
- class: 'text-center',
45
- title: t('avo.delete_file', item: file.filename),
46
- data: {
47
- turbo_method: :delete,
48
- turbo_confirm: t('avo.are_you_sure'),
49
- tippy: :tooltip
50
- } %>
51
- <% end %>
52
- </div>
53
- </div>
54
- <% else %>
55
-
56
- <% end %>
57
- </div>