simple_form_bs5_file_input 0.1.0 → 0.1.2

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: 4c7f32784a219e9326ff640f76a864f434aa34d8bb2936ccc22e140bfe72f006
4
- data.tar.gz: 465e669be8ed5a5060f00fae95ae7c571b32722fac8a9c3d57ada79bc805cd30
3
+ metadata.gz: 439120eb0e6d62259b113e3311f1caed4f298cbd87e6e6ca33f6c9bab2ef7d81
4
+ data.tar.gz: 5b12e73dc2d4e2148ca0bfb70a434af18cbe8fecf45316374cc4ad50aaba912e
5
5
  SHA512:
6
- metadata.gz: 50c751cf9d272564b8b20361a5a5cb99cff4cded81ff3588628d401622c8e6629a867b54d2bcea6fb239c7d15c86ad6996902eac41b8fd44d3b5a4ecf19a7e38
7
- data.tar.gz: 76f2cb77c249430a710c610d2586267e2d066c39f9febad088d830599cba0cdaed7d80a3013e963d653b75ecccb486619030fc2f17e9b4fcc86d9a8f16cb721b
6
+ metadata.gz: 0a082f4b129046db5f0f3a1aa25d69f0363943105055caa6b1dbc624816d528517f861ccc1c9ff0f9ad7a2432633be7b7eab7b3ebf1aee25ece783c8403dc081
7
+ data.tar.gz: 4a671fa1b1db17903a9ce3f4b79ad198027cfeca95831f53694a04e440fdf31318cada8f79270851c2ebe37756cab563c4ab878b9bc2bff3478dc18fc36186c1
data/Gemfile.lock CHANGED
@@ -1,173 +1,210 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- simple_form_bs5_file_input (0.1.0)
4
+ simple_form_bs5_file_input (0.1.2)
5
5
  rails
6
6
  simple_form
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- actioncable (7.0.3)
12
- actionpack (= 7.0.3)
13
- activesupport (= 7.0.3)
11
+ actioncable (7.1.1)
12
+ actionpack (= 7.1.1)
13
+ activesupport (= 7.1.1)
14
14
  nio4r (~> 2.0)
15
15
  websocket-driver (>= 0.6.1)
16
- actionmailbox (7.0.3)
17
- actionpack (= 7.0.3)
18
- activejob (= 7.0.3)
19
- activerecord (= 7.0.3)
20
- activestorage (= 7.0.3)
21
- activesupport (= 7.0.3)
16
+ zeitwerk (~> 2.6)
17
+ actionmailbox (7.1.1)
18
+ actionpack (= 7.1.1)
19
+ activejob (= 7.1.1)
20
+ activerecord (= 7.1.1)
21
+ activestorage (= 7.1.1)
22
+ activesupport (= 7.1.1)
22
23
  mail (>= 2.7.1)
23
24
  net-imap
24
25
  net-pop
25
26
  net-smtp
26
- actionmailer (7.0.3)
27
- actionpack (= 7.0.3)
28
- actionview (= 7.0.3)
29
- activejob (= 7.0.3)
30
- activesupport (= 7.0.3)
27
+ actionmailer (7.1.1)
28
+ actionpack (= 7.1.1)
29
+ actionview (= 7.1.1)
30
+ activejob (= 7.1.1)
31
+ activesupport (= 7.1.1)
31
32
  mail (~> 2.5, >= 2.5.4)
32
33
  net-imap
33
34
  net-pop
34
35
  net-smtp
35
- rails-dom-testing (~> 2.0)
36
- actionpack (7.0.3)
37
- actionview (= 7.0.3)
38
- activesupport (= 7.0.3)
39
- rack (~> 2.0, >= 2.2.0)
36
+ rails-dom-testing (~> 2.2)
37
+ actionpack (7.1.1)
38
+ actionview (= 7.1.1)
39
+ activesupport (= 7.1.1)
40
+ nokogiri (>= 1.8.5)
41
+ rack (>= 2.2.4)
42
+ rack-session (>= 1.0.1)
40
43
  rack-test (>= 0.6.3)
