Skip to content

Commit c6eb606

Browse files
committed
Install version 7.4.1 of the JQuery-File-Upload plugin
Installed the latest released version of the jQuery-File-Upload plugin with vendorer. It should now be easier to keep this gem current.
1 parent 9ce97c3 commit c6eb606

File tree

10 files changed

+350
-127
lines changed

10 files changed

+350
-127
lines changed

Vendorfile

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# file 'vendor/assets/javascripts/jquery.min.js', 'http://code.jquery.com/jquery-latest.min.js'
2+
# folder 'vendor/plugins/parallel_tests', 'https://github.com/grosser/parallel_tests.git'
3+
4+
# Execute a block after updates
5+
# file 'vendor/assets/javascripts/jquery.js', 'http://code.jquery.com/jquery.js' do |path|
6+
# puts "Do something useful with #{path}"
7+
# rewrite(path) { |content| content.gsub(/\r\n/, \n).gsub /\t/, ' ' }
8+
# end
9+
10+
# Checkout a specific :ref/:tag/:branch
11+
# folder 'vendor/plugins/parallel_tests', 'https://github.com/grosser/parallel_tests.git', :tag => 'v0.6.10'
12+
13+
# DRY folders
14+
# folder 'vendor/assets/javascripts' do
15+
# file 'jquery.js', 'http://code.jquery.com/jquery-latest.js'
16+
# end
17+
18+
# Copy files & folders from repos (also works with private repos)
19+
# from 'https://github.com/grosser/parallel_tests.git' do |checkout_location|
20+
# file 'Readme.md'
21+
# file 'target-folder/file.rb', 'lib/parallel_tests.rb'
22+
# folder 'spec'
23+
# folder 'renamed-folder', 'spec'
24+
# end
25+
26+
from 'https://github.com/blueimp/jQuery-File-Upload.git', tag: '7.4.1' do
27+
file 'vendor/assets/stylesheets/jquery.fileupload-ui.scss', 'css/jquery.fileupload-ui.css' do |path|
28+
rewrite(path) { |content| content.gsub(%r{url\(\.\./img/(.+)\)}, "image-url('\\1')")}
29+
end
30+
31+
%w(fileupload-fp fileupload-ui fileupload iframe-transport).each do |f|
32+
filename = "jquery.#{f}.js"
33+
file "vendor/assets/javascripts/jquery-fileupload/#{filename}", "js/#{filename}"
34+
end
35+
36+
file 'vendor/assets/javascripts/jquery-fileupload/vendor/jquery.ui.widget.js', 'js/vendor/jquery.ui.widget.js'
37+
38+
%w(loading.gif progressbar.gif).each do |f|
39+
file "vendor/assets/images/#{f}", "img/#{f}"
40+
end
41+
end
42+
43+
from 'https://github.com/blueimp/JavaScript-Load-Image.git' do
44+
file 'vendor/assets/javascripts/jquery-fileupload/vendor/load-image.js', 'load-image.js'
45+
end
46+
47+
from 'https://github.com/blueimp/JavaScript-Canvas-to-Blob.git' do
48+
file 'vendor/assets/javascripts/jquery-fileupload/vendor/canvas-to-blob.js', 'canvas-to-blob.js'
49+
end

jquery-fileupload-rails.gemspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,5 @@ Gem::Specification.new do |s|
2121
s.add_dependency 'railties', '>= 3.1'
2222
s.add_dependency 'actionpack', '>= 3.1'
2323
s.add_development_dependency 'rails', '>= 3.1'
24+
s.add_development_dependency 'vendorer'
2425
end

vendor/assets/javascripts/jquery-fileupload/jquery.fileupload-fp.js

100755100644
Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* jQuery File Upload File Processing Plugin 1.2.1
2+
* jQuery File Upload File Processing Plugin 1.2.3
33
* https://github.com/blueimp/jQuery-File-Upload
44
*
55
* Copyright 2012, Sebastian Tschan
@@ -62,9 +62,13 @@
6262
// fileupload widget (via file input selection, drag & drop or add
6363
// API call). See the basic file upload widget for more information:
6464
add: function (e, data) {
65-
$(this).fileupload('process', data).done(function () {
66-
data.submit();
67-
});
65+
if (data.autoUpload || (data.autoUpload !== false &&
66+
($(this).data('blueimp-fileupload') ||
67+
$(this).data('fileupload')).options.autoUpload)) {
68+
$(this).fileupload('process', data).done(function () {
69+
data.submit();
70+
});
71+
}
6872
}
6973
},
7074

