h5_uploader 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem 'rack-raw-upload'
4
+ # Specify your gem's dependencies in uploader.gemspec
5
+ gemspec
6
+
data/README.md ADDED
@@ -0,0 +1,14 @@
1
+ Set up
2
+ ====
3
+
4
+ config/application.rb
5
+ ----
6
+
7
+ Add requre after the rails require statement
8
+
9
+ __require "rack-raw-upload"__
10
+
11
+ Add the middleware config
12
+
13
+ __config.middleware.use 'Rack::RawUpload'__
14
+
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
@@ -0,0 +1,3 @@
1
+ module Uploader
2
+ VERSION = "0.2.1"
3
+ end
data/lib/uploader.rb ADDED
@@ -0,0 +1,37 @@
1
+ require "uploader/version"
2
+
3
+ class ActionView::Helpers::FormBuilder
4
+
5
+ def uploader(method,*args)
6
+ options = args.extract_options!
7
+ options[:id] = field_id(method)
8
+ options[:action] ||= '/public/system/'
9
+ options[:allowedExtensions] ||= []
10
+
11
+ jss = "var uploader = new qq.FileUploader({"
12
+ jss = jss << "element: document.getElementById('#{options[:id]}'),"
13
+ jss = jss << "allowedExtensions: #{options[:allowedExtensions].to_s}"
14
+
15
+ options.each do |key,value| next if [:id,:allowedExtensions].include?(key)
16
+ jss = jss << ",#{key} : '#{value}'"
17
+ end
18
+
19
+ jss = jss << "});"
20
+
21
+ js_tag = @template.javascript_tag do
22
+ jss
23
+ end
24
+
25
+ @template.content_tag(:div,:id => options[:id]) do
26
+ @template.content_tag(:noscript) do
27
+ "no javascript"
28
+ end
29
+ end << js_tag
30
+
31
+ end
32
+
33
+ def field_id(label)
34
+ "field-uploader_#{label}"
35
+ end
36
+
37
+ end
data/uploader.gemspec ADDED
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "uploader/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "h5_uploader"
7
+ s.version = Uploader::VERSION
8
+ s.authors = ["Andrea Campolonghi"]
9
+ s.email = ["andrea.campolonghi@fractalgarden.com"]
10
+ s.homepage = ""
11
+ s.summary = "Multiple file uploads usign html5 techniques"
12
+ s.description = "Gem add a form builder called uploader that shows a button for multiple file uploads usign html5 techniques"
13
+
14
+ s.rubyforge_project = "h5_uploader"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ s.add_dependency 'rack-raw-upload'
22
+ end
metadata ADDED
@@ -0,0 +1,66 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: h5_uploader
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Andrea Campolonghi
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-07-05 00:00:00.000000000 +02:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rack-raw-upload
17
+ requirement: &2164795160 !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: '0'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: *2164795160
26
+ description: Gem add a form builder called uploader that shows a button for multiple
27
+ file uploads usign html5 techniques
28
+ email:
29
+ - andrea.campolonghi@fractalgarden.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - .gitignore
35
+ - Gemfile
36
+ - README.md
37
+ - Rakefile
38
+ - lib/uploader.rb
39
+ - lib/uploader/version.rb
40
+ - uploader.gemspec
41
+ has_rdoc: true
42
+ homepage: ''
43
+ licenses: []
44
+ post_install_message:
45
+ rdoc_options: []
46
+ require_paths:
47
+ - lib
48
+ required_ruby_version: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ required_rubygems_version: !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ! '>='
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
60
+ requirements: []
61
+ rubyforge_project: h5_uploader
62
+ rubygems_version: 1.6.2
63
+ signing_key:
64
+ specification_version: 3
65
+ summary: Multiple file uploads usign html5 techniques
66
+ test_files: []