41
- rails-dom-testing (~> 2.0)
42
- rails-html-sanitizer (~> 1.0, >= 1.2.0)
43
- actiontext (7.0.3)
44
- actionpack (= 7.0.3)
45
- activerecord (= 7.0.3)
46
- activestorage (= 7.0.3)
47
- activesupport (= 7.0.3)
44
+ rails-dom-testing (~> 2.2)
45
+ rails-html-sanitizer (~> 1.6)
46
+ actiontext (7.1.1)
47
+ actionpack (= 7.1.1)
48
+ activerecord (= 7.1.1)
49
+ activestorage (= 7.1.1)
50
+ activesupport (= 7.1.1)
48
51
  globalid (>= 0.6.0)
49
52
  nokogiri (>= 1.8.5)
50
- actionview (7.0.3)
51
- activesupport (= 7.0.3)
53
+ actionview (7.1.1)
54
+ activesupport (= 7.1.1)
52
55
  builder (~> 3.1)
53
- erubi (~> 1.4)
54
- rails-dom-testing (~> 2.0)
55
- rails-html-sanitizer (~> 1.1, >= 1.2.0)
56
- activejob (7.0.3)
57
- activesupport (= 7.0.3)
56
+ erubi (~> 1.11)
57
+ rails-dom-testing (~> 2.2)
58
+ rails-html-sanitizer (~> 1.6)
59
+ activejob (7.1.1)
60
+ activesupport (= 7.1.1)
58
61
  globalid (>= 0.3.6)
59
- activemodel (7.0.3)
60
- activesupport (= 7.0.3)
61
- activerecord (7.0.3)
62
- activemodel (= 7.0.3)
63
- activesupport (= 7.0.3)
64
- activestorage (7.0.3)
65
- actionpack (= 7.0.3)
66
- activejob (= 7.0.3)
67
- activerecord (= 7.0.3)
68
- activesupport (= 7.0.3)
62
+ activemodel (7.1.1)
63
+ activesupport (= 7.1.1)
64
+ activerecord (7.1.1)
65
+ activemodel (= 7.1.1)
66
+ activesupport (= 7.1.1)
67
+ timeout (>= 0.4.0)
68
+ activestorage (7.1.1)
69
+ actionpack (= 7.1.1)
70
+ activejob (= 7.1.1)
71
+ activerecord (= 7.1.1)
72
+ activesupport (= 7.1.1)
69
73
  marcel (~> 1.0)
70
- mini_mime (>= 1.1.0)
71
- activesupport (7.0.3)
74
+ activesupport (7.1.1)
75
+ base64
76
+ bigdecimal
72
77
  concurrent-ruby (~> 1.0, >= 1.0.2)
78
+ connection_pool (>= 2.2.5)
79
+ drb
73
80
  i18n (>= 1.6, < 2)
74
81
  minitest (>= 5.1)
82
+ mutex_m
75
83
  tzinfo (~> 2.0)
76
- autoprefixer-rails (10.4.7.0)
84
+ autoprefixer-rails (10.4.15.0)
77
85
  execjs (~> 2)
78
- bcrypt (3.1.18)
79
- bootsnap (1.11.1)
86
+ base64 (0.1.1)
87
+ bcrypt (3.1.19)
88
+ bigdecimal (3.1.4)
89
+ bootsnap (1.16.0)
80
90
  msgpack (~> 1.2)
81
- bootstrap (5.1.3)
91
+ bootstrap (5.3.1)
82
92
  autoprefixer-rails (>= 9.1.0)
83
- popper_js (>= 2.9.3, < 3)
93
+ popper_js (>= 2.11.8, < 3)
84
94
  sassc-rails (>= 2.0.0)
85
95
  builder (3.2.4)
86
- concurrent-ruby (1.1.10)
96
+ concurrent-ruby (1.2.2)
97
+ connection_pool (2.4.1)
87
98
  crass (1.0.6)
88
- devise (4.8.1)
99
+ date (3.3.3)
100
+ devise (4.9.3)
89
101
  bcrypt (~> 3.0)
90
102
  orm_adapter (~> 0.1)
91
103
  railties (>= 4.1.0)
92
104
  responders
93
105
  warden (~> 1.2.3)
