refile-input 0.0.5 → 0.1.0

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: 50c568869da5939c8608749db716d01bd0b9b202
4
- data.tar.gz: 149de7ac465d3999a06bb8e07a52885512471218
3
+ metadata.gz: 415f22c2e06bccaf62e785b91dfa8f9dd11e1d76
4
+ data.tar.gz: a108ce3b31507dfaae33e83e4a4b3eb2d98b2478
5
5
  SHA512:
6
- metadata.gz: 2b83699825e9404253e32a0d32db60568cceec5186a3caf5bdc7828753b71c97602a1e51a1279481cd38429642f51871aabbd8ca323a9003d32c08eb2d06b78e
7
- data.tar.gz: a382f57046eafe3543dd011b40e211e133aa82352af3fca5930808c0f3f6bbc441152ed9e3944456a225d9497e5b8187210fd875d040af27743993379a025729
6
+ metadata.gz: 12ef261c9098c04a9755fc2ed874b965d6e7da6c8f2599e05d18e01472c6519ddc44c129b06b0633d7a8531eefaeed455115ac5e0003a79b3c2ab4aa86b3e398
7
+ data.tar.gz: 4b4e11806912ee85129c0c76db7fb11cf76da48394aaf8546ca931e396bf84dfd583f7ca13953aeb2b2cdf3b2968989c42657ab1a81c24332195dccc742e347e
@@ -1,6 +1,13 @@
1
1
  class RefileInput < Formtastic::Inputs::FileInput
2
+ def initialize *args
3
+ super
4
+
5
+ @reference = SecureRandom.hex
6
+ end
7
+
2
8
  def file_input_html_options
3
9
  options[:data] ||= {}
10
+ options[:data][:reference] = @reference
4
11
 
5
12
  attacher = object.send(:"#{method}_attacher")
6
13
  options[:accept] = attacher.definition.accept
@@ -23,7 +30,7 @@ class RefileInput < Formtastic::Inputs::FileInput
23
30
 
24
31
  def hidden_input_html_options
25
32
  attacher = object.send(:"#{method}_attacher")
26
- { value: attacher.data.to_json, object: object, id: nil }
33
+ { value: attacher.data.to_json, object: object, id: nil, data: { reference: @reference } }
27
34
  end
28
35
 
29
36
  def to_html
data/refile-input.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'refile-input'
3
3
  s.license = 'MIT'
4
- s.version = '0.0.5'
4
+ s.version = '0.1.0'
5
5
  s.authors = ["Petr Sergeev", "Sindre Moen"]
6
6
  s.email = ["peter@hyper.no", "sindre@hyper.no"]
7
7
  s.description = "This adds custom input to support refile file uploader to formtastic form builder"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: refile-input
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Petr Sergeev