Permalink
Browse files

Code cleanup

  • Loading branch information...
1 parent e0e0fbb commit 7be3c5a4167b93cf376ecae1d0db91028e736d2d @stakach committed Jan 30, 2012
Showing with 8 additions and 12 deletions.
  1. +2 −1 .gitignore
  2. +6 −6 app/assets/javascripts/resolute/resumables.js
  3. +0 −5 lib/resolute.rb
View
@@ -4,4 +4,5 @@ pkg/
test/dummy/db/*.sqlite3
test/dummy/log/*.log
test/dummy/tmp/
-/Gemfile.lock
+/Gemfile.lock
+/.project
@@ -73,7 +73,7 @@
// This manages the file upload
//
function upload_file(number) {
- if (number == total) {
+ if (number == data.files.length) {
upload_finished(number, failures);
return;
}
@@ -82,7 +82,7 @@
// Files can be canceled at this point (maybe some are not supported)
//
var file = files[number];
- if (!$this.triggerHandler('onUploadStarted', [file.name, number, total])) {
+ if (!$this.triggerHandler('onUploadStarted', [file.name, number, data.files.length])) {
return upload_file(number + 1);
}
@@ -175,14 +175,14 @@
var xhr = new XMLHttpRequest();
$this.data('resumable').xhr = xhr;
xhr.upload['onprogress'] = function(rpe){
- $this.triggerHandler('onUploadProgress', [(offset + rpe.loaded) / file.size, file.name, number, total]);
+ $this.triggerHandler('onUploadProgress', [(offset + rpe.loaded) / file.size, file.name, number, data.files.length]);
};
return xhr;
},
dataType: 'json',
success: function (data, status, xhr) {
if(data.next_part == false) {
- $this.triggerHandler('onUploadFinish', [xhr.responseText, file.name, number, total]);
+ $this.triggerHandler('onUploadFinish', [xhr.responseText, file.name, number, data.files.length]);
upload_file(number + 1);
} else {
retries = 0;
@@ -237,7 +237,7 @@
var xhr = new XMLHttpRequest();
$this.data('resumable').xhr = xhr;
xhr.upload['onprogress'] = function(rpe){
- $this.triggerHandler('onUploadProgress', [rpe.loaded / rpe.total, file.name, number, total]);
+ $this.triggerHandler('onUploadProgress', [rpe.loaded / rpe.total, file.name, number, data.files.length]);
};
return xhr;
},
@@ -250,7 +250,7 @@
});
},
success: function (data, status, xhr) {
- $this.triggerHandler('onUploadFinish', [xhr.responseText, file.name, number, total]);
+ $this.triggerHandler('onUploadFinish', [xhr.responseText, file.name, number, data.files.length]);
upload_file(number + 1);
},
error: function (xhr, status, error) {
View
@@ -41,9 +41,4 @@ def self.check_supported=(proc)
@supported_callback = proc
end
self.check_supported = Proc.new {|file_info| return true} # Default accept all
-
-
- def self.js
- return ["resolute/resumables-#{I18n.locale}", "resolute/resumables"]
- end
end

0 comments on commit 7be3c5a

Please sign in to comment.