viniBaxter-field-active_storage 5.0.0 → 10.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 02ca7e5e0d9df80466d7fe23019426fd67cdf9aecf4f8efd2c342dd91dd526f1
4
- data.tar.gz: 93a22307a3e075c421df8a8318d696d58d87cf57c4922b186231cfc841d1d532
3
+ metadata.gz: 452afc0ba0c4b88b5b123ff9e50b9308b7085d1e2b6c257009dd4023f42b9af4
4
+ data.tar.gz: 3c66ceeafb4c94b38542374c9dfd5d9c1ddb25e2460ff61cd02dbf08e8c57a0d
5
5
  SHA512:
6
- metadata.gz: 435b45f51374a33a9f7ffbcc22730f9180230af34a7dc2c4c69a2618ac34848deae460932fb72e06d26c5fad79fee26210d2d6916c0e842701615f1c2e238acb
7
- data.tar.gz: fe40c830c6b1c3d1adb47c7ec376644964bf002156f83327bff67c7058750cfc69cda12d0e56d7522e7eb333fc5ae612f938d66ea3e5d21c971c89bb7b7baab7
6
+ metadata.gz: d902ff278242b54a6cb5f4fd6d5d5d668a7aba2cbf1c4da99b2e0c3e28019110759e371bdc70d58d54e53b7eeee8e5307e75e22fe52984d605874e3f29cf047e
7
+ data.tar.gz: a0afc76f02abd9c955245293321ddbe17e15734d304edf915173f4b27b72dcb1353576c4806b79a2530166ba83c5f22fc9a3f14b118bca94cb6335d760aa62f5
@@ -8,11 +8,12 @@
8
8
  data-dropzonegem-add-remove-links="hello">
9
9
  <%= f.file_field field.attribute, multiple: field.many?, direct_upload: field.direct?, data: { target: 'dropzonegem.inputdropzonegem' } %>
10
10
  <div class="dropzone-msg dz-message needsclick text-gray-600">
11
- <h3 class="dropzone-msg-title">Drag & Drop here to upload or click here to browse</h3>
11
+ <h3 class="dropzone-msg-title">Drag & Drop ici ou cliquer pour selectionner</h3>
12
12
  <span class="dropzone-msg-desc text-sm">
13
13
  <%= field.drop_max_file_size? %>
14
14
  MB par fichier. Les fichiers autorisés :
15
- <%= field.drop_accepted_files? %>. Un maximum de
15
+ <%= field.drop_accepted_files? %>. <br>
16
+ Un maximum de
16
17
  <%= field.drop_max_file? %> fichiers autorisés.
17
18
  </span>
18
19
  </div>
@@ -34,16 +34,17 @@
34
34
  <% end %>
35
35
  </div>
36
36
  <div class="col ml-n2">
37
- <!-- Title -->
38
37
  <h4 class="font-weight-normal mb-1">
39
- <a href="#!">
40
- <div class="dz-filename"><span data-dz-name=""><%= attachment.filename %></span></div>
41
- </a>
38
+ <div class="dz-filename"> <span>SEO: </span><span data-dz-name=""><%= alt_method(attachment) %></span></div>
42
39
  </h4>
43
40
  <div class="dz-error-message"><span data-dz-errormessage=""></span></div>
44
41
  <!-- Text -->
45
42
  <small class="text-muted">
46
- <div class="dz-size" data-dz-size=""><strong><%= attachment.byte_size.fdiv(1000).round(1) %></strong> KB</div>
43
+ <div class="dz-size" data-dz-size="">
44
+ <strong>
45
+ <%= attachment.filename %> |
46
+ <%= attachment.byte_size.fdiv(1000).round(1) %>
47
+ </strong> KB</div>
47
48
  </small>
48
49
  </div>
49
50
  <div class="col-auto">
@@ -53,16 +54,26 @@
53
54
  <i class="fe fe-more-vertical"></i>
54
55
  </a>
55
56
  <div class="dropdown-menu dropdown-menu-right">
56
- <a href="#!" class="dropdown-item">
57
+ <%# <a href="#!" class="dropdown-item">
57
58
  Action
58
- </a>
59
- <%= link_to 'Remove file', field.destroy_path(field, attachment), method: :delete, class: 'dropdown-item dz-remove delete_on_click' %>
60
- <a href="#!" class="dropdown-item">
59
+ </a> %>
60
+ <% if field.destroy_url.present? %>
61
+ <% destroy_url = field.destroy_url.call(namespace, field.data.record, attachment) %>
62
+ <div>
63
+ <%= link_to 'Remove', destroy_url,
64
+ method: :delete,
65
+ remote: true,
66
+ class: 'dropdown-item dz-remove delete_on_click' %>
67
+ </div>
68
+ <%# <hr> %>
69
+ <% end %>
70
+ <%#= link_to 'Remove file', field.destroy_path(field, attachment), method: :delete, remote: true, class: 'dropdown-item dz-remove delete_on_click' %>
71
+ <%# <a href="#!" class="dropdown-item">
61
72
  Another action
