s3_cors_fileupload 0.2.1 → 0.3.0
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.
- checksums.yaml +4 -4
- data/.travis.yml +4 -0
- data/CHANGELOG.md +10 -3
- data/Gemfile +11 -9
- data/Gemfile.lock +86 -65
- data/README.md +8 -4
- data/lib/generators/s3_cors_fileupload/install/install_generator.rb +5 -2
- data/lib/generators/s3_cors_fileupload/install/templates/s3_uploads_controller.rb +3 -1
- data/lib/generators/s3_cors_fileupload/install/templates/source_file.rb +4 -3
- data/lib/generators/s3_cors_fileupload/install/templates/views/erb/_template_download.html.erb +18 -7
- data/lib/generators/s3_cors_fileupload/install/templates/views/erb/_template_upload.html.erb +4 -4
- data/lib/generators/s3_cors_fileupload/install/templates/views/erb/_template_uploaded.html.erb +17 -6
- data/lib/generators/s3_cors_fileupload/install/templates/views/erb/index.html.erb +1 -1
- data/lib/generators/s3_cors_fileupload/install/templates/views/haml/_template_download.html.haml +14 -4
- data/lib/generators/s3_cors_fileupload/install/templates/views/haml/_template_upload.html.haml +5 -5
- data/lib/generators/s3_cors_fileupload/install/templates/views/haml/_template_uploaded.html.haml +12 -1
- data/lib/generators/s3_cors_fileupload/install/templates/views/haml/index.html.haml +1 -1
- data/lib/s3_cors_fileupload.rb +6 -0
- data/lib/s3_cors_fileupload/rails.rb +1 -1
- data/lib/s3_cors_fileupload/rails/form_helper.rb +15 -12
- data/lib/s3_cors_fileupload/version.rb +3 -3
- data/s3_cors_fileupload.gemspec +3 -4
- data/spec/dummy/Rakefile +0 -1
- data/spec/dummy/app/assets/javascripts/application.js +4 -3
- data/spec/dummy/app/assets/javascripts/s3_uploads.js +92 -0
- data/spec/dummy/app/assets/stylesheets/application.css +1 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -1
- data/spec/dummy/app/controllers/s3_uploads_controller.rb +56 -0
- data/spec/dummy/app/models/source_file.rb +54 -0
- data/spec/dummy/app/views/layouts/application.html.erb +2 -2
- data/spec/dummy/app/views/s3_uploads/_template_download.html.erb +43 -0
- data/spec/dummy/app/views/s3_uploads/_template_upload.html.erb +36 -0
- data/spec/dummy/app/views/s3_uploads/_template_uploaded.html.erb +41 -0
- data/spec/dummy/app/views/s3_uploads/index.html.erb +41 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/config.ru +1 -1
- data/spec/dummy/config/application.rb +2 -33
- data/spec/dummy/config/boot.rb +4 -9
- data/spec/dummy/config/environment.rb +2 -2
- data/spec/dummy/config/environments/development.rb +14 -19
- data/spec/dummy/config/environments/production.rb +40 -27
- data/spec/dummy/config/environments/test.rb +14 -12
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +6 -5
- data/spec/dummy/config/initializers/secret_token.rb +7 -2
- data/spec/dummy/config/initializers/session_store.rb +0 -5
- data/spec/dummy/config/initializers/wrap_parameters.rb +6 -6
- data/spec/dummy/config/locales/en.yml +20 -2
- data/spec/dummy/config/routes.rb +27 -24
- data/spec/dummy/db/migrate/20131001201535_create_source_files.rb +14 -0
- data/spec/dummy/db/schema.rb +27 -0
- data/spec/dummy/public/404.html +43 -11
- data/spec/dummy/public/422.html +43 -11
- data/spec/dummy/public/500.html +43 -11
- data/spec/features/uploads_spec.rb +37 -0
- data/spec/lib/s3_cors_fileupload/rails/engine_spec.rb +8 -0
- data/spec/lib/s3_cors_fileupload/rails/form_helper_spec.rb +30 -0
- data/spec/lib/s3_cors_fileupload/rails/policy_helper_spec.rb +95 -0
- data/spec/s3_cors_fileupload_spec.rb +8 -4
- data/spec/spec_helper.rb +8 -8
- data/spec/support/dummy.pdf +0 -0
- data/vendor/assets/javascripts/s3_cors_fileupload/index.js +1 -0
- data/vendor/assets/javascripts/s3_cors_fileupload/jquery.fileupload-image.js +111 -32
- data/vendor/assets/javascripts/s3_cors_fileupload/jquery.fileupload-ui.js +24 -18
- data/vendor/assets/javascripts/s3_cors_fileupload/jquery.fileupload-validate.js +7 -6
- data/vendor/assets/javascripts/s3_cors_fileupload/jquery.fileupload.js +22 -15
- data/vendor/assets/javascripts/s3_cors_fileupload/vendor/load-image-meta.js +137 -0
- data/vendor/assets/javascripts/s3_cors_fileupload/vendor/tmpl.js +8 -8
- data/vendor/assets/stylesheets/jquery.fileupload-ui.css.erb +2 -1
- metadata +56 -28
- data/spec/dummy/script/rails +0 -6
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* jQuery File Upload User Interface Plugin 8.5
|
|
2
|
+
* jQuery File Upload User Interface Plugin 8.8.5
|
|
3
3
|
* https://github.com/blueimp/jQuery-File-Upload
|
|
4
4
|
*
|
|
5
5
|
* Copyright 2010, Sebastian Tschan
|
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
!$.support.transition && 'progress-animated'
|
|
121
121
|
)
|
|
122
122
|
.attr('aria-valuenow', 100)
|
|
123
|
-
.
|
|
123
|
+
.children().first().css(
|
|
124
124
|
'width',
|
|
125
125
|
'100%'
|
|
126
126
|
);
|
|
@@ -139,8 +139,8 @@
|
|
|
139
139
|
if (data.context) {
|
|
140
140
|
data.context.each(function (index) {
|
|
141
141
|
var file = files[index] ||
|
|
142
|
-
{error: 'Empty file upload result'}
|
|
143
|
-
|
|
142
|
+
{error: 'Empty file upload result'};
|
|
143
|
+
deferred = that._addFinishedDeferreds();
|
|
144
144
|
that._transition($(this)).done(
|
|
145
145
|
function () {
|
|
146
146
|
var node = $(this);
|
|
@@ -159,8 +159,9 @@
|
|
|
159
159
|
);
|
|
160
160
|
});
|
|
161
161
|
} else {
|
|
162
|
-
template = that._renderDownload(files)
|
|
163
|
-
|
|
162
|
+
template = that._renderDownload(files)[
|
|
163
|
+
that.options.prependFiles ? 'prependTo' : 'appendTo'
|
|
164
|
+
](that.options.filesContainer);
|
|
164
165
|
that._forceReflow(template);
|
|
165
166
|
deferred = that._addFinishedDeferreds();
|
|
166
167
|
that._transition(template).done(
|
|
@@ -215,8 +216,9 @@
|
|
|
215
216
|
}
|
|
216
217
|
});
|
|
217
218
|
} else if (data.errorThrown !== 'abort') {
|
|
218
|
-
data.context = that._renderUpload(data.files)
|
|
219
|
-
|
|
219
|
+
data.context = that._renderUpload(data.files)[
|
|
220
|
+
that.options.prependFiles ? 'prependTo' : 'appendTo'
|
|
221
|
+
](that.options.filesContainer)
|
|
220
222
|
.data('data', data);
|
|
221
223
|
that._forceReflow(data.context);
|
|
222
224
|
deferred = that._addFinishedDeferreds();
|
|
@@ -236,14 +238,16 @@
|
|
|
236
238
|
},
|
|
237
239
|
// Callback for upload progress events:
|
|
238
240
|
progress: function (e, data) {
|
|
241
|
+
var progress = Math.floor(data.loaded / data.total * 100);
|
|
239
242
|
if (data.context) {
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
243
|
+
data.context.each(function () {
|
|
244
|
+
$(this).find('.progress')
|
|
245
|
+
.attr('aria-valuenow', progress)
|
|
246
|
+
.children().first().css(
|
|
247
|
+
'width',
|
|
248
|
+
progress + '%'
|
|
249
|
+
);
|
|
250
|
+
});
|
|
247
251
|
}
|
|
248
252
|
},
|
|
249
253
|
// Callback for global upload progress events:
|
|
@@ -262,7 +266,7 @@
|
|
|
262
266
|
globalProgressNode
|
|
263
267
|
.find('.progress')
|
|
264
268
|
.attr('aria-valuenow', progress)
|
|
265
|
-
.
|
|
269
|
+
.children().first().css(
|
|
266
270
|
'width',
|
|
267
271
|
progress + '%'
|
|
268
272
|
);
|
|
@@ -291,7 +295,7 @@
|
|
|
291
295
|
function () {
|
|
292
296
|
$(this).find('.progress')
|
|
293
297
|
.attr('aria-valuenow', '0')
|
|
294
|
-
.
|
|
298
|
+
.children().first().css('width', '0%');
|
|
295
299
|
$(this).find('.progress-extended').html(' ');
|
|
296
300
|
deferred.resolve();
|
|
297
301
|
}
|
|
@@ -460,9 +464,11 @@
|
|
|
460
464
|
|
|
461
465
|
_cancelHandler: function (e) {
|
|
462
466
|
e.preventDefault();
|
|
463
|
-
var template = $(e.currentTarget)
|
|
467
|
+
var template = $(e.currentTarget)
|
|
468
|
+
.closest('.template-upload,.template-download'),
|
|
464
469
|
data = template.data('data') || {};
|
|
465
470
|
if (!data.jqXHR) {
|
|
471
|
+
data.context = data.context || template;
|
|
466
472
|
data.errorThrown = 'abort';
|
|
467
473
|
this._trigger('fail', e, data);
|
|
468
474
|
} else {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* jQuery File Upload Validation Plugin 1.1
|
|
2
|
+
* jQuery File Upload Validation Plugin 1.1.1
|
|
3
3
|
* https://github.com/blueimp/jQuery-File-Upload
|
|
4
4
|
*
|
|
5
5
|
* Copyright 2013, Sebastian Tschan
|
|
@@ -83,16 +83,17 @@
|
|
|
83
83
|
}
|
|
84
84
|
var dfd = $.Deferred(),
|
|
85
85
|
settings = this.options,
|
|
86
|
-
file = data.files[data.index]
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
86
|
+
file = data.files[data.index];
|
|
87
|
+
if ($.type(options.maxNumberOfFiles) === 'number' &&
|
|
88
|
+
(settings.getNumberOfFiles() || 0) + data.files.length >
|
|
89
|
+
options.maxNumberOfFiles) {
|
|
90
90
|
file.error = settings.i18n('maxNumberOfFiles');
|
|
91
91
|
} else if (options.acceptFileTypes &&
|
|
92
92
|
!(options.acceptFileTypes.test(file.type) ||
|
|
93
93
|
options.acceptFileTypes.test(file.name))) {
|
|
94
94
|
file.error = settings.i18n('acceptFileTypes');
|
|
95
|
-
} else if (options.maxFileSize && file.size >
|
|
95
|
+
} else if (options.maxFileSize && file.size >
|
|
96
|
+
options.maxFileSize) {
|
|
96
97
|
file.error = settings.i18n('maxFileSize');
|
|
97
98
|
} else if ($.type(file.size) === 'number' &&
|
|
98
99
|
file.size < options.minFileSize) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* jQuery File Upload Plugin 5.32.
|
|
2
|
+
* jQuery File Upload Plugin 5.32.6
|
|
3
3
|
* https://github.com/blueimp/jQuery-File-Upload
|
|
4
4
|
*
|
|
5
5
|
* Copyright 2010, Sebastian Tschan
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
$.support.fileInput = !(new RegExp(
|
|
33
33
|
// Handle devices which give false positives for the feature detection:
|
|
34
34
|
'(Android (1\\.[0156]|2\\.[01]))' +
|
|
35
|
-
'|(Windows Phone (OS 7|8\\.0))|(XBLWP)|(ZuneWP)' +
|
|
35
|
+
'|(Windows Phone (OS 7|8\\.0))|(XBLWP)|(ZuneWP)|(WPDesktop)' +
|
|
36
36
|
'|(w(eb)?OSBrowser)|(webOS)' +
|
|
37
37
|
'|(Kindle/(1\\.0|2\\.[05]|3\\.0))'
|
|
38
38
|
).test(window.navigator.userAgent) ||
|
|
@@ -399,7 +399,7 @@
|
|
|
399
399
|
// Ignore non-multipart setting if not supported:
|
|
400
400
|
multipart = options.multipart || !$.support.xhrFileUpload,
|
|
401
401
|
paramName = options.paramName[0];
|
|
402
|
-
options.headers = options.headers
|
|
402
|
+
options.headers = $.extend({}, options.headers);
|
|
403
403
|
if (options.contentRange) {
|
|
404
404
|
options.headers['Content-Range'] = options.contentRange;
|
|
405
405
|
}
|
|
@@ -534,8 +534,10 @@
|
|
|
534
534
|
options.url = options.form.prop('action') || location.href;
|
|
535
535
|
}
|
|
536
536
|
// The HTTP request method must be "POST" or "PUT":
|
|
537
|
-
options.type = (options.type ||
|
|
538
|
-
.
|
|
537
|
+
options.type = (options.type ||
|
|
538
|
+
($.type(options.form.prop('method')) === 'string' &&
|
|
539
|
+
options.form.prop('method')) || ''
|
|
540
|
+
).toUpperCase();
|
|
539
541
|
if (options.type !== 'POST' && options.type !== 'PUT' &&
|
|
540
542
|
options.type !== 'PATCH') {
|
|
541
543
|
options.type = 'POST';
|
|
@@ -1118,9 +1120,8 @@
|
|
|
1118
1120
|
data.files.push(file);
|
|
1119
1121
|
}
|
|
1120
1122
|
});
|
|
1121
|
-
if (this._trigger('paste', e, data)
|
|
1122
|
-
|
|
1123
|
-
return false;
|
|
1123
|
+
if (this._trigger('paste', e, data) !== false) {
|
|
1124
|
+
this._onAdd(e, data);
|
|
1124
1125
|
}
|
|
1125
1126
|
}
|
|
1126
1127
|
},
|
|
@@ -1143,13 +1144,15 @@
|
|
|
1143
1144
|
|
|
1144
1145
|
_onDragOver: function (e) {
|
|
1145
1146
|
e.dataTransfer = e.originalEvent && e.originalEvent.dataTransfer;
|
|
1146
|
-
var dataTransfer = e.dataTransfer
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
}
|
|
1151
|
-
|
|
1152
|
-
|
|
1147
|
+
var dataTransfer = e.dataTransfer,
|
|
1148
|
+
data = {
|
|
1149
|
+
dropEffect: 'copy',
|
|
1150
|
+
preventDefault: true
|
|
1151
|
+
};
|
|
1152
|
+
if (dataTransfer && $.inArray('Files', dataTransfer.types) !== -1 &&
|
|
1153
|
+
this._trigger('dragover', e, data) !== false) {
|
|
1154
|
+
dataTransfer.dropEffect = data.dropEffect;
|
|
1155
|
+
if (data.preventDefault) {
|
|
1153
1156
|
e.preventDefault();
|
|
1154
1157
|
}
|
|
1155
1158
|
}
|
|
@@ -1303,6 +1306,10 @@
|
|
|
1303
1306
|
if (aborted) {
|
|
1304
1307
|
return;
|
|
1305
1308
|
}
|
|
1309
|
+
if (!files.length) {
|
|
1310
|
+
dfd.reject();
|
|
1311
|
+
return;
|
|
1312
|
+
}
|
|
1306
1313
|
data.files = files;
|
|
1307
1314
|
jqXHR = that._onSend(null, data).then(
|
|
1308
1315
|
function (result, textStatus, jqXHR) {
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* JavaScript Load Image Meta 1.0.1
|
|
3
|
+
* https://github.com/blueimp/JavaScript-Load-Image
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2013, Sebastian Tschan
|
|
6
|
+
* https://blueimp.net
|
|
7
|
+
*
|
|
8
|
+
* Image meta data handling implementation
|
|
9
|
+
* based on the help and contribution of
|
|
10
|
+
* Achim Stöhr.
|
|
11
|
+
*
|
|
12
|
+
* Licensed under the MIT license:
|
|
13
|
+
* http://www.opensource.org/licenses/MIT
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/*jslint continue:true */
|
|
17
|
+
/*global define, window, DataView, Blob, Uint8Array, console */
|
|
18
|
+
|
|
19
|
+
(function (factory) {
|
|
20
|
+
'use strict';
|
|
21
|
+
if (typeof define === 'function' && define.amd) {
|
|
22
|
+
// Register as an anonymous AMD module:
|
|
23
|
+
define(['load-image'], factory);
|
|
24
|
+
} else {
|
|
25
|
+
// Browser globals:
|
|
26
|
+
factory(window.loadImage);
|
|
27
|
+
}
|
|
28
|
+
}(function (loadImage) {
|
|
29
|
+
'use strict';
|
|
30
|
+
|
|
31
|
+
var hasblobSlice = window.Blob && (Blob.prototype.slice ||
|
|
32
|
+
Blob.prototype.webkitSlice || Blob.prototype.mozSlice);
|
|
33
|
+
|
|
34
|
+
loadImage.blobSlice = hasblobSlice && function () {
|
|
35
|
+
var slice = this.slice || this.webkitSlice || this.mozSlice;
|
|
36
|
+
return slice.apply(this, arguments);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
loadImage.metaDataParsers = {
|
|
40
|
+
jpeg: {
|
|
41
|
+
0xffe1: [] // APP1 marker
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
// Parses image meta data and calls the callback with an object argument
|
|
46
|
+
// with the following properties:
|
|
47
|
+
// * imageHead: The complete image head as ArrayBuffer (Uint8Array for IE10)
|
|
48
|
+
// The options arguments accepts an object and supports the following properties:
|
|
49
|
+
// * maxMetaDataSize: Defines the maximum number of bytes to parse.
|
|
50
|
+
// * disableImageHead: Disables creating the imageHead property.
|
|
51
|
+
loadImage.parseMetaData = function (file, callback, options) {
|
|
52
|
+
options = options || {};
|
|
53
|
+
var that = this,
|
|
54
|
+
// 256 KiB should contain all EXIF/ICC/IPTC segments:
|
|
55
|
+
maxMetaDataSize = options.maxMetaDataSize || 262144,
|
|
56
|
+
data = {},
|
|
57
|
+
noMetaData = !(window.DataView && file && file.size >= 12 &&
|
|
58
|
+
file.type === 'image/jpeg' && loadImage.blobSlice);
|
|
59
|
+
if (noMetaData || !loadImage.readFile(
|
|
60
|
+
loadImage.blobSlice.call(file, 0, maxMetaDataSize),
|
|
61
|
+
function (e) {
|
|
62
|
+
// Note on endianness:
|
|
63
|
+
// Since the marker and length bytes in JPEG files are always
|
|
64
|
+
// stored in big endian order, we can leave the endian parameter
|
|
65
|
+
// of the DataView methods undefined, defaulting to big endian.
|
|
66
|
+
var buffer = e.target.result,
|
|
67
|
+
dataView = new DataView(buffer),
|
|
68
|
+
offset = 2,
|
|
69
|
+
maxOffset = dataView.byteLength - 4,
|
|
70
|
+
headLength = offset,
|
|
71
|
+
markerBytes,
|
|
72
|
+
markerLength,
|
|
73
|
+
parsers,
|
|
74
|
+
i;
|
|
75
|
+
// Check for the JPEG marker (0xffd8):
|
|
76
|
+
if (dataView.getUint16(0) === 0xffd8) {
|
|
77
|
+
while (offset < maxOffset) {
|
|
78
|
+
markerBytes = dataView.getUint16(offset);
|
|
79
|
+
// Search for APPn (0xffeN) and COM (0xfffe) markers,
|
|
80
|
+
// which contain application-specific meta-data like
|
|
81
|
+
// Exif, ICC and IPTC data and text comments:
|
|
82
|
+
if ((markerBytes >= 0xffe0 && markerBytes <= 0xffef) ||
|
|
83
|
+
markerBytes === 0xfffe) {
|
|
84
|
+
// The marker bytes (2) are always followed by
|
|
85
|
+
// the length bytes (2), indicating the length of the
|
|
86
|
+
// marker segment, which includes the length bytes,
|
|
87
|
+
// but not the marker bytes, so we add 2:
|
|
88
|
+
markerLength = dataView.getUint16(offset + 2) + 2;
|
|
89
|
+
if (offset + markerLength > dataView.byteLength) {
|
|
90
|
+
console.log('Invalid meta data: Invalid segment size.');
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
parsers = loadImage.metaDataParsers.jpeg[markerBytes];
|
|
94
|
+
if (parsers) {
|
|
95
|
+
for (i = 0; i < parsers.length; i += 1) {
|
|
96
|
+
parsers[i].call(
|
|
97
|
+
that,
|
|
98
|
+
dataView,
|
|
99
|
+
offset,
|
|
100
|
+
markerLength,
|
|
101
|
+
data,
|
|
102
|
+
options
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
offset += markerLength;
|
|
107
|
+
headLength = offset;
|
|
108
|
+
} else {
|
|
109
|
+
// Not an APPn or COM marker, probably safe to
|
|
110
|
+
// assume that this is the end of the meta data
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
// Meta length must be longer than JPEG marker (2)
|
|
115
|
+
// plus APPn marker (2), followed by length bytes (2):
|
|
116
|
+
if (!options.disableImageHead && headLength > 6) {
|
|
117
|
+
if (buffer.slice) {
|
|
118
|
+
data.imageHead = buffer.slice(0, headLength);
|
|
119
|
+
} else {
|
|
120
|
+
// Workaround for IE10, which does not yet
|
|
121
|
+
// support ArrayBuffer.slice:
|
|
122
|
+
data.imageHead = new Uint8Array(buffer)
|
|
123
|
+
.subarray(0, headLength);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
} else {
|
|
127
|
+
console.log('Invalid JPEG file: Missing JPEG marker.');
|
|
128
|
+
}
|
|
129
|
+
callback(data);
|
|
130
|
+
},
|
|
131
|
+
'readAsArrayBuffer'
|
|
132
|
+
)) {
|
|
133
|
+
callback(data);
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
}));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* JavaScript Templates 2.
|
|
2
|
+
* JavaScript Templates 2.4.0
|
|
3
3
|
* https://github.com/blueimp/JavaScript-Templates
|
|
4
4
|
*
|
|
5
5
|
* Copyright 2011, Sebastian Tschan
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* http://ejohn.org/blog/javascript-micro-templating/
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
/*jslint evil: true, regexp: true */
|
|
15
|
+
/*jslint evil: true, regexp: true, unparam: true */
|
|
16
16
|
/*global document, define */
|
|
17
17
|
|
|
18
18
|
(function ($) {
|
|
@@ -34,21 +34,21 @@
|
|
|
34
34
|
tmpl.load = function (id) {
|
|
35
35
|
return document.getElementById(id).innerHTML;
|
|
36
36
|
};
|
|
37
|
-
tmpl.regexp = /([\s'\\])(?![
|
|
37
|
+
tmpl.regexp = /([\s'\\])(?!(?:[^{]|\{(?!%))*%\})|(?:\{%(=|#)([\s\S]+?)%\})|(\{%)|(%\})/g;
|
|
38
38
|
tmpl.func = function (s, p1, p2, p3, p4, p5) {
|
|
39
|
-
if (p1) { // whitespace, quote and backspace in
|
|
39
|
+
if (p1) { // whitespace, quote and backspace in HTML context
|
|
40
40
|
return {
|
|
41
41
|
"\n": "\\n",
|
|
42
42
|
"\r": "\\r",
|
|
43
43
|
"\t": "\\t",
|
|
44
44
|
" " : " "
|
|
45
|
-
}[
|
|
45
|
+
}[p1] || "\\" + p1;
|
|
46
46
|
}
|
|
47
47
|
if (p2) { // interpolation: {%=prop%}, or unescaped: {%#prop%}
|
|
48
48
|
if (p2 === "=") {
|
|
49
49
|
return "'+_e(" + p3 + ")+'";
|
|
50
50
|
}
|
|
51
|
-
return "'+" + p3 + "+'";
|
|
51
|
+
return "'+(" + p3 + "==null?'':" + p3 + ")+'";
|
|
52
52
|
}
|
|
53
53
|
if (p4) { // evaluation start tag: {%
|
|
54
54
|
return "';";
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"'" : "'"
|
|
67
67
|
};
|
|
68
68
|
tmpl.encode = function (s) {
|
|
69
|
-
return
|
|
69
|
+
return (s == null ? "" : "" + s).replace(
|
|
70
70
|
tmpl.encReg,
|
|
71
71
|
function (c) {
|
|
72
72
|
return tmpl.encMap[c] || "";
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
);
|
|
75
75
|
};
|
|
76
76
|
tmpl.arg = "o";
|
|
77
|
-
tmpl.helper = ",print=function(s,e){_s+=e
|
|
77
|
+
tmpl.helper = ",print=function(s,e){_s+=e?(s==null?'':s):_e(s);}" +
|
|
78
78
|
",include=function(s,d){_s+=tmpl(s,d);}";
|
|
79
79
|
if (typeof define === "function" && define.amd) {
|
|
80
80
|
define(function () {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
@charset "UTF-8";
|
|
2
2
|
/*
|
|
3
|
-
* jQuery File Upload UI Plugin CSS 8.1
|
|
3
|
+
* jQuery File Upload UI Plugin CSS 8.8.1
|
|
4
4
|
* https://github.com/blueimp/jQuery-File-Upload
|
|
5
5
|
*
|
|
6
6
|
* Copyright 2010, Sebastian Tschan
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
.fileupload-buttonbar .toggle {
|
|
31
31
|
margin-bottom: 5px;
|
|
32
32
|
}
|
|
33
|
+
.progress-animated .progress-bar,
|
|
33
34
|
.progress-animated .bar {
|
|
34
35
|
background: url(<%= asset_path 'progressbar.gif' %>) !important;
|
|
35
36
|
filter: none;
|
metadata
CHANGED
|
@@ -1,29 +1,35 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: s3_cors_fileupload
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ben Atkins
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2013-
|
|
11
|
+
date: 2013-10-03 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
|
-
- -
|
|
17
|
+
- - '>='
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
19
|
version: '3.1'
|
|
20
|
+
- - <
|
|
21
|
+
- !ruby/object:Gem::Version
|
|
22
|
+
version: '5.0'
|
|
20
23
|
type: :runtime
|
|
21
24
|
prerelease: false
|
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
26
|
requirements:
|
|
24
|
-
- -
|
|
27
|
+
- - '>='
|
|
25
28
|
- !ruby/object:Gem::Version
|
|
26
29
|
version: '3.1'
|
|
30
|
+
- - <
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '5.0'
|
|
27
33
|
- !ruby/object:Gem::Dependency
|
|
28
34
|
name: multi_json
|
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -38,20 +44,6 @@ dependencies:
|
|
|
38
44
|
- - ~>
|
|
39
45
|
- !ruby/object:Gem::Version
|
|
40
46
|
version: '1.0'
|
|
41
|
-
- !ruby/object:Gem::Dependency
|
|
42
|
-
name: jquery-rails
|
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
|
44
|
-
requirements:
|
|
45
|
-
- - ! '>='
|
|
46
|
-
- !ruby/object:Gem::Version
|
|
47
|
-
version: '2.0'
|
|
48
|
-
type: :runtime
|
|
49
|
-
prerelease: false
|
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
-
requirements:
|
|
52
|
-
- - ! '>='
|
|
53
|
-
- !ruby/object:Gem::Version
|
|
54
|
-
version: '2.0'
|
|
55
47
|
- !ruby/object:Gem::Dependency
|
|
56
48
|
name: aws-s3
|
|
57
49
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -70,34 +62,34 @@ dependencies:
|
|
|
70
62
|
name: rake
|
|
71
63
|
requirement: !ruby/object:Gem::Requirement
|
|
72
64
|
requirements:
|
|
73
|
-
- -
|
|
65
|
+
- - '>='
|
|
74
66
|
- !ruby/object:Gem::Version
|
|
75
67
|
version: 0.8.7
|
|
76
68
|
type: :development
|
|
77
69
|
prerelease: false
|
|
78
70
|
version_requirements: !ruby/object:Gem::Requirement
|
|
79
71
|
requirements:
|
|
80
|
-
- -
|
|
72
|
+
- - '>='
|
|
81
73
|
- !ruby/object:Gem::Version
|
|
82
74
|
version: 0.8.7
|
|
83
75
|
- !ruby/object:Gem::Dependency
|
|
84
76
|
name: bundler
|
|
85
77
|
requirement: !ruby/object:Gem::Requirement
|
|
86
78
|
requirements:
|
|
87
|
-
- -
|
|
79
|
+
- - '>='
|
|
88
80
|
- !ruby/object:Gem::Version
|
|
89
81
|
version: '0'
|
|
90
82
|
type: :development
|
|
91
83
|
prerelease: false
|
|
92
84
|
version_requirements: !ruby/object:Gem::Requirement
|
|
93
85
|
requirements:
|
|
94
|
-
- -
|
|
86
|
+
- - '>='
|
|
95
87
|
- !ruby/object:Gem::Version
|
|
96
88
|
version: '0'
|
|
97
89
|
description: Provides file uploads for Rails ~> 3.1 to AWS-S3 via CORS using the jQuery-File-Upload
|
|
98
90
|
javascript
|
|
99
91
|
email:
|
|
100
|
-
-
|
|
92
|
+
- batkinz@gmail.com
|
|
101
93
|
executables: []
|
|
102
94
|
extensions: []
|
|
103
95
|
extra_rdoc_files:
|
|
@@ -108,6 +100,7 @@ files:
|
|
|
108
100
|
- .document
|
|
109
101
|
- .gitignore
|
|
110
102
|
- .rspec
|
|
103
|
+
- .travis.yml
|
|
111
104
|
- CHANGELOG.md
|
|
112
105
|
- Gemfile
|
|
113
106
|
- Gemfile.lock
|
|
@@ -139,11 +132,21 @@ files:
|
|
|
139
132
|
- s3_cors_fileupload.gemspec
|
|
140
133
|
- spec/dummy/Rakefile
|
|
141
134
|
- spec/dummy/app/assets/javascripts/application.js
|
|
135
|
+
- spec/dummy/app/assets/javascripts/s3_uploads.js
|
|
142
136
|
- spec/dummy/app/assets/stylesheets/application.css
|
|
143
137
|
- spec/dummy/app/controllers/application_controller.rb
|
|
138
|
+
- spec/dummy/app/controllers/s3_uploads_controller.rb
|
|
144
139
|
- spec/dummy/app/helpers/application_helper.rb
|
|
145
140
|
- spec/dummy/app/models/.gitkeep
|
|
141
|
+
- spec/dummy/app/models/source_file.rb
|
|
146
142
|
- spec/dummy/app/views/layouts/application.html.erb
|
|
143
|
+
- spec/dummy/app/views/s3_uploads/_template_download.html.erb
|
|
144
|
+
- spec/dummy/app/views/s3_uploads/_template_upload.html.erb
|
|
145
|
+
- spec/dummy/app/views/s3_uploads/_template_uploaded.html.erb
|
|
146
|
+
- spec/dummy/app/views/s3_uploads/index.html.erb
|
|
147
|
+
- spec/dummy/bin/bundle
|
|
148
|
+
- spec/dummy/bin/rails
|
|
149
|
+
- spec/dummy/bin/rake
|
|
147
150
|
- spec/dummy/config.ru
|
|
148
151
|
- spec/dummy/config/amazon_s3.yml
|
|
149
152
|
- spec/dummy/config/application.rb
|
|
@@ -154,6 +157,7 @@ files:
|
|
|
154
157
|
- spec/dummy/config/environments/production.rb
|
|
155
158
|
- spec/dummy/config/environments/test.rb
|
|
156
159
|
- spec/dummy/config/initializers/backtrace_silencers.rb
|
|
160
|
+
- spec/dummy/config/initializers/filter_parameter_logging.rb
|
|
157
161
|
- spec/dummy/config/initializers/inflections.rb
|
|
158
162
|
- spec/dummy/config/initializers/mime_types.rb
|
|
159
163
|
- spec/dummy/config/initializers/secret_token.rb
|
|
@@ -162,18 +166,24 @@ files:
|
|
|
162
166
|
- spec/dummy/config/locales/en.yml
|
|
163
167
|
- spec/dummy/config/routes.rb
|
|
164
168
|
- spec/dummy/db/.gitkeep
|
|
169
|
+
- spec/dummy/db/migrate/20131001201535_create_source_files.rb
|
|
170
|
+
- spec/dummy/db/schema.rb
|
|
165
171
|
- spec/dummy/lib/assets/.gitkeep
|
|
166
172
|
- spec/dummy/log/.gitkeep
|
|
167
173
|
- spec/dummy/public/404.html
|
|
168
174
|
- spec/dummy/public/422.html
|
|
169
175
|
- spec/dummy/public/500.html
|
|
170
176
|
- spec/dummy/public/favicon.ico
|
|
171
|
-
- spec/
|
|
177
|
+
- spec/features/uploads_spec.rb
|
|
172
178
|
- spec/lib/generators/install/install_generator_spec.rb
|
|
173
179
|
- spec/lib/s3_cors_fileupload/rails/config_spec.rb
|
|
180
|
+
- spec/lib/s3_cors_fileupload/rails/engine_spec.rb
|
|
181
|
+
- spec/lib/s3_cors_fileupload/rails/form_helper_spec.rb
|
|
182
|
+
- spec/lib/s3_cors_fileupload/rails/policy_helper_spec.rb
|
|
174
183
|
- spec/lib/s3_cors_fileupload/version_spec.rb
|
|
175
184
|
- spec/s3_cors_fileupload_spec.rb
|
|
176
185
|
- spec/spec_helper.rb
|
|
186
|
+
- spec/support/dummy.pdf
|
|
177
187
|
- vendor/assets/images/loading.gif
|
|
178
188
|
- vendor/assets/images/progressbar.gif
|
|
179
189
|
- vendor/assets/javascripts/s3_cors_fileupload/index.js
|
|
@@ -184,6 +194,7 @@ files:
|
|
|
184
194
|
- vendor/assets/javascripts/s3_cors_fileupload/jquery.fileupload.js
|
|
185
195
|
- vendor/assets/javascripts/s3_cors_fileupload/jquery.iframe-transport.js
|
|
186
196
|
- vendor/assets/javascripts/s3_cors_fileupload/vendor/jquery.ui.widget.js
|
|
197
|
+
- vendor/assets/javascripts/s3_cors_fileupload/vendor/load-image-meta.js
|
|
187
198
|
- vendor/assets/javascripts/s3_cors_fileupload/vendor/load-image.js
|
|
188
199
|
- vendor/assets/javascripts/s3_cors_fileupload/vendor/tmpl.js
|
|
189
200
|
- vendor/assets/stylesheets/jquery.fileupload-ui.css.erb
|
|
@@ -198,17 +209,17 @@ require_paths:
|
|
|
198
209
|
- lib
|
|
199
210
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
200
211
|
requirements:
|
|
201
|
-
- -
|
|
212
|
+
- - '>='
|
|
202
213
|
- !ruby/object:Gem::Version
|
|
203
214
|
version: '0'
|
|
204
215
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
205
216
|
requirements:
|
|
206
|
-
- -
|
|
217
|
+
- - '>='
|
|
207
218
|
- !ruby/object:Gem::Version
|
|
208
219
|
version: '0'
|
|
209
220
|
requirements: []
|
|
210
221
|
rubyforge_project:
|
|
211
|
-
rubygems_version: 2.0.
|
|
222
|
+
rubygems_version: 2.0.4
|
|
212
223
|
signing_key:
|
|
213
224
|
specification_version: 4
|
|
214
225
|
summary: File uploads for Rails ~> 3.1 to AWS-S3 via CORS using the jQuery-File-Upload
|
|
@@ -216,11 +227,21 @@ summary: File uploads for Rails ~> 3.1 to AWS-S3 via CORS using the jQuery-File-
|
|
|
216
227
|
test_files:
|
|
217
228
|
- spec/dummy/Rakefile
|
|
218
229
|
- spec/dummy/app/assets/javascripts/application.js
|
|
230
|
+
- spec/dummy/app/assets/javascripts/s3_uploads.js
|
|
219
231
|
- spec/dummy/app/assets/stylesheets/application.css
|
|
220
232
|
- spec/dummy/app/controllers/application_controller.rb
|
|
233
|
+
- spec/dummy/app/controllers/s3_uploads_controller.rb
|
|
221
234
|
- spec/dummy/app/helpers/application_helper.rb
|
|
222
235
|
- spec/dummy/app/models/.gitkeep
|
|
236
|
+
- spec/dummy/app/models/source_file.rb
|
|
223
237
|
- spec/dummy/app/views/layouts/application.html.erb
|
|
238
|
+
- spec/dummy/app/views/s3_uploads/_template_download.html.erb
|
|
239
|
+
- spec/dummy/app/views/s3_uploads/_template_upload.html.erb
|
|
240
|
+
- spec/dummy/app/views/s3_uploads/_template_uploaded.html.erb
|
|
241
|
+
- spec/dummy/app/views/s3_uploads/index.html.erb
|
|
242
|
+
- spec/dummy/bin/bundle
|
|
243
|
+
- spec/dummy/bin/rails
|
|
244
|
+
- spec/dummy/bin/rake
|
|
224
245
|
- spec/dummy/config.ru
|
|
225
246
|
- spec/dummy/config/amazon_s3.yml
|
|
226
247
|
- spec/dummy/config/application.rb
|
|
@@ -231,6 +252,7 @@ test_files:
|
|
|
231
252
|
- spec/dummy/config/environments/production.rb
|
|
232
253
|
- spec/dummy/config/environments/test.rb
|
|
233
254
|
- spec/dummy/config/initializers/backtrace_silencers.rb
|
|
255
|
+
- spec/dummy/config/initializers/filter_parameter_logging.rb
|
|
234
256
|
- spec/dummy/config/initializers/inflections.rb
|
|
235
257
|
- spec/dummy/config/initializers/mime_types.rb
|
|
236
258
|
- spec/dummy/config/initializers/secret_token.rb
|
|
@@ -239,15 +261,21 @@ test_files:
|
|
|
239
261
|
- spec/dummy/config/locales/en.yml
|
|
240
262
|
- spec/dummy/config/routes.rb
|
|
241
263
|
- spec/dummy/db/.gitkeep
|
|
264
|
+
- spec/dummy/db/migrate/20131001201535_create_source_files.rb
|
|
265
|
+
- spec/dummy/db/schema.rb
|
|
242
266
|
- spec/dummy/lib/assets/.gitkeep
|
|
243
267
|
- spec/dummy/log/.gitkeep
|
|
244
268
|
- spec/dummy/public/404.html
|
|
245
269
|
- spec/dummy/public/422.html
|
|
246
270
|
- spec/dummy/public/500.html
|
|
247
271
|
- spec/dummy/public/favicon.ico
|
|
248
|
-
- spec/
|
|
272
|
+
- spec/features/uploads_spec.rb
|
|
249
273
|
- spec/lib/generators/install/install_generator_spec.rb
|
|
250
274
|
- spec/lib/s3_cors_fileupload/rails/config_spec.rb
|
|
275
|
+
- spec/lib/s3_cors_fileupload/rails/engine_spec.rb
|
|
276
|
+
- spec/lib/s3_cors_fileupload/rails/form_helper_spec.rb
|
|
277
|
+
- spec/lib/s3_cors_fileupload/rails/policy_helper_spec.rb
|
|
251
278
|
- spec/lib/s3_cors_fileupload/version_spec.rb
|
|
252
279
|
- spec/s3_cors_fileupload_spec.rb
|
|
253
280
|
- spec/spec_helper.rb
|
|
281
|
+
- spec/support/dummy.pdf
|