simple_form_bs5_file_input 0.1.6 → 0.2.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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 76ba13ef60f2f906d584bb3ab3de58a0aac7988dcf5217e85b117eeb0bf50ea4
|
|
4
|
+
data.tar.gz: aa98b74d4577a3e45952c0071fa8609653ed41d38650ebaca58f578af30364f9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6c96e619a6a5dd7a43c6be6b45916fecee5adeaa119e86133877a0182656dc392558636c859966ade7076ea2542a4d220187c112d3b214176f8f4ea062e6cf90
|
|
7
|
+
data.tar.gz: f36e2e36f3af1dec08f19fd89a2fdf59409107ba47cb3e1e36430f2a7f729a34004468e46302bbc3c61b697e61112a23b0be8f84c8b9248128b184785bd459ee
|
data/Gemfile.lock
CHANGED
|
@@ -34,18 +34,31 @@ class ActiveRecord::Base
|
|
|
34
34
|
# reset the infos to prevent multiple resize if multiple save
|
|
35
35
|
instance_variable_set :"@#{name}_infos", nil
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
37
|
+
left = params['x'].round
|
|
38
|
+
top = params['y'].round
|
|
39
|
+
width = params['width'].round
|
|
40
|
+
height = params['height'].round
|
|
41
|
+
rotation = params['rotate']
|
|
42
|
+
transformations = {}
|
|
43
|
+
byebug
|
|
44
|
+
if ActiveStorage.variant_processor == :mini_magick
|
|
45
|
+
# From Rails 6, ImageProcessing with MiniMagick uses an 'auto-orient' by default to interpret the EXIF Orientation metadata.
|
|
46
|
+
transformations[:'auto-orient'] = true
|
|
47
|
+
# Handle rotation
|
|
48
|
+
transformations[:rotate] = rotation if rotation.present?
|
|
49
|
+
# Handle cropping
|
|
50
|
+
transformations[:crop] = "#{width}x#{height}+#{left}+#{top}"
|
|
51
|
+
# Finalize by repaging
|
|
52
|
+
transformations.merge!({
|
|
53
|
+
repage: true,
|
|
54
|
+
:'+' => true
|
|
55
|
+
})
|
|
56
|
+
elsif ActiveStorage.variant_processor == :vips
|
|
57
|
+
# Handle rotation
|
|
58
|
+
transformations[:rotate] = rotation if rotation.present?
|
|
59
|
+
# Handle cropping
|
|
60
|
+
transformations[:crop] = [left, top, width, height]
|
|
61
|
+
end
|
|
49
62
|
|
|
50
63
|
variant = Rails::VERSION::MAJOR >= 6 ? send(name).variant(**transformations)
|
|
51
64
|
: send(name).variant(combine_options: transformations)
|
|
@@ -135,7 +135,7 @@ class SingleDeletableFileInput < SimpleForm::Inputs::Base
|
|
|
135
135
|
return unless should_display_file?
|
|
136
136
|
# Fichier invariable, pas de chocolat non plus
|
|
137
137
|
return unless file_attachment&.variable?
|
|
138
|
-
variant = file_attachment.variant(
|
|
138
|
+
variant = file_attachment.variant(resize_to_fit: [preview_image_width, nil])
|
|
139
139
|
path = url_helpers.polymorphic_url variant, only_path: true
|
|
140
140
|
image_tag path, class: 'img-fluid img-thumbnail', width: preview_image_width
|
|
141
141
|
end
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: simple_form_bs5_file_input
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Pierre-andré Boissinot
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: rails
|
|
@@ -107,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
107
107
|
- !ruby/object:Gem::Version
|
|
108
108
|
version: '0'
|
|
109
109
|
requirements: []
|
|
110
|
-
rubygems_version: 3.6.
|
|
110
|
+
rubygems_version: 3.6.9
|
|
111
111
|
specification_version: 4
|
|
112
112
|
summary: Simple Form BS5 File Input
|
|
113
113
|
test_files: []
|