vendor/assets/javascripts/jquery-fileupload/jquery.fileupload-ui.js

100755100644
Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* jQuery File Upload User Interface Plugin 7.3
2+
* jQuery File Upload User Interface Plugin 7.4.1
33
* https://github.com/blueimp/jQuery-File-Upload
44
*
55
* Copyright 2010, Sebastian Tschan
@@ -263,7 +263,7 @@
263263
// Callback for upload progress events:
264264
progress: function (e, data) {
265265
if (data.context) {
266-
var progress = parseInt(data.loaded / data.total * 100, 10);
266+
var progress = Math.floor(data.loaded / data.total * 100);
267267
data.context.find('.progress')
268268
.attr('aria-valuenow', progress)
269269
.find('.bar').css(
@@ -275,7 +275,7 @@
275275
// Callback for global upload progress events:
276276
progressall: function (e, data) {
277277
var $this = $(this),
278-
progress = parseInt(data.loaded / data.total * 100, 10),
278+
progress = Math.floor(data.loaded / data.total * 100),
279279
globalProgressNode = $this.find('.fileupload-progress'),
280280
extendedProgressNode = globalProgressNode
281281
.find('.progress-extended');
@@ -422,7 +422,7 @@
422422

423423
_formatTime: function (seconds) {
424424
var date = new Date(seconds * 1000),
425-
days = parseInt(seconds / 86400, 10);
425+
days = Math.floor(seconds / 86400);
426426
days = days ? days + 'd ' : '';
427427
return days +
428428
('0' + date.getUTCHours()).slice(-2) + ':' +
@@ -519,6 +519,12 @@
519519
// so we have to resolve manually:
520520
dfd.resolveWith(node);
521521
}
522+
node.on('remove', function () {
523+
// If the element is removed before the
524+
// transition finishes, transition events are
525+
// not triggered, resolve manually:
526+
dfd.resolveWith(node);
527+
});
522528
},
523529
{
524530
maxWidth: options.previewMaxWidth,
@@ -607,7 +613,7 @@
607613

608614
_transition: function (node) {
609615
var dfd = $.Deferred();
610-
if ($.support.transition && node.hasClass('fade')) {
616+
if ($.support.transition && node.hasClass('fade') && node.is(':visible')) {
611617
node.bind(
612618
$.support.transition.end,
613619
function (e) {
@@ -632,27 +638,28 @@
632638
this._on(fileUploadButtonBar.find('.start'), {
633639
click: function (e) {
634640
e.preventDefault();
635-
filesList.find('.start button').click();
641+
filesList.find('.start').click();
636642
}
637643
});
638644
this._on(fileUploadButtonBar.find('.cancel'), {
639645
click: function (e) {
640646
e.preventDefault();
641-
filesList.find('.cancel button').click();
647+
filesList.find('.cancel').click();
642648
}
643649
});
644650
this._on(fileUploadButtonBar.find('.delete'), {
645651
click: function (e) {
646652
e.preventDefault();
647-
filesList.find('.delete input:checked')
648-
.siblings('button').click();
653+
filesList.find('.toggle:checked')
654+
.closest('.template-download')
655+
.find('.delete').click();
649656
fileUploadButtonBar.find('.toggle')
650657
.prop('checked', false);
651658
}
652659
});
653660
this._on(fileUploadButtonBar.find('.toggle'), {
654661
change: function (e) {
655-
filesList.find('.delete input').prop(
662+
filesList.find('.toggle').prop(
656663
'checked',
657664
$(e.currentTarget).is(':checked')
658665
);
@@ -662,7 +669,8 @@
662669

663670
_destroyButtonBarEventHandlers: function () {
664671
this._off(
665-
this.element.find('.fileupload-buttonbar button'),
672+
this.element.find('.fileupload-buttonbar')
673+
.find('.start, .cancel, .delete'),
666674
'click'
667675
);
668676
this._off(
@@ -674,9 +682,9 @@
674682
_initEventHandlers: function () {
675683
this._super();
676684
this._on(this.options.filesContainer, {
677-
'click .start button': this._startHandler,
678-
'click .cancel button': this._cancelHandler,
679-
'click .delete button': this._deleteHandler
685+
'click .start': this._startHandler,
686+
'click .cancel': this._cancelHandler,
687+
'click .delete': this._deleteHandler
680688
});
681689
this._initButtonBarEventHandlers();
682690
},

0 commit comments

Comments
 (0)