simple_form_extension 1.4.9 → 1.4.10

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: f0338091f5342355cd9faac5bf9fbdf3e274e982
4
- data.tar.gz: c15a1a437cca0be6afd7550f22912fa8f828fac4
3
+ metadata.gz: c89c395024da3cde1e87ccc95adfb1678cb52882
4
+ data.tar.gz: 43534c24e64bd5bc4b96864bcbfdcf5036eaf3dd
5
5
  SHA512:
6
- metadata.gz: ab595dfbdf82e7e5667fbe2ad2ef08cafcf4202efca56fc85cefe7fa9b605a42cd353138d604565bf099609946b7ce46da61a916f4f3ea43fcd189a4e52ac58f
7
- data.tar.gz: 48243d079d49b90c8cc7b48ba9ca1c644c5aba7a126307e1922bae5c46cc454ef5be582df34d5f15f393eed12d774d300da27f116de9dff8fc148222e43ba92c
6
+ metadata.gz: aecd735784ba30acd94a755bbc160d8a9ff63c3af128ce548c03cef1559c87355193bcef5095062c0a41575753bc78e8e9f2ef9d0cc2d4225d7c6298b766885b
7
+ data.tar.gz: 1a3dba52ccb7200a5b732b8e84358ca6f6971d19b73dcd55a192b5789cc9999638ec1122e6293e3d92ed4cbed0541e84421a500c98c41cc0341164b0e23fd196
@@ -48,7 +48,8 @@ module SimpleFormExtension
48
48
  content_tag(:a, class: 'btn btn-default ', href: file_url, target: '_blank', data: { toggle: 'existing-file' }) do
49
49
  content_tag(:i, '', class: 'fa fa-file') +
50
50
  " ".html_safe +
51
- object.send(:"#{ attribute_name }_file_name").html_safe
51
+
52
+ existing_file_name
52
53
  end +
53
54
 
54
55
  remove_file_button
@@ -56,6 +57,16 @@ module SimpleFormExtension
56
57
  end
57
58
  end
58
59
 
60
+ def existing_file_name
61
+ return unless file_exists?
62
+
63
+ if object.try(:"#{ attribute_name }?")
64
+ object.send(:"#{ attribute_name }_file_name").html_safe
65
+ elsif (attachment = object.try(attribute_name)).try(:attached?)
66
+ attachment.filename.to_s
67
+ end
68
+ end
69
+
59
70
  def remove_file_button
60
71
  return unless object.respond_to?(:"#{ remove_attachment_method }=")
61
72
 
@@ -1,3 +1,3 @@
1
1
  module SimpleFormExtension
2
- VERSION = "1.4.9"
2
+ VERSION = "1.4.10"
3
3
  end
@@ -2,7 +2,7 @@ class Slider
2
2
  constructor: (@$el) ->
3
3
  value = if (values = @$el.data('slider-value')?.toString().split(','))
4
4
  if values.length <= 1
5
- value[0]
5
+ values[0]
6
6
  else
7
7
  (parseInt(value, 10) for value in values)
8
8
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_form_extension
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.9
4
+ version: 1.4.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Glyph-fr
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-18 00:00:00.000000000 Z
11
+ date: 2018-04-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails