viniBaxter-field-active_storage 11.0.1 → 16.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: a9ab0725b912eb2b8c7071ed6be16afffe917111c784e82123d1e9f59a6a3313
4
- data.tar.gz: 8f8fe66bf80e58071898a73f3c51d03e2b61f1019aee9d166a3f36d44f1111e3
3
+ metadata.gz: f73b27794946f84b1afeb172e03c06c74734a47757f3405d73af17348d20585f
4
+ data.tar.gz: d7c816e0c973c29d46866626806140d0d05406197fdf828722a595201cd67046
5
5
  SHA512:
6
- metadata.gz: 3755ab73298b1a5d380ec75a681b3957d9da9b4f6ba84a8e0c401b26966820a090360a750ddb984137a35b40281ba34b6dce7326b9dea83d152d7a682f9e8678
7
- data.tar.gz: 6bcc224531d945f5b29c2c51579fff19d397e0a06ab54fda44290559b89e9faa616fe0386195b1d53ae6d994e473a74cc7ef52c7905d804885418ff1241c21c7
6
+ metadata.gz: 46c1682dfd058348342d2836a732c26072ed108345db4f63cb7d5ff4b24393d0232bc4fdf54ea89c3ff9b5f436f3bc942ed0ccfbdb70007729dd14d10401f5ad
7
+ data.tar.gz: 7fab31f2155a694a47ecdf260d511cafb9688dd4bc706a0cab618259e70649df498eefe25be8bc25f69ef8d52d795d1ed3bcb3a3e84b46e14219af39f9c871f5
@@ -19,19 +19,21 @@ By default, the input is a text field for the image's URL.
19
19
  </div>
20
20
  <div class="field-unit__field">
21
21
  <% if field.drop_js? %>
22
- <!-- Form dropJS -->
23
- <%= render partial: 'fields/active_storage/dropjs_items', locals: { f: f, field: field, removable: field.destroyable? } %>
22
+ <%= render partial: 'fields/active_storage/drop_js/dropjs_items', locals: { f: f, field: field, removable: field.destroyable? } %>
24
23
  <%else %>
25
- <!-- Form if no dropJS -->
26
24
  <%= f.file_field field.attribute, multiple: field.many?, direct_upload: field.direct? %>
27
25
  <%end %>
28
26
  <!-- show previous images recorded -->
29
27
  <% if field.attached? %>
30
28
  <% if !field.drop_js? %>
31
- <%= render partial: 'fields/active_storage/items', locals: { field: field, removable: field.destroyable? } %>
29
+ <%= render partial: 'fields/active_storage/normal/items_on_show', locals: { field: field, removable: field.destroyable? } %>
32
30
  <%= field.can_add_attachment? ? "Add:" : "Replace:" %>
33
31
  <%else %>
34
- <%= render partial: 'fields/active_storage/items', locals: { field: field, removable: field.destroyable? } %>
32
+ <% if request.env["PATH_INFO"].include?('edit')%>
33
+ <%= render partial: 'fields/active_storage/drop_js/drop_js_items_on_edit', locals: { field: field, removable: field.destroyable? } %>
34
+ <% else %>
35
+ <%= render partial: 'fields/active_storage/drop_js/drop_js_items_on_show', locals: { field: field, removable: field.destroyable? } %>
36
+ <% end %>
35
37
  <%end %>
36
38
  <% end %>
37
39
  </div>
@@ -25,11 +25,11 @@ By default, the attribute is rendered as an image tag.
25
25
  %>
26
26
  <% if field.attached? %>
27
27
  <% if field.show_in_index? %>
28
- <%= render partial: 'fields/active_storage/item',
28
+ <%= render partial: 'fields/active_storage/normal/item',
29
29
  locals: {
30
30
  field: field,
31
31
  attachment: field.data,
32
- image_size: [50, 50]
32
+ image_size: [200, 200]
33
33
  } %>
34
34
  <% end %>
35
35
  <% if field.index_display_count? %>
