viniBaxter-field-active_storage 8.0.0 → 11.0.2

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: f81a22f2a62e4c0ee2372200e7760d61a2a3ea530bb475860434467d7a4c3486
4
- data.tar.gz: eb0c1f99c98ecea937e74c7e4a432a5304dbb1ec5307ea05ff3243181ff70c70
3
+ metadata.gz: 802bc905eb3764bf6a6381745b04f0b923a5d2d0046811c77a66dad259b608c3
4
+ data.tar.gz: bae49a6ab1189985d0124fafba1a25c8c1bc937ca8fcda179f028b8bf7ad00e8
5
5
  SHA512:
6
- metadata.gz: 579e7f7d7ecb23205b8b98a10bc82893b9ceaacccd19ef4b129be1b0525006516a80e8b66575c26ca7533c9277411d9729649b1ec8228ac0e1bcdfd8b589b76c
7
- data.tar.gz: fba5c8711e92b98cd9aa7b3e67b5c0bf7b38b7380116d7718d4daa90eabbb17251f4cba54fcf0a102ee7d35c71f8a2726211c56303a7a2f4fef267b3491fd691
6
+ metadata.gz: 6d3d74cceae9dc38f8d572920a9366b1ef849967bc5f3000322b2802d4e45d798fc39929499bb27a96e0e11275296fea3bfb4bc9df5b687a74a236d15caf689b
7
+ data.tar.gz: 9b000bd4799f1ca4cf16a14c5670fe2d1e06f3c88f5da19ee83b5658c6943f77336ff43be7b4e5d8d64c44946418c5f86eff793a9596f48f1cac011f2dccb889
@@ -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>
@@ -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,64 +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
- <%= link_to(field.blob_url(attachment), title: attachment.filename, class:'avatar avatar-sm mr-2') do %>
34
- <%= image_tag(field.variant(attachment, resize_to_limit: image_size, quality: 100, :loader => {strip: true, type: "TrueColorMatte"}), class:"avatar-img rounded-circle") %>
35
- <% end %>
36
- <% elsif attachment.image? and !field.url_only? %>
37
- <%= link_to(field.blob_url(attachment), title: attachment.filename) do %>
38
- <%= image_tag(field.url(attachment)) %>
39
- <% end %>
40
- <% elsif attachment.video? and attachment.previewable? and !field.url_only? %> <%# if ffmpeg is installed %>
41
- <%= video_tag(field.url(attachment), poster: field.preview(attachment, resize_to_limit: image_size), controls: true, autobuffer: true, style: "width: 100%; height: auto;") %>
42
- <% elsif attachment.video? and !field.url_only? %>
43
- <%= video_tag(field.url(attachment), controls: true, autobuffer: true, style: "width: 100%; height: auto;") %>
44
- <% elsif attachment.audio? and !field.url_only? %>
45
- <%= audio_tag(field.url(attachment), autoplay: false, controls: true) %>
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])) %>
46
21
  <% else %>
47
- <%= link_to(field.blob_url(attachment), title: attachment.filename) do %>
48
- <% if attachment.previewable? and !field.url_only? %>
49
- <%= image_tag(field.preview(attachment, resize_to_limit: [595, 842])) %>
50
- <% else %>
51
- <%= attachment.filename %>
52
- <% end %>
53
- <% end %>
22
+ <%= attachment.filename %>
54
23
  <% end %>
55
- <% if removable %>
56
- <%#= link_to 'Remove', field.destroy_path(field, attachment), method: :delete, class: 'remove-attachment-link' %>
57
- <%= link_to 'Remove', destroy_url,
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,
58
29
  method: :delete,
59
30
  # data: { confirm: t("administrate.actions.confirm") },
60
31
  remote: true,
61
32
  class: 'remove-attachment-link'
62
33
  %>
63
- <hr>
64
- <% 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 = "8.0.0"
5
+ gem.version = "11.0.2"
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: 8.0.0
4
+ version: 11.0.2
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-06-30 00:00:00.000000000 Z
11
+ date: 2021-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: administrate