uploader 0.2.4 → 0.2.5
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.
- data/README.rdoc +1 -1
- data/VERSION +1 -1
- data/app/controllers/uploader/uploads_controller.rb +74 -62
- data/app/helpers/uploader_helper.rb +1 -0
- data/app/views/uploads/_swf_javascript.html.erb +2 -2
- data/lib/active_record/acts/uploader_upload.rb +20 -1
- data/public/images/cancelbutton.gif +0 -0
- data/public/javascripts/swfupload/swfupload.js +102 -67
- data/public/javascripts/swfupload/swfupload.queue.js +79 -58
- data/public/javascripts/swfupload/swfupload.speed.js +342 -0
- data/public/javascripts/swfupload/swfupload.swfobject.js +4 -3
- data/public/stylesheets/swfupload.css +1 -1
- data/public/swf/swfupload.swf +0 -0
- data/rails/init.rb +3 -3
- data/test/rails_root/app/controllers/uploads_controller.rb +4 -0
- data/test/rails_root/config/environment.rb +3 -3
- data/test/rails_root/db/test.sqlite3 +0 -0
- data/test/rails_root/public/stylesheets/swfupload.css +1 -1
- data/test/rails_root/test/functional/uploads_controller_test.rb +53 -1
- data/test/rails_root/test/test.doc +0 -0
- data/test/rails_root/test/test.pdf +0 -0
- data/test/rails_root/test/test.xls +0 -0
- data/test/rails_root/test/test_helper.rb +5 -1
- data/uploader.gemspec +7 -2
- metadata +7 -2
@@ -22,5 +22,5 @@ div.uploadStatus{margin:5px;}
|
|
22
22
|
.swfupload_container a.progressCancel{font-size:0;display:block;height:14px;width:14px;background-image:url(../images/cancelbutton.gif);background-repeat:no-repeat;background-position:-14px 0px;float:right;}
|
23
23
|
.swfupload_container a.progressCancel:hover{background-position:0px 0px;}
|
24
24
|
|
25
|
-
.swf-error-msg{
|
25
|
+
.swf-error-msg{margin:1em 0;padding:10px 20px;border:solid 1px #FFDD99;background-color:#FFFFCC;overflow:hidden;}
|
26
26
|
.swf_cancel_button{margin-left: 2px; height: 22px; font-size: 8pt;}
|
@@ -24,6 +24,58 @@ class UploadsControllerTest < ActionController::TestCase
|
|
24
24
|
assert assigns(:upload).errors.empty?, assigns(:upload).errors
|
25
25
|
end
|
26
26
|
end
|
27
|
+
context "good text file" do
|
28
|
+
setup do
|
29
|
+
post :create, { :upload => { :local => VALID_TEXT_FILE }, :parent_type => 'User', :parent_id => @user.to_param }
|
30
|
+
end
|
31
|
+
should_redirect_to("/create_success") { '/create_success' }
|
32
|
+
should_set_the_flash_to(I18n.t('uploader.successful_upload'))
|
33
|
+
should "create a valid upload" do
|
34
|
+
assert_difference "@user.uploads.count", 1 do
|
35
|
+
post :create, { :upload => { :local => VALID_TEXT_FILE }, :parent_type => 'User', :parent_id => @user.to_param }
|
36
|
+
end
|
37
|
+
assert assigns(:upload).errors.empty?, assigns(:upload).errors
|
38
|
+
end
|
39
|
+
end
|
40
|
+
context "good pdf file" do
|
41
|
+
setup do
|
42
|
+
post :create, { :upload => { :local => VALID_PDF_FILE }, :parent_type => 'User', :parent_id => @user.to_param }
|
43
|
+
end
|
44
|
+
should_redirect_to("/create_success") { '/create_success' }
|
45
|
+
should_set_the_flash_to(I18n.t('uploader.successful_upload'))
|
46
|
+
should "create a valid upload" do
|
47
|
+
assert_difference "@user.uploads.count", 1 do
|
48
|
+
post :create, { :upload => { :local => VALID_PDF_FILE }, :parent_type => 'User', :parent_id => @user.to_param }
|
49
|
+
end
|
50
|
+
assert assigns(:upload).errors.empty?, assigns(:upload).errors
|
51
|
+
end
|
52
|
+
end
|
53
|
+
context "good doc file" do
|
54
|
+
setup do
|
55
|
+
post :create, { :upload => { :local => VALID_WORD_FILE }, :parent_type => 'User', :parent_id => @user.to_param }
|
56
|
+
end
|
57
|
+
should_redirect_to("/create_success") { '/create_success' }
|
58
|
+
should_set_the_flash_to(I18n.t('uploader.successful_upload'))
|
59
|
+
should "create a valid upload" do
|
60
|
+
assert_difference "@user.uploads.count", 1 do
|
61
|
+
post :create, { :upload => { :local => VALID_WORD_FILE }, :parent_type => 'User', :parent_id => @user.to_param }
|
62
|
+
end
|
63
|
+
assert assigns(:upload).errors.empty?, assigns(:upload).errors
|
64
|
+
end
|
65
|
+
end
|
66
|
+
context "good excel file" do
|
67
|
+
setup do
|
68
|
+
post :create, { :upload => { :local => VALID_EXCEL_FILE }, :parent_type => 'User', :parent_id => @user.to_param }
|
69
|
+
end
|
70
|
+
should_redirect_to("/create_success") { '/create_success' }
|
71
|
+
should_set_the_flash_to(I18n.t('uploader.successful_upload'))
|
72
|
+
should "create a valid upload" do
|
73
|
+
assert_difference "@user.uploads.count", 1 do
|
74
|
+
post :create, { :upload => { :local => VALID_EXCEL_FILE }, :parent_type => 'User', :parent_id => @user.to_param }
|
75
|
+
end
|
76
|
+
assert assigns(:upload).errors.empty?, assigns(:upload).errors
|
77
|
+
end
|
78
|
+
end
|
27
79
|
context "bad file" do
|
28
80
|
setup do
|
29
81
|
post :create, { :upload => { :local => nil }, :parent_type => 'User', :parent_id => @user.to_param }
|
@@ -45,7 +97,7 @@ class UploadsControllerTest < ActionController::TestCase
|
|
45
97
|
should_respond_with :success
|
46
98
|
should "add an upload" do
|
47
99
|
assert_difference "Upload.count", 1 do
|
48
|
-
post :swfupload, { :
|
100
|
+
post :swfupload, { :Filedata => VALID_FILE, :parent_type => 'User', :parent_id => @user.to_param }
|
49
101
|
end
|
50
102
|
end
|
51
103
|
end
|
Binary file
|
Binary file
|
Binary file
|
@@ -12,7 +12,11 @@ require File.expand_path(File.dirname(__FILE__) + '/factories')
|
|
12
12
|
require File.join(File.dirname(__FILE__), 'shoulda_macros', 'paperclip')
|
13
13
|
class ActiveSupport::TestCase
|
14
14
|
|
15
|
-
VALID_FILE = ActionController::TestUploadedFile.new(File.join(RAILS_ROOT, 'public
|
15
|
+
VALID_FILE = ActionController::TestUploadedFile.new(File.join(RAILS_ROOT, 'public', 'images', 'rails.png'), 'image/png')
|
16
|
+
VALID_TEXT_FILE = ActionController::TestUploadedFile.new(File.join(RAILS_ROOT, 'Rakefile'), 'text/plain')
|
17
|
+
VALID_PDF_FILE = ActionController::TestUploadedFile.new(File.join(RAILS_ROOT, 'test', 'test.pdf'), 'application/pdf')
|
18
|
+
VALID_WORD_FILE = ActionController::TestUploadedFile.new(File.join(RAILS_ROOT, 'test', 'test.doc'), 'application/pdf')
|
19
|
+
VALID_EXCEL_FILE = ActionController::TestUploadedFile.new(File.join(RAILS_ROOT, 'test', 'test.xls'), 'application/pdf')
|
16
20
|
|
17
21
|
self.use_transactional_fixtures = true
|
18
22
|
self.use_instantiated_fixtures = false
|
data/uploader.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{uploader}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.5"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Justin Ball", "David South"]
|
12
|
-
s.date = %q{2009-11-
|
12
|
+
s.date = %q{2009-11-17}
|
13
13
|
s.description = %q{Uploader gem that makes it simple add multiple file uploads to your Rails project using SWFUpload and Paperclip}
|
14
14
|
s.email = %q{justinball@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -82,6 +82,7 @@ Gem::Specification.new do |s|
|
|
82
82
|
"locales/zh-TW.yml",
|
83
83
|
"locales/zh.yml",
|
84
84
|
"public/images/SWFUploadButton.png",
|
85
|
+
"public/images/cancelbutton.gif",
|
85
86
|
"public/images/file_icons/excel.gif",
|
86
87
|
"public/images/file_icons/file.gif",
|
87
88
|
"public/images/file_icons/file.png",
|
@@ -135,6 +136,7 @@ Gem::Specification.new do |s|
|
|
135
136
|
"public/javascripts/swfupload/swfupload.cookies.js",
|
136
137
|
"public/javascripts/swfupload/swfupload.js",
|
137
138
|
"public/javascripts/swfupload/swfupload.queue.js",
|
139
|
+
"public/javascripts/swfupload/swfupload.speed.js",
|
138
140
|
"public/javascripts/swfupload/swfupload.swfobject.js",
|
139
141
|
"public/stylesheets/swfupload.css",
|
140
142
|
"public/swf/swfupload.swf",
|
@@ -285,6 +287,9 @@ Gem::Specification.new do |s|
|
|
285
287
|
"test/rails_root/test/mocks/development/.keep",
|
286
288
|
"test/rails_root/test/mocks/test/.keep",
|
287
289
|
"test/rails_root/test/shoulda_macros/paperclip.rb",
|
290
|
+
"test/rails_root/test/test.doc",
|
291
|
+
"test/rails_root/test/test.pdf",
|
292
|
+
"test/rails_root/test/test.xls",
|
288
293
|
"test/rails_root/test/test_helper.rb",
|
289
294
|
"test/rails_root/test/unit/.keep",
|
290
295
|
"test/rails_root/test/unit/upload_test.rb",
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uploader
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Ball
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2009-11-
|
13
|
+
date: 2009-11-17 00:00:00 -07:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -118,6 +118,7 @@ files:
|
|
118
118
|
- locales/zh-TW.yml
|
119
119
|
- locales/zh.yml
|
120
120
|
- public/images/SWFUploadButton.png
|
121
|
+
- public/images/cancelbutton.gif
|
121
122
|
- public/images/file_icons/excel.gif
|
122
123
|
- public/images/file_icons/file.gif
|
123
124
|
- public/images/file_icons/file.png
|
@@ -171,6 +172,7 @@ files:
|
|
171
172
|
- public/javascripts/swfupload/swfupload.cookies.js
|
172
173
|
- public/javascripts/swfupload/swfupload.js
|
173
174
|
- public/javascripts/swfupload/swfupload.queue.js
|
175
|
+
- public/javascripts/swfupload/swfupload.speed.js
|
174
176
|
- public/javascripts/swfupload/swfupload.swfobject.js
|
175
177
|
- public/stylesheets/swfupload.css
|
176
178
|
- public/swf/swfupload.swf
|
@@ -321,6 +323,9 @@ files:
|
|
321
323
|
- test/rails_root/test/mocks/development/.keep
|
322
324
|
- test/rails_root/test/mocks/test/.keep
|
323
325
|
- test/rails_root/test/shoulda_macros/paperclip.rb
|
326
|
+
- test/rails_root/test/test.doc
|
327
|
+
- test/rails_root/test/test.pdf
|
328
|
+
- test/rails_root/test/test.xls
|
324
329
|
- test/rails_root/test/test_helper.rb
|
325
330
|
- test/rails_root/test/unit/.keep
|
326
331
|
- test/rails_root/test/unit/upload_test.rb
|