viniBaxter-field-active_storage 10.0.0 → 14.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_items.html.erb +6 -6
- data/app/views/fields/active_storage/_dropjs_list_edit.html.erb +3 -2
- data/app/views/fields/active_storage/_index.html.erb +1 -1
- data/app/views/fields/active_storage/_item.html.erb +29 -63
- data/lib/viniBaxter/field/active_storage.rb +14 -4
- 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: d3d30540212b411b917f5d8323a78d6f4b0b883b7832c9d0ad0ba3fbc529a9cd
|
4
|
+
data.tar.gz: 62b661ca2860aff1cc65f39d7d553ada80095d64c37ec4d19a3948f9aa0545e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 393b4b2c4585b0930786cb0c1f3eb0f33fd6665f208d41b65de9dd282b056625fa8cfbcfa1f0a83e5948a22a94c4801859ca3c7db26c2379a729df4fa39731f1
|
7
|
+
data.tar.gz: 774c280755a06dc643059a5b91fbb6addf63dcbb7fba04a470980145cad68d5ce0b763bd8e9caab606913ea6785c2cdc72fc421d14f93ab392dffbfd84eab66e
|
@@ -1,12 +1,12 @@
|
|
1
1
|
<div class="">
|
2
2
|
<div
|
3
3
|
class="dropzone dropzone-default dz-clickable"
|
4
|
-
data-controller="
|
5
|
-
data-
|
6
|
-
data-
|
7
|
-
data-
|
8
|
-
data-
|
9
|
-
<%= f.file_field field.attribute, multiple: field.many?, direct_upload: field.direct?, data: { target: '
|
4
|
+
data-controller="dropzone"
|
5
|
+
data-dropzone-max-file-size="<%= field.drop_max_file_size? %>"
|
6
|
+
data-dropzone-max-files="<%= field.drop_max_file? %>"
|
7
|
+
data-dropzone-accepted-files="<%= field.drop_accepted_files? %>"
|
8
|
+
data-dropzone-add-remove-links="hello">
|
9
|
+
<%= f.file_field field.attribute, multiple: field.many?, direct_upload: field.direct?, data: { target: 'dropzone.inputdropzone' } %>
|
10
10
|
<div class="dropzone-msg dz-message needsclick text-gray-600">
|
11
11
|
<h3 class="dropzone-msg-title">Drag & Drop ici ou cliquer pour selectionner</h3>
|
12
12
|
<span class="dropzone-msg-desc text-sm">
|
@@ -7,11 +7,12 @@
|
|
7
7
|
<%
|
8
8
|
# By default we don't allow attachment removal
|
9
9
|
removable = local_assigns.fetch(:removable, false)
|
10
|
-
image_size = local_assigns.fetch(:image_size, [
|
10
|
+
image_size = local_assigns.fetch(:image_size, [200, 200])
|
11
11
|
%>
|
12
12
|
<% if attachment.image? and attachment.variable? and !field.url_only? %>
|
13
13
|
<%= link_to(field.blob_url(attachment), title: attachment.filename, class:'avatar') do %>
|
14
|
-
|
14
|
+
<%#= image_tag(field.variant(attachment, resize_to_limit: image_size),class:'avatar-img rounded delete_on_click') %>
|
15
|
+
<%= image_tag attachment.variant(resize_to_limit: image_size), class:"avatar-img rounded delete_on_click" %>
|
15
16
|
<% end %>
|
16
17
|
<% elsif attachment.image? and !field.url_only? %>
|
17
18
|
<%= link_to(field.blob_url(attachment), title: attachment.filename) do %>
|
@@ -1,69 +1,35 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
This partial renders attached items.
|
5
|
-
|
6
|
-
Attachments of type image, video and audio are emedded. For all other types
|
7
|
-
we try use it's preview. If all else fails we simply link to the attached file.
|
8
|
-
|
9
|
-
This partial will optionally show a `remove` link next to each attachment which is
|
10
|
-
controlled via a boolean local variable.
|
11
|
-
|
12
|
-
## Local variables:
|
13
|
-
|
14
|
-
- `field`:
|
15
|
-
An instance of [Administrate::Field::Image].
|
16
|
-
A wrapper around the image url pulled from the database.
|
17
|
-
- `attachment`:
|
18
|
-
Reference to the file
|
19
|
-
- `removable`:
|
20
|
-
A boolean used to control the display of a `Remove` link which
|
21
|
-
is used to destroy a single attachment. Defaults to `false`
|
22
|
-
%>
|
23
|
-
<%
|
24
|
-
# By default we don't allow attachment removal
|
25
|
-
removable = local_assigns.fetch(:removable, false)
|
26
|
-
image_size = local_assigns.fetch(:image_size, [1920, 1080])
|
27
|
-
%>
|
1
|
+
<% removable = local_assigns.fetch(:removable, false)
|
2
|
+
image_size = local_assigns.fetch(:image_size, [200, 200]) %>
|
28
3
|
<% if attachment.image? and attachment.variable? and !field.url_only? %>
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
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,
|
4
|
+
<div class="avatar avatar-lg">
|
5
|
+
<%= image_tag attachment.variant(resize_to_limit: image_size), class:"avatar-img rounded"%>
|
6
|
+
</div>
|
7
|
+
<% elsif attachment.image? and !field.url_only? %>
|
8
|
+
<%= link_to(field.blob_url(attachment), title: attachment.filename) do %>
|
9
|
+
<%= image_tag(field.url(attachment)) %>
|
10
|
+
<% end %>
|
11
|
+
<% elsif attachment.video? and attachment.previewable? and !field.url_only? %> <%# if ffmpeg is installed %>
|
12
|
+
<%= video_tag(field.url(attachment), poster: field.preview(attachment, resize_to_limit: image_size), controls: true, autobuffer: true, style: "width: 100%; height: auto;") %>
|
13
|
+
<% elsif attachment.video? and !field.url_only? %>
|
14
|
+
<%= video_tag(field.url(attachment), controls: true, autobuffer: true, style: "width: 100%; height: auto;") %>
|
15
|
+
<% elsif attachment.audio? and !field.url_only? %>
|
16
|
+
<%= audio_tag(field.url(attachment), autoplay: false, controls: true) %>
|
17
|
+
<% else %>
|
18
|
+
<%= link_to(field.blob_url(attachment), title: attachment.filename) do %>
|
19
|
+
<% if attachment.previewable? and !field.url_only? %>
|
20
|
+
<%= image_tag(field.preview(attachment, resize_to_limit: [595, 842])) %>
|
21
|
+
<% else %>
|
22
|
+
<%= attachment.filename %>
|
23
|
+
<% end %>
|
24
|
+
<% end %>
|
25
|
+
<% end %>
|
26
|
+
<% if removable %>
|
27
|
+
<%#= link_to 'Remove', field.destroy_path(field, attachment), method: :delete, class: 'remove-attachment-link' %>
|
28
|
+
<%= link_to 'Remove', destroy_url,
|
63
29
|
method: :delete,
|
64
30
|
# data: { confirm: t("administrate.actions.confirm") },
|
65
31
|
remote: true,
|
66
32
|
class: 'remove-attachment-link'
|
67
33
|
%>
|
68
|
-
|
69
|
-
|
34
|
+
<hr>
|
35
|
+
<% end %>
|
@@ -1,5 +1,5 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "administrate/field/base"
|
2
|
+
require "rails"
|
3
3
|
|
4
4
|
module Administrate
|
5
5
|
module Field
|
@@ -7,6 +7,16 @@ module Administrate
|
|
7
7
|
class Engine < ::Rails::Engine
|
8
8
|
end
|
9
9
|
|
10
|
+
# def store_variant(attachment,image_size)
|
11
|
+
# theVariant = @employee_staff
|
12
|
+
# .avatar
|
13
|
+
# .attachment
|
14
|
+
# .variant(resize: '100x100')
|
15
|
+
# .processed # If variant is not processed
|
16
|
+
|
17
|
+
# theVariant.service.send(:path_for, theVariant.key) # Absolute path to variant file
|
18
|
+
# end
|
19
|
+
|
10
20
|
def url_only?
|
11
21
|
options.fetch(:url_only, false)
|
12
22
|
end
|
@@ -46,7 +56,7 @@ module Administrate
|
|
46
56
|
end
|
47
57
|
|
48
58
|
def drop_max_file?
|
49
|
-
options.fetch(:drop_max_file, many? == true ?
|
59
|
+
options.fetch(:drop_max_file, many? == true ? 10 : 1)
|
50
60
|
end
|
51
61
|
|
52
62
|
def drop_max_file_size?
|
@@ -96,7 +106,7 @@ module Administrate
|
|
96
106
|
destroy_path_helper = options.fetch(:destroy_path)
|
97
107
|
record_id = field.data.record.id
|
98
108
|
attachment_id = attachment.id
|
99
|
-
Rails.application.routes.url_helpers.send(destroy_path_helper, {:record_id => record_id, :attachment_id => attachment_id})
|
109
|
+
Rails.application.routes.url_helpers.send(destroy_path_helper, { :record_id => record_id, :attachment_id => attachment_id })
|
100
110
|
end
|
101
111
|
|
102
112
|
# delegate :attached?, to: :data
|
@@ -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 = "14.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: 14.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:
|
11
|
+
date: 2021-04-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: administrate
|