94
- erubi (1.10.0)
95
- execjs (2.8.1)
96
- ffi (1.15.5)
97
- globalid (1.0.0)
98
- activesupport (>= 5.0)
99
- i18n (1.10.0)
106
+ drb (2.1.1)
107
+ ruby2_keywords
108
+ erubi (1.12.0)
109
+ execjs (2.9.1)
110
+ ffi (1.16.3)
111
+ globalid (1.2.1)
112
+ activesupport (>= 6.1)
113
+ i18n (1.14.1)
100
114
  concurrent-ruby (~> 1.0)
101
- jquery-rails (4.5.0)
115
+ io-console (0.6.0)
116
+ irb (1.8.1)
117
+ rdoc
118
+ reline (>= 0.3.8)
119
+ jquery-rails (4.6.0)
102
120
  rails-dom-testing (>= 1, < 3)
103
121
  railties (>= 4.2.0)
104
122
  thor (>= 0.14, < 2.0)
105
- listen (3.7.1)
123
+ listen (3.8.0)
106
124
  rb-fsevent (~> 0.10, >= 0.10.3)
107
125
  rb-inotify (~> 0.9, >= 0.9.10)
108
- loofah (2.18.0)
126
+ loofah (2.21.4)
109
127
  crass (~> 1.0.2)
110
- nokogiri (>= 1.5.9)
111
- mail (2.7.1)
128
+ nokogiri (>= 1.12.0)
129
+ mail (2.8.1)
112
130
  mini_mime (>= 0.1.1)
131
+ net-imap
132
+ net-pop
133
+ net-smtp
113
134
  marcel (1.0.2)
114
- method_source (1.0.0)
115
- mini_mime (1.1.2)
116
- mini_portile2 (2.8.0)
117
- minitest (5.15.0)
118
- msgpack (1.5.2)
119
- net-imap (0.3.1)
135
+ mini_mime (1.1.5)
136
+ mini_portile2 (2.8.4)
137
+ minitest (5.20.0)
138
+ msgpack (1.7.2)
139
+ mutex_m (0.1.2)
140
+ net-imap (0.4.1)
141
+ date
120
142
  net-protocol
121
143
  net-pop (0.1.2)
122
144
  net-protocol
123
- net-protocol (0.1.3)
145
+ net-protocol (0.2.1)
124
146
  timeout
125
- net-smtp (0.3.3)
147
+ net-smtp (0.4.0)
126
148
  net-protocol
127
- nio4r (2.5.8)
128
- nokogiri (1.13.6)
129
- mini_portile2 (~> 2.8.0)
149
+ nio4r (2.5.9)
150
+ nokogiri (1.15.4)
151
+ mini_portile2 (~> 2.8.2)
130
152
  racc (~> 1.4)
131
153
  orm_adapter (0.5.0)
132
- pg (1.3.5)
133
- popper_js (2.9.3)
134
- racc (1.6.0)
135
- rack (2.2.3.1)
136
- rack-test (1.1.0)
137
- rack (>= 1.0, < 3)
138
- rails (7.0.3)
139
- actioncable (= 7.0.3)
140
- actionmailbox (= 7.0.3)
141
- actionmailer (= 7.0.3)
142
- actionpack (= 7.0.3)
143
- actiontext (= 7.0.3)
144
- actionview (= 7.0.3)
145
- activejob (= 7.0.3)
146
- activemodel (= 7.0.3)
147
- activerecord (= 7.0.3)
148
- activestorage (= 7.0.3)
149
- activesupport (= 7.0.3)
154
+ pg (1.5.4)
155
+ popper_js (2.11.8)
156
+ psych (5.1.1)
157
+ stringio
158
+ racc (1.7.1)
159
+ rack (3.0.8)
160
+ rack-session (2.0.0)
161
+ rack (>= 3.0.0)
162
+ rack-test (2.1.0)
163
+ rack (>= 1.3)
164
+ rackup (2.1.0)
165
+ rack (>= 3)
166
+ webrick (~> 1.8)
167
+ rails (7.1.1)
168
+ actioncable (= 7.1.1)
169
+ actionmailbox (= 7.1.1)
170
+ actionmailer (= 7.1.1)
171
+ actionpack (= 7.1.1)
172
+ actiontext (= 7.1.1)
173
+ actionview (= 7.1.1)
174
+ activejob (= 7.1.1)
175
+ activemodel (= 7.1.1)
176
+ activerecord (= 7.1.1)
177
+ activestorage (= 7.1.1)
178
+ activesupport (= 7.1.1)
150
179
  bundler (>= 1.15.0)
