viniBaxter-field-active_storage 300.0.4 → 300.0.8

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: 87b79589f648d29cae389c4f4e05ba2f5eda5a204a05d3a868f2a5d4bb001587
4
- data.tar.gz: 500b6345e53af356d9bb4062462185d1c700edd5a2b7736fd6d68a63e7c8eba6
3
+ metadata.gz: d22048dd1719aafbaa1450afd38a0c25bc7011d0afc594aed93d556edb5d826c
4
+ data.tar.gz: b8c0044eebcf42b178fad52ff14f923096673fc87fb1dd61f3897441d4d7da24
5
5
  SHA512:
6
- metadata.gz: 105b6b52b9bc8d9cce99b1e73718cd37c38832f1cf23e4773eafb20c6a5672e4e77dd030f000d62f4c4b41d00db831c43878db931d881691a2163e736c296ab9
7
- data.tar.gz: 4d8d9ddc967eb6f9659fa7e2e69e8bd7a7b5a56fbb99bcdef90410c331151bb6e1ebb850f7daf2471cc068143d27cafb52b82be7971f3a26f88eab6eb854cbf5
6
+ metadata.gz: 8592b56fdd2b2c779b65e02227e65451b2201bcef0cee75a8044ae72a767e5d64ab07745e54a7bc6232b26bd85473d223ccbc7c63bacf7f331cf237b25ff0ae1
7
+ data.tar.gz: f68e11231bd2fd97692cf051068e7b93605729b31ec3f269a42c4ba2f81bee7b480ab57729a29d85405f84b32077b28126bd4899a51e9a1ba190a682219ab2dc
@@ -1,10 +1,3 @@
1
- <style type="text/css" nonce="<%= content_security_policy_nonce %>">
2
- #as-field-<%= attachment.id %> {
3
- width: <%=size[0]/2%>px;
4
- height: auto;
5
- overflow: hidden;
6
- }
7
- </style>
8
1
  <div id="as-field-<%= attachment.id %>">
9
2
  <% if attachment.image? %>
10
3
  <% if attachment.variable? %>
@@ -22,13 +22,17 @@ module Administrate
22
22
  end
23
23
 
24
24
  def index_preview_size
25
- options.fetch(:index_preview_size, [150, 150])
25
+ options.fetch(:index_preview_size, [10, 10])
26
26
  end
27
27
 
28
28
  def show_display_preview?
29
29
  options.fetch(:show_display_preview, true)
30
30
  end
31
31
 
32
+ def show_preview_size
33
+ options.fetch(:show_preview_size, [200, 200])
34
+ end
35
+
32
36
  def url_only?
33
37
  options.fetch(:url_only, false)
34
38
  end
@@ -45,10 +49,6 @@ module Administrate
45
49
  options.fetch(:index_display_count) { attached? && attachments.count != 1 }
46
50
  end
47
51
 
48
- def show_preview_size
49
- options.fetch(:show_preview_size, [800, 800])
50
- end
51
-
52
52
  def many?
53
53
  # find a way to use instance_of
54
54
  # data.class.name == 'ActiveStorage::Attached::Many'
@@ -59,44 +59,17 @@ module Administrate
59
59
  options.fetch(:direct_upload, false)
60
60
  end
61
61
 
62
- def drop_js?
63
- options.fetch(:drop_js, false)
64
- end
65
-
66
- def show_drop_js_on_show?
67
- options.fetch(:show_drop_js_on_show, false)
68
- end
69
-
70
- def sweety_show_drop_js_on_show?
71
- options.fetch(:sweety_show_drop_js_on_show, false)
72
- end
73
-
74
- def drop_max_file?
75
- options.fetch(:drop_max_file, many? == true ? 10 : 1)
76
- end
77
-
78
- def drop_max_file_size?
79
- options.fetch(:drop_max_file_size, 10)
80
- end
81
-
82
- def drop_accepted_files?
83
- options.fetch(:drop_accepted_files, ".jpeg,.jpg,.png,.gif,.svg")
84
- end
85
-
86
62
  def destroy_url
87
63
  options.fetch(:destroy_url, nil)
88
64
  end
89
65
 
90
- # def destroy_path?
91
- # options.fetch(:destroy_path, false).present?
92
- # end
93
-
94
66
  # currently we are using Rails.application.routes.url_helpers
95
67
  # without including the namespace because it runs into an
96
68
  # exception
97
69
 
98
70
  # work around since calling data.preview(options)
99
71
  # returns "/images/<ActiveStorage::Preview>" which isnt the url
72
+
100
73
  def preview(attachment, options)
101
74
  Rails.application.routes.url_helpers.rails_representation_path(attachment.preview(options), only_path: true)
102
75
  end
@@ -134,6 +107,35 @@ module Administrate
134
107
  def attachments
135
108
  data.attachments if attached?
136
109
  end
110
+
111
+ # drop js
112
+
113
+ def drop_js?
114
+ options.fetch(:drop_js, false)
115
+ end
116
+
117
+ def show_drop_js_on_show?
118
+ options.fetch(:show_drop_js_on_show, false)
119
+ end
120
+
121
+ def sweety_show_drop_js_on_show?
122
+ options.fetch(:sweety_show_drop_js_on_show, false)
123
+ end
124
+
125
+ def drop_max_file?
126
+ options.fetch(:drop_max_file, many? == true ? 20 : 1)
127
+ end
128
+
129
+ def drop_max_file_size?
130
+ options.fetch(:drop_max_file_size, 50)
131
+ end
132
+
133
+ def drop_accepted_files?
134
+ options.fetch(:drop_accepted_files, ".jpeg,.jpg,.png,.svg,.gif,.pdf,.mov")
135
+ end
136
+
137
+ # end of drop js
138
+
137
139
  end
138
140
  end
139
141
  end
@@ -5,7 +5,7 @@ module ViniBaxter
5
5
  module ViniBaxterFieldActiveStorage
6
6
  MAJOR = 300
7
7
  MINOR = 0
8
- TINY = 4
8
+ TINY = 8
9
9
  PRE = "STUDIO"
10
10
 
11
11
  VERSION = [MAJOR, MINOR, TINY].compact.join(".")
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: 300.0.4
4
+ version: 300.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - viny baxter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-03 00:00:00.000000000 Z
11
+ date: 2022-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: administrate