62
73
  </a>
63
74
  <a href="#!" class="dropdown-item">
64
75
  Something else here
65
- </a>
76
+ </a> %>
66
77
  </div>
67
78
  </div>
68
79
  </div>
@@ -28,7 +28,7 @@ By default, the attribute is rendered as an image tag.
28
28
  <%= render partial: 'fields/active_storage/item',
29
29
  locals: {
30
30
  field: field,
31
- attachment: attachments[0],
31
+ attachment: field.data,
32
32
  image_size: [50, 50]
33
33
  } %>
34
34
  <% end %>
@@ -20,38 +20,50 @@ controlled via a boolean local variable.
20
20
  A boolean used to control the display of a `Remove` link which
21
21
  is used to destroy a single attachment. Defaults to `false`
22
22
  %>
23
-
24
23
  <%
25
24
  # By default we don't allow attachment removal
26
25
  removable = local_assigns.fetch(:removable, false)
27
26
  image_size = local_assigns.fetch(:image_size, [1920, 1080])
28
27
  %>
29
-
30
28
  <% if attachment.image? and attachment.variable? and !field.url_only? %>
31
- <%= link_to(field.blob_url(attachment), title: attachment.filename) do %>
32
- <%= image_tag(field.variant(attachment, resize_to_limit: image_size)) %>
33
- <% end %>
34
- <% elsif attachment.image? and !field.url_only? %>
35
- <%= link_to(field.blob_url(attachment), title: attachment.filename) do %>
36
- <%= image_tag(field.url(attachment)) %>
37
- <% end %>
38
- <% elsif attachment.video? and attachment.previewable? and !field.url_only? %> <%# if ffmpeg is installed %>
39
- <%= video_tag(field.url(attachment), poster: field.preview(attachment, resize_to_limit: image_size), controls: true, autobuffer: true, style: "width: 100%; height: auto;") %>
40
- <% elsif attachment.video? and !field.url_only? %>
41
- <%= video_tag(field.url(attachment), controls: true, autobuffer: true, style: "width: 100%; height: auto;") %>
42
- <% elsif attachment.audio? and !field.url_only? %>
43
- <%= audio_tag(field.url(attachment), autoplay: false, controls: true) %>
44
- <% else %>
45
- <%= link_to(field.blob_url(attachment), title: attachment.filename) do %>
46
- <% if attachment.previewable? and !field.url_only? %>
47
- <%= image_tag(field.preview(attachment, resize_to_limit: [595, 842])) %>
48
- <% else %>
49
- <%= attachment.filename %>
50
- <% end %>
51
- <% end %>
52
- <% end %>
53
-
54
- <% if removable %>
55
- <%= link_to 'Remove', field.destroy_path(field, attachment), method: :delete, class: 'remove-attachment-link' %>
56
- <hr>
57
- <% end %>
29
+ <%#= link_to(field.blob_url(attachment), title: attachment.filename) do %>
30
+ <%#= image_tag(field.variant(attachment, resize_to_limit: image_size)) %>
31
+ <%#= link_to(field.blob_url(attachment), title: attachment.filename, class:'avatar avatar-sm mr-2') do %>
32
+ <%#= image_tag attachment, class:"avatar-img rounded-circle" %>
33
+ <!-- last option/ .comment -->
34
+ <%#= link_to(field.blob_url(attachment), title: attachment.filename, class:'avatar avatar-sm mr-2') do %>
35
+ <%#= image_tag(field.variant(attachment, resize_to_limit: image_size, quality: 100, :loader => {strip: true, type: "TrueColorMatte"}), class:"avatar-img rounded-circle") %>
36
+ <%# end %>
37
+ <!-- end of last option/ .comment -->
38
+ <div class="avatar avatar-lg">
39
+ <%= image_tag field.variant(attachment,resize: "400x400"), class:"avatar-img rounded" %>
40
+ </div>
41
+ <% elsif attachment.image? and !field.url_only? %>
42
+ <%= link_to(field.blob_url(attachment), title: attachment.filename) do %>
43
+ <%= image_tag(field.url(attachment)) %>
44
+ <% end %>
45
+ <% elsif attachment.video? and attachment.previewable? and !field.url_only? %> <%# if ffmpeg is installed %>
46
+ <%= video_tag(field.url(attachment), poster: field.preview(attachment, resize_to_limit: image_size), controls: true, autobuffer: true, style: "width: 100%; height: auto;") %>
47
+ <% elsif attachment.video? and !field.url_only? %>
48
+ <%= video_tag(field.url(attachment), controls: true, autobuffer: true, style: "width: 100%; height: auto;") %>
49
+ <% elsif attachment.audio? and !field.url_only? %>
50
+ <%= audio_tag(field.url(attachment), autoplay: false, controls: true) %>
51
+ <% else %>
52
+ <%= link_to(field.blob_url(attachment), title: attachment.filename) do %>
53
+ <% if attachment.previewable? and !field.url_only? %>
54
+ <%= image_tag(field.preview(attachment, resize_to_limit: [595, 842])) %>
55
+ <% else %>
56
+ <%= attachment.filename %>
57
+ <% end %>
58
+ <% end %>
59
+ <% end %>
60
+ <% if removable %>
61
+ <%#= link_to 'Remove', field.destroy_path(field, attachment), method: :delete, class: 'remove-attachment-link' %>
62
+ <%= link_to 'Remove', destroy_url,
63
+ method: :delete,
64
+ # data: { confirm: t("administrate.actions.confirm") },
65
+ remote: true,
66
+ class: 'remove-attachment-link'
67
+ %>
68
+ <hr>
69
+ <% end %>
@@ -20,7 +20,12 @@ This partial renders one or more attachments
20
20
  <% if !field.drop_js? %>