151
- railties (= 7.0.3)
152
- rails-dom-testing (2.0.3)
153
- activesupport (>= 4.2.0)
180
+ railties (= 7.1.1)
181
+ rails-dom-testing (2.2.0)
182
+ activesupport (>= 5.0.0)
183
+ minitest
154
184
  nokogiri (>= 1.6)
155
- rails-html-sanitizer (1.4.2)
156
- loofah (~> 2.3)
157
- railties (7.0.3)
158
- actionpack (= 7.0.3)
159
- activesupport (= 7.0.3)
160
- method_source
185
+ rails-html-sanitizer (1.6.0)
186
+ loofah (~> 2.21)
187
+ nokogiri (~> 1.14)
188
+ railties (7.1.1)
189
+ actionpack (= 7.1.1)
190
+ activesupport (= 7.1.1)
191
+ irb
192
+ rackup (>= 1.0.0)
161
193
  rake (>= 12.2)
162
- thor (~> 1.0)
163
- zeitwerk (~> 2.5)
194
+ thor (~> 1.0, >= 1.2.2)
195
+ zeitwerk (~> 2.6)
164
196
  rake (13.0.6)
165
- rb-fsevent (0.11.1)
197
+ rb-fsevent (0.11.2)
166
198
  rb-inotify (0.10.1)
167
199
  ffi (~> 1.0)
168
- responders (3.0.1)
169
- actionpack (>= 5.0)
170
- railties (>= 5.0)
200
+ rdoc (6.5.0)
201
+ psych (>= 4.0.0)
202
+ reline (0.3.9)
203
+ io-console (~> 0.5)
204
+ responders (3.1.1)
205
+ actionpack (>= 5.2)
206
+ railties (>= 5.2)
207
+ ruby2_keywords (0.0.5)
171
208
  sassc (2.4.0)
172
209
  ffi (~> 1.9)
173
210
  sassc-rails (2.1.2)
@@ -176,28 +213,31 @@ GEM
176
213
  sprockets (> 3.0)
177
214
  sprockets-rails
178
215
  tilt
179
- simple_form (5.1.0)
216
+ simple_form (5.3.0)
180
217
  actionpack (>= 5.2)
181
218
  activemodel (>= 5.2)
182
- sprockets (4.0.3)
219
+ sprockets (4.2.1)
183
220
  concurrent-ruby (~> 1.0)
184
- rack (> 1, < 3)
221
+ rack (>= 2.2.4, < 4)
185
222
  sprockets-rails (3.4.2)
186
223
  actionpack (>= 5.2)
187
224
  activesupport (>= 5.2)
188
225
  sprockets (>= 3.0.0)
189
- sqlite3 (1.4.2)
190
- thor (1.2.1)
191
- tilt (2.0.10)
192
- timeout (0.3.0)
193
- tzinfo (2.0.4)
226
+ sqlite3 (1.6.7)
227
+ mini_portile2 (~> 2.8.0)
228
+ stringio (3.0.8)
229
+ thor (1.2.2)
230
+ tilt (2.3.0)
231
+ timeout (0.4.0)
232
+ tzinfo (2.0.6)
194
233
  concurrent-ruby (~> 1.0)
195
234
  warden (1.2.9)
196
235
  rack (>= 2.0.9)
197
- websocket-driver (0.7.5)
236
+ webrick (1.8.1)
237
+ websocket-driver (0.7.6)
198
238
  websocket-extensions (>= 0.1.0)
199
239
  websocket-extensions (0.1.5)
200
- zeitwerk (2.5.4)
240
+ zeitwerk (2.6.12)
201
241
 
202
242
  PLATFORMS
203
243
  ruby
