simple_form_bs5_file_input 0.0.5 → 0.0.7

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: ce2c3270b2eca308b30ab139a6c4c8df318b424f625f8c6960689a2a800bc5d0
4
- data.tar.gz: cd16c846ae93111c0e24b4679300cd01c3fc8dd57b392ac311841f7615f71bd4
3
+ metadata.gz: a8d494c48e5c5e83b8eb9ceecddff74c2326585a270dad9af472b1a3c3dfcca0
4
+ data.tar.gz: 0b4dfe0fc0d349880060d23d98ff402d2cb54b75a293a62264ada3b8f3f48762
5
5
  SHA512:
6
- metadata.gz: 29bf87c40cc7d39872d0f0849e5b205dc50853545cbd4bde6b601ae6cae9b874391cc94362e2faaadc509090764a4b4b7a98a73d2a5549ac95ba2840c51ea210
7
- data.tar.gz: 3f626b446645c0ee7f0f82cc97683497d9378ac93b97afc632e62b364e477f13b5af9ca33041088262055389274a5de14fdd47f5df7e47789f64d5ef60a20b26
6
+ metadata.gz: d7a46f3bf31605f9232fcc9a29081471fdac8a89734212b165afdc965759708dbdcfd3a1f16ac23118e5105c0b7f260617f4d18a52990fdc6d1ce208a813aa26
7
+ data.tar.gz: cb14c8ce8f5b21d73a02719ec51e935ae4b2e79e84c7e7eaeb106991623cb19add4237a39f67f1c936f6cddf0148cb135787dc8d6c876dc38ca4431a42f6616f
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- simple_form_bs5_file_input (0.0.5)
4
+ simple_form_bs5_file_input (0.0.7)
5
5
  rails
6
6
  simple_form
7
7
 
@@ -91,7 +91,6 @@ GEM
91
91
  railties (>= 4.1.0)
92
92
  responders
93
93
  warden (~> 1.2.3)
94
- digest (3.1.0)
95
94
  erubi (1.10.0)
96
95
  execjs (2.8.1)
97
96
  ffi (1.15.5)
@@ -117,20 +116,14 @@ GEM
117
116
  mini_portile2 (2.8.0)
118
117
  minitest (5.15.0)
119
118
  msgpack (1.5.2)
120
- net-imap (0.2.3)
121
- digest
119
+ net-imap (0.3.1)
122
120
  net-protocol
123
- strscan
124
- net-pop (0.1.1)
125
- digest
121
+ net-pop (0.1.2)
126
122
  net-protocol
127
- timeout
128
123
  net-protocol (0.1.3)
129
124
  timeout
130
- net-smtp (0.3.1)
131
- digest
125
+ net-smtp (0.3.3)
132
126
  net-protocol
133
- timeout
134
127
  nio4r (2.5.8)
135
128
  nokogiri (1.13.6)
136
129
  mini_portile2 (~> 2.8.0)
@@ -194,7 +187,6 @@ GEM
194
187
  activesupport (>= 5.2)
195
188
  sprockets (>= 3.0.0)
196
189
  sqlite3 (1.4.2)
197
- strscan (3.0.3)
198
190
  thor (1.2.1)
199
191
  tilt (2.0.10)
200
192
  timeout (0.3.0)
@@ -36,7 +36,8 @@ window.inputSingleDeletableFile = {
36
36
  $('.js-sdfi-deletable-file__delete-field', $scope).val('');
37
37
  }
38
38
 
39
- if (/^image\/\w+$/.test(file.type) && (hasResize || hasPreview)) {
39
+
40
+ if (/^image\/[a-z+]+$/.test(file.type) && (hasResize || hasPreview)) {
40
41
  reader = new FileReader();
41
42
  reader.readAsDataURL(file);
42
43
  if (hasResize) {
@@ -52,9 +52,7 @@ class SingleDeletableFileInput < SimpleForm::Inputs::Base
52
52
  end
53
53
 
54
54
  def existing_file_name_or_default_text
55
- if should_display_file?
56
- "#{file_attachment.filename}"
57
- end
55
+ "#{file_attachment.filename}" if should_display_file?
58
56
  end
59
57
 
60
58
  def input_delete_name
@@ -122,7 +120,10 @@ class SingleDeletableFileInput < SimpleForm::Inputs::Base
122
120
  end
123
121
 
124
122
  def preview_image_tag
125
- return unless should_display_file? || file_attachment&.variable?
123
+ # Pas de fichier, pas de chocolat
124
+ return unless should_display_file?
125
+ # Fichier invariable, pas de chocolat non plus
126
+ return unless file_attachment&.variable?
126
127
  variant = file_attachment.variant(resize: "#{preview_image_width}x")
127
128
  path = url_helpers.polymorphic_url variant, only_path: true
128
129
  image_tag path, class: 'img-fluid img-thumbnail', width: preview_image_width
@@ -1,3 +1,3 @@
1
1
  module SimpleFormBs5FileInput
2
- VERSION = "0.0.5".freeze
2
+ VERSION = "0.0.7".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_form_bs5_file_input
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pierre-andré Boissinot
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-30 00:00:00.000000000 Z
11
+ date: 2022-11-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -97,7 +97,7 @@ homepage: https://github.com/noesya/simple_form_bs5_file_input
97
97
  licenses:
98
98
  - MIT
99
99
  metadata: {}
100
- post_install_message:
100
+ post_install_message:
101
101
  rdoc_options: []
102
102
  require_paths:
103
103
  - lib
@@ -112,8 +112,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
112
112
  - !ruby/object:Gem::Version
113
113
  version: '0'
114
114
  requirements: []
115
- rubygems_version: 3.1.6
116
- signing_key:
115
+ rubygems_version: 3.1.4
116
+ signing_key:
117
117
  specification_version: 4
118
118
  summary: Simple Form BS5 File Input
119
119
  test_files: []