21
21
  <% attachments.each do |attachment| %>
22
22
  <div class="attachments-listing">
23
- <%= render partial: 'fields/active_storage/item', locals: { field: field, attachment: attachment, removable: removable, image_size: field.show_preview_size } %>
23
+ <%= render partial: 'fields/active_storage/item', locals: {
24
+ field: field,
25
+ attachment: attachment,
26
+ removable: removable,
27
+ image_size: field.show_preview_size
28
+ } %>
24
29
  </div>
25
30
  <% end %>
26
31
  <%else %>
@@ -39,8 +44,13 @@ This partial renders one or more attachments
39
44
  <div class="already-downloaded dropzone">
40
45
  <div class="row">
41
46
  <% attachments.each do |attachment| %>
42
- <div class="col-6">
43
- <%= render partial: 'fields/active_storage/dropjs_list_edit', locals: { field: field, attachment: attachment, removable: removable, image_size: field.show_preview_size }%>
47
+ <div class="col-12" id="<%= @page.class %>_picture_<%= attachment.id %>">
48
+ <%= render partial: 'fields/active_storage/dropjs_list_edit', locals: {
49
+ field: field,
50
+ attachment: attachment,
51
+ removable: removable,
52
+ image_size: field.show_preview_size
53
+ }%>
44
54
  </div>
45
55
  <% end %>
46
56
  </div>
@@ -20,7 +20,7 @@ module Administrate
20
20
  end
21
21
 
22
22
  def index_display_count?
23
- options.fetch(:index_display_count) { attachments.present? && attachments.count != 1 }
23
+ options.fetch(:index_display_count) { attached? && attachments.count != 1 }
24
24
  end
25
25
 
26
26
  def show_preview_size
@@ -57,6 +57,10 @@ module Administrate
57
57
  options.fetch(:drop_accepted_files, ".jpeg,.jpg,.png,.gif,.svg")
58
58
  end
59
59
 
60
+ def destroy_url
61
+ options.fetch(:destroy_url, nil)
62
+ end
63
+
60
64
  # def destroy_path?
61
65
  # options.fetch(:destroy_path, false).present?
62
66
  # end
@@ -87,6 +91,7 @@ module Administrate
87
91
  many? || attachments.blank?
88
92
  end
89
93
 
94
+ # this methode is no longer used ness to clean safety
90
95
  def destroy_path(field, attachment)
91
96
  destroy_path_helper = options.fetch(:destroy_path)
92
97
  record_id = field.data.record.id
@@ -2,7 +2,7 @@ $:.push File.expand_path("../lib", __FILE__)
2
2
 
3
3
  Gem::Specification.new do |gem|
4
4
  gem.name = "viniBaxter-field-active_storage"
5
- gem.version = "5.0.0"
5
+ gem.version = "10.0.0"
6
6
  gem.authors = ["viny baxter"]
7
7
  gem.email = ["vincent.viricel@gmail.com"]
8
8
  gem.homepage = "https://github.com/Dreamersoul/administrate-field-active_storage"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: viniBaxter-field-active_storage
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0
4
+ version: 10.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - viny baxter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-11 00:00:00.000000000 Z
11
+ date: 2020-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: administrate