@@ -17,6 +17,8 @@ window.inputSingleDeletableFile = {
17
17
  $resizeModal = $('.js-sdfi-deletable-file__resize', $scope),
18
18
  files = this.files,
19
19
  file,
20
+ isResizable,
21
+ isPreviewable,
20
22
  hasPreview = $('.js-sdfi-deletable-file__preview', $scope).length > 0,
21
23
  hasResize = $resizeModal.length > 0,
22
24
  modal,
@@ -28,19 +30,14 @@ window.inputSingleDeletableFile = {
28
30
  }
29
31
 
30
32
  file = files[0];
33
+ isResizable = (/^image\/(png|jpeg)+$/).test(file.type);
34
+ isPreviewable = (/^image\/[a-z+]+$/).test(file.type);
31
35
 
32
- if (!hasResize) {
33
- // name display is delayed if we need to resize
34
- $scope.addClass('sdfi-deletable-file--with-file');
35
- $('.js-sdfi-deletable-file__label', $scope).html(file.name);
36
- $('.js-sdfi-deletable-file__delete-field', $scope).val('');
37
- }
38
-
39
-
40
- if (/^image\/[a-z+]+$/.test(file.type) && (hasResize || hasPreview)) {
36
+ if (isResizable && hasResize || isPreviewable && hasPreview) {
41
37
  reader = new FileReader();
42
38
  reader.readAsDataURL(file);
43
- if (hasResize) {
39
+ if (isResizable && hasResize) {
40
+ // Resizable images
44
41
  reader.onload = function () {
45
42
  modal = new bootstrap.Modal($resizeModal, {
46
43
  backdrop: 'static',
@@ -50,13 +47,25 @@ window.inputSingleDeletableFile = {
50
47
  $resizeModal.attr('data-filename', file.name);
51
48
  modal.show();
52
49
  };
53
- } else if (hasPreview) {
50
+ } else {
51
+ // Previewable images
52
+ $('.js-sdfi-deletable-file__infos-field', $scope).val('');
53
+ $scope.addClass('sdfi-deletable-file--with-file');
54
+ $('.js-sdfi-deletable-file__label', $scope).html(file.name);
55
+ $('.js-sdfi-deletable-file__delete-field', $scope).val('');
54
56
  size = $('.js-sdfi-deletable-file__preview', $scope).attr('data-size')
55
57
  .split('x');
56
58
  reader.onload = function (e) {
57
59
  $('.js-sdfi-deletable-file__preview', $scope).html('<img src="' + e.target.result + '" width="' + size[0] + '" height="auto" class="img-fluid img-thumbnail">');
58
60
  };
59
61
  }
62
+ } else {
63
+ // Non-resizable and non-previewable files
64
+ $('.js-sdfi-deletable-file__infos-field', $scope).val('');
65
+ $scope.addClass('sdfi-deletable-file--with-file');
66
+ $('.js-sdfi-deletable-file__label', $scope).html(file.name);
67
+ $('.js-sdfi-deletable-file__delete-field', $scope).val('');
68
+ $('.js-sdfi-deletable-file__preview', $scope).html('');
60
69
  }
61
70
  },
62
71
 
@@ -1,3 +1,3 @@
1
1
  module SimpleFormBs5FileInput
2
- VERSION = "0.1.0".freeze
2
+ VERSION = "0.1.2".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.1.0
4
+ version: 0.1.2
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-11-28 00:00:00.000000000 Z
11
+ date: 2023-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -89,15 +89,12 @@ files:
89
89
  - lib/simple_form_bs5_file_input.rb
90
90
  - lib/simple_form_bs5_file_input/single_deletable_file_input.rb
91
91
  - lib/simple_form_bs5_file_input/version.rb
92
- - pkg/simple_form_bs5_file_input-0.0.1.gem
93
- - pkg/simple_form_bs5_file_input-0.0.2.gem
94
- - pkg/simple_form_bs5_file_input-0.0.3.gem
95
92
  - simple_form_bs5_file_input.gemspec
96
93
  homepage: https://github.com/noesya/simple_form_bs5_file_input
97
94
  licenses:
98
95
  - MIT
99
96
  metadata: {}
100
- post_install_message:
97
+ post_install_message:
101
98
  rdoc_options: []
102
99
  require_paths:
103
100
  - lib
@@ -112,8 +109,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
112
109
  - !ruby/object:Gem::Version
113
110
  version: '0'
114
111
  requirements: []
115
- rubygems_version: 3.1.4
116
- signing_key:
112
+ rubygems_version: 3.4.13
113
+ signing_key:
117
114
  specification_version: 4
118
115
  summary: Simple Form BS5 File Input
119
116
  test_files: []