effective_assets 1.4.4 → 1.4.5

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
  SHA1:
3
- metadata.gz: 13e90b35a299db09418e02d1c372631beb2b4360
4
- data.tar.gz: 024fda44ceeca5d6b56c0d18974a3dbffeda030f
3
+ metadata.gz: c1fcdebea3667fcd0b685eca34f302fa1c5ebe1f
4
+ data.tar.gz: d1a1fa5ef1411daaa764eaed86668da9d2a8909e
5
5
  SHA512:
6
- metadata.gz: e4c98bfc63977679f27e210f05d3d18b092de03bc240f0caadc363409ad7959856cebaab34e1ef2fc83096181b482260ccf02adbc08b847867e4435a85b9842a
7
- data.tar.gz: 89218d7e52c5ab43cadeb1f90a7aaee039a046974f5672edd9ddd577e40e8cd4298e5dd695159ad9475d362432535fc97db715a832ca82dc88fa00f85c6faf6a
6
+ metadata.gz: e8313d1a73003ea04a41b9164945270193bf30907525712730ec9614cadc9776f3a36e0afa6bd15fe54dd26024c700bfd0d492d919c8d31c359a8bf9d8781020
7
+ data.tar.gz: 41d2427c43c0461a0fe4c005cf21de28c364fec1328d4d3e6b5c3024d3f9e6ba3cb85e08f9c992ba03c5df774f88ac72861d7a1a1907b32101e05c6222d2455d
@@ -3,34 +3,22 @@ $(document).on 's3_file_added', (event, file) ->
3
3
  obj.closest('.error').removeClass('error')
4
4
  obj.parent().siblings('.help-inline,.inline-errors').remove()
5
5
 
6
- $(document).on 's3_uploads_complete', (_, uploader) ->
6
+ $(document).on 's3_uploads_complete', (_, uploader) ->
7
7
  uploader.closest('.asset-box-input').find('.filter-attachments').val('')
8
8
 
9
- $(document).on 's3_upload_failed', (_, uploader, content) ->
9
+ $(document).on 's3_upload_failed', (_, uploader, content) ->
10
10
  uploader.closest('.asset-box-input').find('.filter-attachments').val('')
11
11
  alert("An error occurred while uploading #{content.filename}.\n\nThe returned error message is: '#{content.error_thrown}'\n\nPlease try again.")
12
12
 
13
13
  $(document).on 'click', 'a.attachment-remove', (event) ->
14
14
  event.preventDefault()
15
- attachment_div = $(event.target).closest('.attachment')
16
-
17
- attachment_div.find('input.asset-box-remove').first().val(1)
18
- attachment_div.hide()
19
-
20
- # Show the first 'limit' attachments, hide the rest
21
- asset_box_input = attachment_div.closest('div.asset-box-input')
22
- limit = asset_box_input.data('limit')
23
-
24
- asset_box_input.find("input.asset-box-remove").each (index) ->
25
- if "#{$(this).val()}" == '1' # If we're going to delete it...
26
- $(this).closest('.attachment').hide()
27
- limit = limit + 1
28
- return
29
-
30
- if index >= limit
31
- $(this).closest('.attachment').hide()
32
- else
33
- $(this).closest('.attachment').show()
15
+ $attachmentDiv = $(event.target).closest('.attachment')
34
16
 
17
+ $attachmentDiv.find('input.asset-box-remove').first().val(1)
18
+ $attachmentDiv.hide()
35
19
 
20
+ # Correct the attachment count
21
+ $assetBoxInput = $attachmentDiv.closest('div.asset-box-input')
22
+ count = parseInt($assetBoxInput.attr('data-attachment-count'), 10)
23
+ $assetBoxInput.attr('data-attachment-count', count - 1)
36
24
 
@@ -1,3 +1,3 @@
1
1
  module EffectiveAssets
2
- VERSION = '1.4.4'.freeze
2
+ VERSION = '1.4.5'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_assets
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.4
4
+ version: 1.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect