simple_form_extension 1.4.17 → 1.5.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
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 38aa08ea4a8cf92f6fc0cc37e25626842ae034d35244b917f6043d3da61ec28f
|
4
|
+
data.tar.gz: 695288388ad82f16580b7bfd1bf04590e20d070fb82d1595e5c23ad732a7331a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c06e4eaa4ff32484bd0dea6e9fa5727dde895796d10a9a9996eb7cd8b18c953619ee16b0b2ff85250c6843353934ca3e4b57886ad49884d64d071f7a0f2b3aa6
|
7
|
+
data.tar.gz: e6a67846e389e65734d7cff721f692db9ddd3601b298af8c0faa443ad90a1d4acc697870689ac87be9d1078f9fd65782681f3fa941de53ab948c94b4f42f9702
|
data/README.md
CHANGED
@@ -142,7 +142,7 @@ You can customize the name of the setter that will be called with the
|
|
142
142
|
#### :selectize
|
143
143
|
|
144
144
|
The selectize field allows you to create a powerful select field using the
|
145
|
-
[Selectize](https://
|
145
|
+
[Selectize](https://selectize.github.io/selectize.js/) javascript plugin.
|
146
146
|
|
147
147
|
```ruby
|
148
148
|
= form.input :items, as: :selectize, collection: Item.all
|
@@ -26,9 +26,10 @@ module SimpleFormExtension
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def existing_file_name
|
29
|
-
if
|
29
|
+
if paperclip_attachment_attached?
|
30
30
|
object.send(:"#{ attribute_name }_file_name").html_safe
|
31
|
-
elsif
|
31
|
+
elsif activestorage_attachment_attached?
|
32
|
+
attachment = object.send(attribute_name)
|
32
33
|
attachment.filename.to_s
|
33
34
|
end
|
34
35
|
end
|
@@ -47,16 +48,25 @@ module SimpleFormExtension
|
|
47
48
|
end
|
48
49
|
|
49
50
|
def file_exists?
|
50
|
-
@file_exists ||=
|
51
|
-
object.try(attribute_name).try(:attached?)
|
51
|
+
@file_exists ||= paperclip_attachment_attached? || activestorage_attachment_attached?
|
52
52
|
end
|
53
53
|
|
54
54
|
def file_url
|
55
|
-
if
|
55
|
+
if paperclip_attachment_attached?
|
56
56
|
object.send(attribute_name)
|
57
|
-
elsif
|
58
|
-
object.
|
57
|
+
elsif activestorage_attachment_attached?
|
58
|
+
object.send(attribute_name).try(:service_url) || object.send(attribute_name).try(:url)
|
59
59
|
end
|
60
60
|
end
|
61
|
+
|
62
|
+
def paperclip_attachment_attached?
|
63
|
+
@paperclip_attachment_attached ||= object.try(:"#{ attribute_name }?")
|
64
|
+
end
|
65
|
+
|
66
|
+
def activestorage_attachment_attached?
|
67
|
+
@activestorage_attachment_attached ||=
|
68
|
+
object.try(attribute_name).try(:attached?) &&
|
69
|
+
object.try(attribute_name).blob
|
70
|
+
end
|
61
71
|
end
|
62
72
|
end
|
@@ -70,13 +70,13 @@ module SimpleFormExtension
|
|
70
70
|
# preview thumbnail
|
71
71
|
#
|
72
72
|
def file_url
|
73
|
-
if
|
73
|
+
if paperclip_attachment_attached?
|
74
74
|
object.send(attribute_name).url(image_style)
|
75
|
-
elsif
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
attachment.
|
75
|
+
elsif activestorage_attachment_attached?
|
76
|
+
attachment = object.send(attribute_name)
|
77
|
+
|
78
|
+
if attachment.representable?
|
79
|
+
attachment.representation(resize: "400x150>")
|
80
80
|
else
|
81
81
|
attachment.service_url
|
82
82
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_form_extension
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Glyph-fr
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -163,7 +163,7 @@ homepage: http://www.glyph.fr
|
|
163
163
|
licenses:
|
164
164
|
- MIT
|
165
165
|
metadata: {}
|
166
|
-
post_install_message:
|
166
|
+
post_install_message:
|
167
167
|
rdoc_options: []
|
168
168
|
require_paths:
|
169
169
|
- lib
|
@@ -178,9 +178,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
178
178
|
- !ruby/object:Gem::Version
|
179
179
|
version: '0'
|
180
180
|
requirements: []
|
181
|
-
|
182
|
-
|
183
|
-
signing_key:
|
181
|
+
rubygems_version: 3.3.7
|
182
|
+
signing_key:
|
184
183
|
specification_version: 4
|
185
184
|
summary: This gems adds custom common input types to simple form.
|
186
185
|
test_files: []
|