viniBaxter-field-active_storage 9.0.0 → 12.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c6d5ca940790c25b14fcae6e4fbbda5ba4e9a9e93b894a2b9d2460f1b8f923a2
4
- data.tar.gz: ae3119f47aa46ec39d218d0781cdc8581e3bdc9ed7c89d7eca56988d6e78e293
3
+ metadata.gz: ebf28719667e6d8f07bbcae4c438102df936a9bc2c410e98d157b7d71c320fdd
4
+ data.tar.gz: 6458443bad3f369073806d10045f846af9fd59adb9c44dd81910c062f3578181
5
5
  SHA512:
6
- metadata.gz: 47d56263a5fc5ee206bc848ffe0dea05a19b9df516d1f74bdd463aa335faa49d818046d2ebdbda6634e465293e88c85779a12465278765e902267d34fc55933f
7
- data.tar.gz: 58dd1300740f61194ab4574f18d38f9333bafffce2d9066cb1ac9722ec9f99c4010c6cc8a8f889cbfb544b46a19750e321ec3a38550e7f400a84b7d7e00cf522
6
+ metadata.gz: 96ff94477b3553c48fda719b95d70e8cc763442ccf8ccc8e886d0b725fb1dfc92f9a47dc7b84b0d17e0b0507b5258f8af357275bd5e3c1b897ca883c2d318886
7
+ data.tar.gz: 48014cf9638e745428a30ff69d9cfc5c8e1124d7f05c906c038c22d4b2a519e84eab6994e6cbcd44c68cb2e911ac1d79ea49a8052e63760c52924e73c1af1bf8
@@ -1,18 +1,19 @@
1
1
  <div class="">
2
2
  <div
3
3
  class="dropzone dropzone-default dz-clickable"
4
- data-controller="dropzonegem"
5
- data-dropzonegem-max-file-size="<%= field.drop_max_file_size? %>"
6
- data-dropzonegem-max-files="<%= field.drop_max_file? %>"
7
- data-dropzonegem-accepted-files="<%= field.drop_accepted_files? %>"
8
- data-dropzonegem-add-remove-links="hello">
9
- <%= f.file_field field.attribute, multiple: field.many?, direct_upload: field.direct?, data: { target: 'dropzonegem.inputdropzonegem' } %>
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
- <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>
@@ -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, [1920, 1080])
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
- <%= image_tag(field.variant(attachment, resize_to_limit: image_size),class:'avatar-img rounded delete_on_click') %>
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 %>
@@ -28,8 +28,8 @@ 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],
32
- image_size: [50, 50]
31
+ attachment: field.data,
32
+ image_size: [200, 200]
33
33
  } %>
34
34
  <% end %>
35
35
  <% if field.index_display_count? %>
@@ -1,69 +1,35 @@
1
- <%#
2
- # Item Partial
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
- <%#= 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,
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
- <hr>
69
- <% end %>
34
+ <hr>
35
+ <% end %>
@@ -1,5 +1,5 @@
1
- require 'administrate/field/base'
2
- require 'rails'
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
@@ -20,7 +30,7 @@ module Administrate
20
30
  end
21
31
 
22
32
  def index_display_count?
23
- options.fetch(:index_display_count) { attachments.present? && attachments.count != 1 }
33
+ options.fetch(:index_display_count) { attached? && attachments.count != 1 }
24
34
  end
25
35
 
26
36
  def show_preview_size
@@ -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 ? 10 : 1)
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 = "9.0.0"
5
+ gem.version = "12.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: 9.0.0
4
+ version: 12.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-07-02 00:00:00.000000000 Z
11
+ date: 2021-04-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: administrate