@@ -15,9 +15,9 @@ By default, the attribute is rendered as an image tag.
15
15
  [1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/Image
16
16
  %>
17
17
  <% if field.attached? %>
18
- <% if field.show_drop_js_on_show? %>
19
- <%= render partial: 'fields/active_storage/items', locals: { field: field } %>
20
- <%else %>
21
- <%= render partial: 'fields/active_storage/items_on_show', locals: { field: field } %>
18
+ <% if field.show_drop_js_on_show? %>
19
+ <%= render partial: 'fields/active_storage/drop_js/drop_js_items_on_show', locals: { field: field } %>
20
+ <%else %>
21
+ <%= render partial: 'fields/active_storage/normal/items_on_show', locals: { field: field } %>
22
+ <% end %>
22
23
  <% end %>
23
- <% end %>
@@ -0,0 +1,37 @@
1
+ <%
2
+ attachments = Array(field.many? ? field.attachments : field.data)
3
+ removable = local_assigns.fetch(:removable, false)
4
+ %>
5
+ <div class="mt-5 col-12 ">
6
+ <div class="row">
7
+ <div class="col-12">
8
+ <div class="card card light-shadow card-fill">
9
+ <div class="card-header">
10
+ <h4 class="card-header-title">
11
+ Latest Uploads
12
+ </h4>
13
+ </div>
14
+ <div class="card-body">
15
+ <div class="already-downloaded dropzone">
16
+ <div class="list-group list-group-flush">
17
+ <div class="list-group-item">
18
+ <div class="row align-items-center">
19
+ <% attachments.each do |attachment| %>
20
+ <div class="" id="<%= @page.class %>_picture_<%= attachment.id %>">
21
+ <%= render partial: 'fields/active_storage/drop_js/dropjs_list_edit', locals: {
22
+ field: field,
23
+ attachment: attachment,
24
+ removable: removable,
25
+ image_size: field.show_preview_size
26
+ }%>
27
+ </div>
28
+ <% end %>
29
+ </div>
30
+ </div>
31
+ </div>
32
+ </div>
33
+ </div>
34
+ </div>
35
+ </div>
36
+ </div>
37
+ </div>
@@ -0,0 +1,33 @@
1
+ <%
2
+ attachments = Array(field.many? ? field.attachments : field.data)
3
+ removable = local_assigns.fetch(:removable, false)
4
+ %>
5
+ <div class="mt-5 col-12 ">
6
+ <div class="row">
7
+ <div class="col-12">
8
+ <div class="card card light-shadow card-fill">
9
+ <div class="card-header">
10
+ <h4 class="card-header-title">
11
+ Latest Uploads
12
+ </h4>
13
+ </div>
14
+ <div class="card-body">
15
+ <div class="already-downloaded dropzone">
16
+ <div class="row">
17
+ <% attachments.each do |attachment| %>
18
+ <div class="col-4" id="<%= @page.class %>_picture_<%= attachment.id %>">
19
+ <%= render partial: 'fields/active_storage/drop_js/dropjs_list_show', locals: {
20
+ field: field,
21
+ attachment: attachment,
22
+ removable: removable,
23
+ image_size: field.show_preview_size
24
+ }%>
25
+ </div>
26
+ <% end %>
27
+ </div>
28
+ </div>
29
+ </div>
30
+ </div>
31
+ </div>
32
+ </div>
33
+ </div>
@@ -1,12 +1,12 @@
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
11
  <h3 class="dropzone-msg-title">Drag & Drop ici ou cliquer pour selectionner</h3>
12
12
  <span class="dropzone-msg-desc text-sm">
@@ -18,7 +18,7 @@
18
18
  </span>
19
19
  </div>
20
20
  <div id="tpl" style='display:none'>
21
- <%= render partial: 'fields/active_storage/dropjs_template'%>
21
+ <%= render partial: 'fields/active_storage/drop_js/dropjs_template'%>
22
22
  </div>
23
23
  <%#= render 'ulFordropjs' %>
24
24
  </div>
@@ -0,0 +1,49 @@
1
+ <div class='mt-4 list-group list-group-flush'>
2
+ <div class="dz-preview dz-file-preview bibi">
3
+ <div class="row align-items-center">
4
+ <div class="col-auto">
5
+ <div class="mx-1 my-1 avatar avatar-xl">
6
+ <%
7
+ # By default we don't allow attachment removal
8
+ removable = local_assigns.fetch(:removable, false)
9
+ image_size = local_assigns.fetch(:image_size, [200, 200])
10
+ %>
11
+ <% if attachment.image? and attachment.variable? and !field.url_only? %>
12
+ <%= link_to(field.blob_url(attachment), title: attachment.filename, class:'rounded avatar-img') do %>
13
+ <%#= image_tag(field.variant(attachment, resize_to_limit: image_size),class:'avatar-img rounded delete_on_click') %>
14
+ <%= image_tag attachment.variant(resize_to_limit: image_size), class:"rounded avatar-img delete_on_click" %>
15
+ <% end %>
16
+ <% elsif attachment.image? and !field.url_only? %>
17
+ <%= link_to(field.blob_url(attachment), title: attachment.filename) do %>
18
+ <%= image_tag(field.url(attachment)) %>
19
+ <% end %>
20
+ <% elsif attachment.video? and attachment.previewable? and !field.url_only? %> <%# if ffmpeg is installed %>
21
+ <%= video_tag(field.url(attachment), poster: field.preview(attachment, resize_to_limit: image_size), controls: true, autobuffer: true, style: "width: 100%; height: auto;") %>
22
+ <% elsif attachment.video? and !field.url_only? %>
23
+ <%= video_tag(field.url(attachment), controls: true, autobuffer: true, style: "width: 100%; height: auto;") %>
24
+ <% elsif attachment.audio? and !field.url_only? %>
25
+ <%= audio_tag(field.url(attachment), autoplay: false, controls: true) %>
26
+ <% else %>
27
+ <%= link_to(field.blob_url(attachment), title: attachment.filename) do %>
28
+ <% if attachment.previewable? and !field.url_only? %>
29
+ <%= image_tag(field.preview(attachment, resize_to_limit: [595, 842])) %>
30
+ <% else %>
31
+ <%= attachment.filename %>
32
+ <% end %>
33
+ <% end %>
34
+ <% end %>
35
+ <% if field.destroy_url.present? %>
36
+ <% destroy_url = field.destroy_url.call(namespace, field.data.record, attachment) %>
37
+ <div class="position-absolute delete-link d-flex align-items-center justify-content-center">
38
+ <%= link_to destroy_url,
39
+ method: :delete,
40
+ remote: true do %>
41
+ <i class="tim-icons icon-simple-remove text-light"></i>
42
+ <% end %>
43
+ </div>
44
+ <% end %>
45
+ </div>
46
+ </div>
47
+ </div>
48
+ </div>
49
+ </div>
@@ -7,7 +7,7 @@
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 %>
@@ -0,0 +1,33 @@
1
+
2
+ <div class='mt-4 list-group list-group-flush'>
3
+ <div class="dz-preview dz-file-preview bibi">
4
+ <div class="row align-items-center">
5
+ <div class="col-auto">
6
+ <div class="mx-1 my-1 avatar avatar-xl">
7
+ <img class="rounded avatar-img" data-dz-thumbnail>
8
+ <div class="position-absolute delete-link d-flex align-items-center justify-content-center">
9
+ <a rel="nofollow" data-dz-remove>
10
+ <i class="tim-icons icon-simple-remove text-light"></i>
11
+ </a>
12
+ </div>
13
+ </div>
14
+ </div>
15
+ <div class="col ml-n2">
16
+ <!-- Title -->
17
+ <h4 class="mb-1 text-body name">
18
+ <div class="dz-filename"><span data-dz-name></span></div>
19
+ <div class="dz-error-message"><span data-dz-errormessage></span></div>
20
+ </h4>
21
+ <!-- Time -->
22
+ <p class="mb-0 small text-muted">
23
+ <span class="fe fe-clock"></span>
24
+ <time data-dz-size></time>
25
+ </p>
26
+ <div class="ml-1 w-50 dz-progress">
27
+ <span class="dz-upload" data-dz-uploadprogress>
28
+ </span>
29
+ </div>
30
+ </div>
31
+ </div>
32
+ </div>
33
+ </div>
@@ -1,8 +1,8 @@
1
1
  <% removable = local_assigns.fetch(:removable, false)
2
- image_size = local_assigns.fetch(:image_size, [1920, 1080]) %>
2
+ image_size = local_assigns.fetch(:image_size, [200, 200]) %>
3
3
  <% if attachment.image? and attachment.variable? and !field.url_only? %>
4
4
  <div class="avatar avatar-lg">
5
- <%= image_tag attachment.variant(resize: "400x400"), class:"avatar-img rounded" %>
5
+ <%= image_tag attachment.variant(resize_to_limit: image_size), class:"avatar-img rounded"%>
6
6
  </div>
7
7
  <% elsif attachment.image? and !field.url_only? %>
8
8
  <%= link_to(field.blob_url(attachment), title: attachment.filename) do %>
@@ -4,6 +4,11 @@
4
4
  %>
5
5
  <% attachments.each do |attachment| %>
6
6
  <div class="attachments-listing">
7
- <%= render partial: 'fields/active_storage/item', locals: { field: field, attachment: attachment, removable: removable, image_size: field.show_preview_size } %>
7
+ <%= render partial: 'fields/active_storage/normal/item', locals: {
8
+ field: field,
9
+ attachment: attachment,
10
+ removable: removable,
11
+ image_size: field.show_preview_size
12
+ } %>
8
13
  </div>
9
14
  <% 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
@@ -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
@@ -0,0 +1,13 @@
1
+ module ViniBaxter
2
+ # module SpaLanding
3
+ # VERSION = '15.0.0'
4
+ # end
5
+ module ViniBaxterFieldActiveStorage
6
+ MAJOR = 16
7
+ MINOR = 0
8
+ TINY = 0
9
+ # PRE = "alpha"
10
+
11
+ VERSION = [MAJOR, MINOR, TINY].compact.join(".")
12
+ end
13
+ end
@@ -1,8 +1,9 @@
1
1
  $:.push File.expand_path("../lib", __FILE__)
2
+ require "viniBaxter/version"
2
3
 
3
4
  Gem::Specification.new do |gem|
4
5
  gem.name = "viniBaxter-field-active_storage"
5
- gem.version = "11.0.1"
6
+ gem.version = ViniBaxter::ViniBaxterFieldActiveStorage::VERSION
6
7
  gem.authors = ["viny baxter"]
7
8
  gem.email = ["vincent.viricel@gmail.com"]
8
9
  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: 11.0.1
4
+ version: 16.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: 2021-03-05 00:00:00.000000000 Z
11
+ date: 2021-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: administrate
@@ -66,17 +66,20 @@ files:
66
66
  - README.md
67
67
  - Rakefile
68
68
  - _config.yml
69
- - app/views/fields/active_storage/_dropjs_items.html.erb
70
- - app/views/fields/active_storage/_dropjs_list_edit.html.erb
71
- - app/views/fields/active_storage/_dropjs_template.html.erb
72
69
  - app/views/fields/active_storage/_form.html.erb
73
70
  - app/views/fields/active_storage/_index.html.erb
74
- - app/views/fields/active_storage/_item.html.erb
75
- - app/views/fields/active_storage/_items.html.erb
76
- - app/views/fields/active_storage/_items_on_show.html.erb
77
71
  - app/views/fields/active_storage/_show.html.erb
72
+ - app/views/fields/active_storage/drop_js/_drop_js_items_on_edit.html.erb
73
+ - app/views/fields/active_storage/drop_js/_drop_js_items_on_show.html.erb
74
+ - app/views/fields/active_storage/drop_js/_dropjs_items.html.erb
75
+ - app/views/fields/active_storage/drop_js/_dropjs_list_edit.html.erb
76
+ - app/views/fields/active_storage/drop_js/_dropjs_list_show.html.erb
77
+ - app/views/fields/active_storage/drop_js/_dropjs_template.html.erb
78
+ - app/views/fields/active_storage/normal/_item.html.erb
79
+ - app/views/fields/active_storage/normal/_items_on_show.html.erb
78
80
  - contribute.md
79
81
  - lib/viniBaxter/field/active_storage.rb
82
+ - lib/viniBaxter/version.rb
80
83
  - spec/lib/administrate/field/active_storage_spec.rb
81
84
  - viniBaxter-field-active_storage.gemspec
82
85
  homepage: https://github.com/Dreamersoul/administrate-field-active_storage
@@ -1,54 +0,0 @@
1
- <div class='list-group list-group-flush pt-4 my-n3'>
2
- <div class="dz-preview dz-file-preview bibi">
3
- <div class="list-group-item">
4
- <div class="row align-items-center">
5
- <div class="col-auto">
6
- <!-- Avatar -->
7
- <a href="#!" class="avatar">
8
- <img data-dz-thumbnail data-dz-remove class="avatar-img rounded delete_on_click" />
9
- </a>
10
- </div>
11
- <div class="col ml-n2">
12
- <!-- Title -->
13
- <h4 class="font-weight-normal mb-1">
14
- <a href="#!">
15
- <div class="dz-filename"><span data-dz-name></span></div>
16
- </a>
17
- </h4>
18
- <div class="dz-progress">
19
- <span
20
- class="dz-upload"
21
- data-dz-uploadprogress>
22
- </span>
23
- </div>
24
- <div class="dz-error-message"><span data-dz-errormessage ></span></div>
25
- <!-- Text -->
26
- <small class="text-muted">
27
- <div class="dz-size" data-dz-size></div>
28
- </small>
29
- </div>
30
- <div class="col-auto">
31
- <!-- Dropdown -->
32
- <div class="dropdown">
33
- <a href="#" class="dropdown-ellipses dropdown-toggle" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
34
- <i class="fe fe-more-vertical"></i>
35
- </a>
36
- <div class="dropdown-menu dropdown-menu-right">
37
- <a href="#!" class="dropdown-item">
38
- Action
39
- </a>
40
- <a href="#!" class="dropdown-item dz-remove delete_on_click" data-dz-remove>Remove file</a>
41
- <a href="#!" class="dropdown-item">
42
- Another action
43
- </a>
44
- <a href="#!" class="dropdown-item">
45
- Something else here
46
- </a>
47
- </div>
48
- </div>
49
- </div>
50
- </div>
51
- <!-- / .row -->
52
- </div>
53
- </div>
54
- </div>
@@ -1,63 +0,0 @@
1
- <%#
2
- # Items Partial
3
-
4
- This partial renders one or more attachments
5
-
6
- ## Local variables:
7
-
8
- - `field`:
9
- An instance of [Administrate::Field::Image].
10
- A wrapper around the image url pulled from the database.
11
- - `removable`:
12
- A boolean used to control the display of a `Remove` link which
13
- is used to destroy a single attachment. Defaults to `false`
14
- %>
15
- <%
16
- attachments = Array(field.many? ? field.attachments : field.data)
17
- removable = local_assigns.fetch(:removable, false)
18
- %>
19
- <!-- On edit if no dropJS -->
20
- <% if !field.drop_js? %>
21
- <% attachments.each do |attachment| %>
22
- <div class="attachments-listing">
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
- } %>
29
- </div>
30
- <% end %>
31
- <%else %>
32
- <!-- On edit if dropJS -->
33
- <div class="mt-5 col-12 ">
34
- <div class="row">
35
- <div class="col-12">
36
- <div class="card card light-shadow card-fill">
37
- <div class="card-header">
38
- <!-- Title -->
39
- <h4 class="card-header-title">
40
- Latest Uploads
41
- </h4>
42
- </div>
43
- <div class="card-body">
44
- <div class="already-downloaded dropzone">
45
- <div class="row">
46
- <% attachments.each do |attachment| %>
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
- }%>
54
- </div>
55
- <% end %>
56
- </div>
57
- </div>
58
- </div>
59
- </div>
60
- </div>
61
- </div>
62
- </div>
63
- <% end %>