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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b3d5e32cbb1e44ba41b65e260589c61dd7ef4361
4
- data.tar.gz: 311e4f034deac8fbd4bd9bfc68ad544e5b62d64e
3
+ metadata.gz: d9d858237efdd985c2cd1783d782c5316279ddf0
4
+ data.tar.gz: b5c7be942739395b281ada54c05e164efcb2bad7
5
5
  SHA512:
6
- metadata.gz: 4e8b3cea156e6dd097a756b839efaa3a005977b3c470191f6e97e76c24ec87425835c4f8cc274ad53437cdaa7e41d02ced583052385eaec8b696a448b7ee0af0
7
- data.tar.gz: c558b11e1549c9694fd7a525277c7f3088a5289fd9738d48b1cdde6751e56ce4b0b8a39939497f21b93679c4b583217d39b32f0c3db1edc764562c6c12144bc2
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.removeClass('is_uploaded')
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.addClass('is_uploaded')
103
+ @$el.
104
+ addClass('is_uploaded').
105
+ trigger('pfi:uploaded')
102
106
 
103
107
  _uploadError: ->
104
108
  @$status.text 'Error'
@@ -1,3 +1,3 @@
1
1
  module PrettyFileInput
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
3
3
  end
@@ -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
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-18 00:00:00.000000000 Z
11
+ date: 2015-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: coffee-script