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 +4 -4
- data/lib/inputs/refile_input.rb +8 -1
- data/refile-input.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 415f22c2e06bccaf62e785b91dfa8f9dd11e1d76
|
4
|
+
data.tar.gz: a108ce3b31507dfaae33e83e4a4b3eb2d98b2478
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12ef261c9098c04a9755fc2ed874b965d6e7da6c8f2599e05d18e01472c6519ddc44c129b06b0633d7a8531eefaeed455115ac5e0003a79b3c2ab4aa86b3e398
|
7
|
+
data.tar.gz: 4b4e11806912ee85129c0c76db7fb11cf76da48394aaf8546ca931e396bf84dfd583f7ca13953aeb2b2cdf3b2968989c42657ab1a81c24332195dccc742e347e
|
data/lib/inputs/refile_input.rb
CHANGED
@@ -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
|
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"
|