pretty_file_input 0.0.4 → 0.0.5
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 +4 -4
- data/README.md +5 -0
- data/app/assets/javascripts/pretty_file_input.coffee +6 -2
- data/lib/pretty_file_input/version.rb +1 -1
- data/spec/dummy/spec/features/users_spec.rb +10 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d9d858237efdd985c2cd1783d782c5316279ddf0
|
4
|
+
data.tar.gz: b5c7be942739395b281ada54c05e164efcb2bad7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19808dec620c250d33bef54a691e473a1f1e27d8ec83e5b84ec16a3036ea3a5a243f7777c1438fff9c241f8ab720861e7117aff53d0cefd8a62037e2d6ab794c
|
7
|
+
data.tar.gz: f6d3e7a4d34c544403c25d4bfcbe309ced7f12d57bf9411534eff8c276750d49849cb310dc2e6e476ce27e00b39914b661c76193e816aee7c1c56ba9215fae90
|
data/README.md
CHANGED
@@ -63,6 +63,11 @@ action: nil, # override the parent form's action
|
|
63
63
|
additional_params: {} # additional parameters to be sent to server with each request
|
64
64
|
```
|
65
65
|
|
66
|
+
### Events
|
67
|
+
|
68
|
+
- `pfi:uploaded`
|
69
|
+
- `pfi:removed`
|
70
|
+
|
66
71
|
## License
|
67
72
|
|
68
73
|
[MIT](http://dobtco.mit-license.org/)
|
@@ -41,7 +41,9 @@
|
|
41
41
|
else
|
42
42
|
@$input.val('')
|
43
43
|
|
44
|
-
@$el.
|
44
|
+
@$el.
|
45
|
+
removeClass('is_uploaded').
|
46
|
+
trigger('pfi:removed')
|
45
47
|
|
46
48
|
_baseParams: ->
|
47
49
|
$.extend { pretty_file_input: true }, @options.additionalParams
|
@@ -98,7 +100,9 @@
|
|
98
100
|
@options.additionalParams = data.additionalParams
|
99
101
|
|
100
102
|
@$status.text('')
|
101
|
-
@$el.
|
103
|
+
@$el.
|
104
|
+
addClass('is_uploaded').
|
105
|
+
trigger('pfi:uploaded')
|
102
106
|
|
103
107
|
_uploadError: ->
|
104
108
|
@$status.text 'Error'
|
@@ -38,5 +38,15 @@ describe 'Users', js: true, type: :feature do
|
|
38
38
|
find('a', text: 'Remove').click
|
39
39
|
expect(user.reload.avatar).to be_blank
|
40
40
|
end
|
41
|
+
|
42
|
+
it 'adds after removal' do
|
43
|
+
visit edit_user_path(user)
|
44
|
+
find('a', text: 'Remove').click
|
45
|
+
expect(user.reload.avatar).to be_blank
|
46
|
+
find('input[type=file]').set "#{Rails.root}/spec/fixtures/avatar2.jpg"
|
47
|
+
sleep 1
|
48
|
+
expect(user.reload.avatar).to_not be_blank
|
49
|
+
expect(user.avatar.file.filename).to eq 'avatar2.jpg'
|
50
|
+
end
|
41
51
|
end
|
42
52
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pretty_file_input
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Becker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: coffee-script
|