JCG-jquery-fileupload 0.0.1
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.md +72 -0
- data/Rakefile +15 -0
- data/lib/jquery-fileupload-rails.rb +8 -0
- data/lib/jquery/fileupload/rails/engine.rb +8 -0
- data/lib/jquery/fileupload/rails/middleware.rb +59 -0
- data/lib/jquery/fileupload/rails/upload.rb +3 -0
- data/lib/jquery/fileupload/rails/version.rb +7 -0
- data/vendor/assets/images/loading.gif +0 -0
- data/vendor/assets/images/progressbar.gif +0 -0
- data/vendor/assets/javascripts/jquery-fileupload/basic.js +4 -0
- data/vendor/assets/javascripts/jquery-fileupload/cors/jquery.postmessage-transport.js +117 -0
- data/vendor/assets/javascripts/jquery-fileupload/cors/jquery.xdr-transport.js +87 -0
- data/vendor/assets/javascripts/jquery-fileupload/index.js +9 -0
- data/vendor/assets/javascripts/jquery-fileupload/jquery.fileupload-fp.js +223 -0
- data/vendor/assets/javascripts/jquery-fileupload/jquery.fileupload-ui.js +799 -0
- data/vendor/assets/javascripts/jquery-fileupload/jquery.fileupload.js +1164 -0
- data/vendor/assets/javascripts/jquery-fileupload/jquery.iframe-transport.js +185 -0
- data/vendor/assets/javascripts/jquery-fileupload/locale.js +29 -0
- data/vendor/assets/javascripts/jquery-fileupload/vendor/canvas-to-blob.js +91 -0
- data/vendor/assets/javascripts/jquery-fileupload/vendor/jquery.ui.widget.js +530 -0
- data/vendor/assets/javascripts/jquery-fileupload/vendor/load-image.js +121 -0
- data/vendor/assets/javascripts/jquery-fileupload/vendor/tmpl.js +86 -0
- data/vendor/assets/stylesheets/jquery.fileupload-ui.scss +84 -0
- metadata +117 -0
@@ -0,0 +1,121 @@
|
|
1
|
+
/*
|
2
|
+
* JavaScript Load Image 1.2.1
|
3
|
+
* https://github.com/blueimp/JavaScript-Load-Image
|
4
|
+
*
|
5
|
+
* Copyright 2011, Sebastian Tschan
|
6
|
+
* https://blueimp.net
|
7
|
+
*
|
8
|
+
* Licensed under the MIT license:
|
9
|
+
* http://www.opensource.org/licenses/MIT
|
10
|
+
*/
|
11
|
+
|
12
|
+
/*jslint nomen: true */
|
13
|
+
/*global window, document, URL, webkitURL, Blob, File, FileReader, define */
|
14
|
+
|
15
|
+
(function ($) {
|
16
|
+
'use strict';
|
17
|
+
|
18
|
+
// Loads an image for a given File object.
|
19
|
+
// Invokes the callback with an img or optional canvas
|
20
|
+
// element (if supported by the browser) as parameter:
|
21
|
+
var loadImage = function (file, callback, options) {
|
22
|
+
var img = document.createElement('img'),
|
23
|
+
url,
|
24
|
+
oUrl;
|
25
|
+
img.onerror = callback;
|
26
|
+
img.onload = function () {
|
27
|
+
if (oUrl && !(options && options.noRevoke)) {
|
28
|
+
loadImage.revokeObjectURL(oUrl);
|
29
|
+
}
|
30
|
+
callback(loadImage.scale(img, options));
|
31
|
+
};
|
32
|
+
if ((window.Blob && file instanceof Blob) ||
|
33
|
+
// Files are also Blob instances, but some browsers
|
34
|
+
// (Firefox 3.6) support the File API but not Blobs:
|
35
|
+
(window.File && file instanceof File)) {
|
36
|
+
url = oUrl = loadImage.createObjectURL(file);
|
37
|
+
} else {
|
38
|
+
url = file;
|
39
|
+
}
|
40
|
+
if (url) {
|
41
|
+
img.src = url;
|
42
|
+
return img;
|
43
|
+
}
|
44
|
+
return loadImage.readFile(file, function (url) {
|
45
|
+
img.src = url;
|
46
|
+
});
|
47
|
+
},
|
48
|
+
// The check for URL.revokeObjectURL fixes an issue with Opera 12,
|
49
|
+
// which provides URL.createObjectURL but doesn't properly implement it:
|
50
|
+
urlAPI = (window.createObjectURL && window) ||
|
51
|
+
(window.URL && URL.revokeObjectURL && URL) ||
|
52
|
+
(window.webkitURL && webkitURL);
|
53
|
+
|
54
|
+
// Scales the given image (img or canvas HTML element)
|
55
|
+
// using the given options.
|
56
|
+
// Returns a canvas object if the browser supports canvas
|
57
|
+
// and the canvas option is true or a canvas object is passed
|
58
|
+
// as image, else the scaled image:
|
59
|
+
loadImage.scale = function (img, options) {
|
60
|
+
options = options || {};
|
61
|
+
var canvas = document.createElement('canvas'),
|
62
|
+
width = img.width,
|
63
|
+
height = img.height,
|
64
|
+
scale = Math.max(
|
65
|
+
(options.minWidth || width) / width,
|
66
|
+
(options.minHeight || height) / height
|
67
|
+
);
|
68
|
+
if (scale > 1) {
|
69
|
+
width = parseInt(width * scale, 10);
|
70
|
+
height = parseInt(height * scale, 10);
|
71
|
+
}
|
72
|
+
scale = Math.min(
|
73
|
+
(options.maxWidth || width) / width,
|
74
|
+
(options.maxHeight || height) / height
|
75
|
+
);
|
76
|
+
if (scale < 1) {
|
77
|
+
width = parseInt(width * 1, 10);
|
78
|
+
height = parseInt(height * 1, 10);
|
79
|
+
}
|
80
|
+
if (img.getContext || (options.canvas && canvas.getContext)) {
|
81
|
+
canvas.width = width;
|
82
|
+
canvas.height = height;
|
83
|
+
canvas.getContext('2d')
|
84
|
+
.drawImage(img, 0, 0, width, height);
|
85
|
+
return canvas;
|
86
|
+
}
|
87
|
+
img.width = width;
|
88
|
+
img.height = height;
|
89
|
+
return img;
|
90
|
+
};
|
91
|
+
|
92
|
+
loadImage.createObjectURL = function (file) {
|
93
|
+
return urlAPI ? urlAPI.createObjectURL(file) : false;
|
94
|
+
};
|
95
|
+
|
96
|
+
loadImage.revokeObjectURL = function (url) {
|
97
|
+
return urlAPI ? urlAPI.revokeObjectURL(url) : false;
|
98
|
+
};
|
99
|
+
|
100
|
+
// Loads a given File object via FileReader interface,
|
101
|
+
// invokes the callback with a data url:
|
102
|
+
loadImage.readFile = function (file, callback) {
|
103
|
+
if (window.FileReader && FileReader.prototype.readAsDataURL) {
|
104
|
+
var fileReader = new FileReader();
|
105
|
+
fileReader.onload = function (e) {
|
106
|
+
callback(e.target.result);
|
107
|
+
};
|
108
|
+
fileReader.readAsDataURL(file);
|
109
|
+
return fileReader;
|
110
|
+
}
|
111
|
+
return false;
|
112
|
+
};
|
113
|
+
|
114
|
+
if (typeof define === 'function' && define.amd) {
|
115
|
+
define(function () {
|
116
|
+
return loadImage;
|
117
|
+
});
|
118
|
+
} else {
|
119
|
+
$.loadImage = loadImage;
|
120
|
+
}
|
121
|
+
}(this));
|
@@ -0,0 +1,86 @@
|
|
1
|
+
/*
|
2
|
+
* JavaScript Templates 2.1.0
|
3
|
+
* https://github.com/blueimp/JavaScript-Templates
|
4
|
+
*
|
5
|
+
* Copyright 2011, Sebastian Tschan
|
6
|
+
* https://blueimp.net
|
7
|
+
*
|
8
|
+
* Licensed under the MIT license:
|
9
|
+
* http://www.opensource.org/licenses/MIT
|
10
|
+
*
|
11
|
+
* Inspired by John Resig's JavaScript Micro-Templating:
|
12
|
+
* http://ejohn.org/blog/javascript-micro-templating/
|
13
|
+
*/
|
14
|
+
|
15
|
+
/*jslint evil: true, regexp: true */
|
16
|
+
/*global document, define */
|
17
|
+
|
18
|
+
(function ($) {
|
19
|
+
"use strict";
|
20
|
+
var tmpl = function (str, data) {
|
21
|
+
var f = !/[^\w\-\.:]/.test(str) ? tmpl.cache[str] = tmpl.cache[str] ||
|
22
|
+
tmpl(tmpl.load(str)) :
|
23
|
+
new Function(
|
24
|
+
tmpl.arg + ',tmpl',
|
25
|
+
"var _e=tmpl.encode" + tmpl.helper + ",_s='" +
|
26
|
+
str.replace(tmpl.regexp, tmpl.func) +
|
27
|
+
"';return _s;"
|
28
|
+
);
|
29
|
+
return data ? f(data, tmpl) : function (data) {
|
30
|
+
return f(data, tmpl);
|
31
|
+
};
|
32
|
+
};
|
33
|
+
tmpl.cache = {};
|
34
|
+
tmpl.load = function (id) {
|
35
|
+
return document.getElementById(id).innerHTML;
|
36
|
+
};
|
37
|
+
tmpl.regexp = /([\s'\\])(?![^%]*%\})|(?:\{%(=|#)([\s\S]+?)%\})|(\{%)|(%\})/g;
|
38
|
+
tmpl.func = function (s, p1, p2, p3, p4, p5) {
|
39
|
+
if (p1) { // whitespace, quote and backspace in interpolation context
|
40
|
+
return {
|
41
|
+
"\n": "\\n",
|
42
|
+
"\r": "\\r",
|
43
|
+
"\t": "\\t",
|
44
|
+
" " : " "
|
45
|
+
}[s] || "\\" + s;
|
46
|
+
}
|
47
|
+
if (p2) { // interpolation: {%=prop%}, or unescaped: {%#prop%}
|
48
|
+
if (p2 === "=") {
|
49
|
+
return "'+_e(" + p3 + ")+'";
|
50
|
+
}
|
51
|
+
return "'+(" + p3 + "||'')+'";
|
52
|
+
}
|
53
|
+
if (p4) { // evaluation start tag: {%
|
54
|
+
return "';";
|
55
|
+
}
|
56
|
+
if (p5) { // evaluation end tag: %}
|
57
|
+
return "_s+='";
|
58
|
+
}
|
59
|
+
};
|
60
|
+
tmpl.encReg = /[<>&"'\x00]/g;
|
61
|
+
tmpl.encMap = {
|
62
|
+
"<" : "<",
|
63
|
+
">" : ">",
|
64
|
+
"&" : "&",
|
65
|
+
"\"" : """,
|
66
|
+
"'" : "'"
|
67
|
+
};
|
68
|
+
tmpl.encode = function (s) {
|
69
|
+
return String(s || "").replace(
|
70
|
+
tmpl.encReg,
|
71
|
+
function (c) {
|
72
|
+
return tmpl.encMap[c] || "";
|
73
|
+
}
|
74
|
+
);
|
75
|
+
};
|
76
|
+
tmpl.arg = "o";
|
77
|
+
tmpl.helper = ",print=function(s,e){_s+=e&&(s||'')||_e(s);}" +
|
78
|
+
",include=function(s,d){_s+=tmpl(s,d);}";
|
79
|
+
if (typeof define === "function" && define.amd) {
|
80
|
+
define(function () {
|
81
|
+
return tmpl;
|
82
|
+
});
|
83
|
+
} else {
|
84
|
+
$.tmpl = tmpl;
|
85
|
+
}
|
86
|
+
}(this));
|
@@ -0,0 +1,84 @@
|
|
1
|
+
@charset 'UTF-8';
|
2
|
+
/*
|
3
|
+
* jQuery File Upload UI Plugin CSS 6.3
|
4
|
+
* https://github.com/blueimp/jQuery-File-Upload
|
5
|
+
*
|
6
|
+
* Copyright 2010, Sebastian Tschan
|
7
|
+
* https://blueimp.net
|
8
|
+
*
|
9
|
+
* Licensed under the MIT license:
|
10
|
+
* http://www.opensource.org/licenses/MIT
|
11
|
+
*/
|
12
|
+
|
13
|
+
.fileinput-button {
|
14
|
+
position: relative;
|
15
|
+
overflow: hidden;
|
16
|
+
float: left;
|
17
|
+
margin-right: 4px;
|
18
|
+
}
|
19
|
+
.fileinput-button input {
|
20
|
+
position: absolute;
|
21
|
+
top: 0;
|
22
|
+
right: 0;
|
23
|
+
margin: 0;
|
24
|
+
border: solid transparent;
|
25
|
+
border-width: 0 0 100px 200px;
|
26
|
+
opacity: 0;
|
27
|
+
filter: alpha(opacity=0);
|
28
|
+
-moz-transform: translate(-300px, 0) scale(4);
|
29
|
+
direction: ltr;
|
30
|
+
cursor: pointer;
|
31
|
+
}
|
32
|
+
.fileupload-buttonbar .btn,
|
33
|
+
.fileupload-buttonbar .toggle {
|
34
|
+
margin-bottom: 5px;
|
35
|
+
}
|
36
|
+
.files .progress {
|
37
|
+
width: 200px;
|
38
|
+
}
|
39
|
+
.progress-animated .bar {
|
40
|
+
background: image-url('progressbar.gif') !important;
|
41
|
+
filter: none;
|
42
|
+
}
|
43
|
+
.fileupload-loading {
|
44
|
+
position: absolute;
|
45
|
+
left: 50%;
|
46
|
+
width: 128px;
|
47
|
+
height: 128px;
|
48
|
+
background: image-url('loading.gif') center no-repeat;
|
49
|
+
display: none;
|
50
|
+
}
|
51
|
+
.fileupload-processing .fileupload-loading {
|
52
|
+
display: block;
|
53
|
+
}
|
54
|
+
|
55
|
+
/* Fix for IE 6: */
|
56
|
+
* html .fileinput-button {
|
57
|
+
line-height: 22px;
|
58
|
+
margin: 1px -3px 0 0;
|
59
|
+
}
|
60
|
+
|
61
|
+
/* Fix for IE 7: */
|
62
|
+
* + html .fileinput-button {
|
63
|
+
margin: 1px 0 0 0;
|
64
|
+
}
|
65
|
+
|
66
|
+
@media (max-width: 480px) {
|
67
|
+
.files .btn span {
|
68
|
+
display: none;
|
69
|
+
}
|
70
|
+
.files .preview * {
|
71
|
+
width: 40px;
|
72
|
+
}
|
73
|
+
.files .name * {
|
74
|
+
width: 80px;
|
75
|
+
display: inline-block;
|
76
|
+
word-wrap: break-word;
|
77
|
+
}
|
78
|
+
.files .progress {
|
79
|
+
width: 20px;
|
80
|
+
}
|
81
|
+
.files .delete {
|
82
|
+
width: 60px;
|
83
|
+
}
|
84
|
+
}
|
metadata
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: JCG-jquery-fileupload
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Tors Dalid; edited by JCG
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-11-26 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: railties
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '3.1'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '3.1'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: actionpack
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '3.1'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '3.1'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rails
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '3.1'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.1'
|
62
|
+
description: jQuery File Upload by Sebastian Tschan integrated for Rails 3.1 Asset
|
63
|
+
Pipeline, edited for deployment in JCG web applications
|
64
|
+
email:
|
65
|
+
- jessica@jcgfund.com
|
66
|
+
executables: []
|
67
|
+
extensions: []
|
68
|
+
extra_rdoc_files: []
|
69
|
+
files:
|
70
|
+
- lib/jquery/fileupload/rails/engine.rb
|
71
|
+
- lib/jquery/fileupload/rails/middleware.rb
|
72
|
+
- lib/jquery/fileupload/rails/upload.rb
|
73
|
+
- lib/jquery/fileupload/rails/version.rb
|
74
|
+
- lib/jquery-fileupload-rails.rb
|
75
|
+
- vendor/assets/images/loading.gif
|
76
|
+
- vendor/assets/images/progressbar.gif
|
77
|
+
- vendor/assets/javascripts/jquery-fileupload/basic.js
|
78
|
+
- vendor/assets/javascripts/jquery-fileupload/cors/jquery.postmessage-transport.js
|
79
|
+
- vendor/assets/javascripts/jquery-fileupload/cors/jquery.xdr-transport.js
|
80
|
+
- vendor/assets/javascripts/jquery-fileupload/index.js
|
81
|
+
- vendor/assets/javascripts/jquery-fileupload/jquery.fileupload-fp.js
|
82
|
+
- vendor/assets/javascripts/jquery-fileupload/jquery.fileupload-ui.js
|
83
|
+
- vendor/assets/javascripts/jquery-fileupload/jquery.fileupload.js
|
84
|
+
- vendor/assets/javascripts/jquery-fileupload/jquery.iframe-transport.js
|
85
|
+
- vendor/assets/javascripts/jquery-fileupload/locale.js
|
86
|
+
- vendor/assets/javascripts/jquery-fileupload/vendor/canvas-to-blob.js
|
87
|
+
- vendor/assets/javascripts/jquery-fileupload/vendor/jquery.ui.widget.js
|
88
|
+
- vendor/assets/javascripts/jquery-fileupload/vendor/load-image.js
|
89
|
+
- vendor/assets/javascripts/jquery-fileupload/vendor/tmpl.js
|
90
|
+
- vendor/assets/stylesheets/jquery.fileupload-ui.scss
|
91
|
+
- Rakefile
|
92
|
+
- README.md
|
93
|
+
homepage:
|
94
|
+
licenses: []
|
95
|
+
post_install_message:
|
96
|
+
rdoc_options: []
|
97
|
+
require_paths:
|
98
|
+
- lib
|
99
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
100
|
+
none: false
|
101
|
+
requirements:
|
102
|
+
- - ! '>='
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
|
+
none: false
|
107
|
+
requirements:
|
108
|
+
- - ! '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
requirements: []
|
112
|
+
rubyforge_project:
|
113
|
+
rubygems_version: 1.8.24
|
114
|
+
signing_key:
|
115
|
+
specification_version: 3
|
116
|
+
summary: jQuery File Upload for Rails 3.1 Asset Pipeline
|
117
|
+
test_files: []
|