viniBaxter-field-active_storage 5.0.0 → 6.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 +4 -4
- data/app/views/fields/active_storage/_dropjs_list_edit.html.erb +21 -10
- data/app/views/fields/active_storage/_item.html.erb +5 -4
- data/app/views/fields/active_storage/_items.html.erb +13 -3
- data/lib/viniBaxter/field/active_storage.rb +5 -0
- data/viniBaxter-field-active_storage.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cda3b9db71dd71fdc69303d4eef7825fa8d5962facca7b3d9cfbc9405d81fb85
|
4
|
+
data.tar.gz: b51ebe68bd5eff1912804a2e4946bb1a495ae85c19076a355a6d3be5bcb6f44f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a3003bc1ceceb2dc7c88ddde64dd982f5e4226ab21dfc77e74fb7c82b87761945ec2bf3ad814e336dbd0990d1199baf25605ab21b3b2abc53c5974b5e1b1df8
|
7
|
+
data.tar.gz: 6fc9ddb534628d8217c581c969d3414aa9fe082ede4bcb763260606793a40a215fa6b127f6eb8c4e363f326e5f46fdb83f8995a2ee6e4cfbfe599ad6a0fb710b
|
@@ -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
|
-
<
|
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=""
|
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
|
-
|
60
|
-
|
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>
|
@@ -20,13 +20,11 @@ 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
29
|
<%= link_to(field.blob_url(attachment), title: attachment.filename) do %>
|
32
30
|
<%= image_tag(field.variant(attachment, resize_to_limit: image_size)) %>
|
@@ -50,8 +48,11 @@ controlled via a boolean local variable.
|
|
50
48
|
<% end %>
|
51
49
|
<% end %>
|
52
50
|
<% end %>
|
53
|
-
|
54
51
|
<% if removable %>
|
55
|
-
|
52
|
+
<%#= link_to 'Remove', field.destroy_path(field, attachment), method: :delete, class: 'remove-attachment-link' %>
|
53
|
+
<%= link_to 'Remove', destroy_url,
|
54
|
+
method: :delete,
|
55
|
+
remote: true,
|
56
|
+
class: 'remove-attachment-link' %>
|
56
57
|
<hr>
|
57
58
|
<% 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: {
|
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-
|
43
|
-
<%= render partial: 'fields/active_storage/dropjs_list_edit', locals: {
|
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>
|
@@ -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
|
+
gem.version = "6.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:
|
4
|
+
version: 6.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-
|
11
|
+
date: 2020-06-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: administrate
|