blueimp-file-upload-rails 8.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,205 @@
1
+ /*
2
+ * jQuery Iframe Transport Plugin 1.7
3
+ * https://github.com/blueimp/jQuery-File-Upload
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 unparam: true, nomen: true */
13
+ /*global define, window, document */
14
+
15
+ (function (factory) {
16
+ 'use strict';
17
+ if (typeof define === 'function' && define.amd) {
18
+ // Register as an anonymous AMD module:
19
+ define(['jquery'], factory);
20
+ } else {
21
+ // Browser globals:
22
+ factory(window.jQuery);
23
+ }
24
+ }(function ($) {
25
+ 'use strict';
26
+
27
+ // Helper variable to create unique names for the transport iframes:
28
+ var counter = 0;
29
+
30
+ // The iframe transport accepts three additional options:
31
+ // options.fileInput: a jQuery collection of file input fields
32
+ // options.paramName: the parameter name for the file form data,
33
+ // overrides the name property of the file input field(s),
34
+ // can be a string or an array of strings.
35
+ // options.formData: an array of objects with name and value properties,
36
+ // equivalent to the return data of .serializeArray(), e.g.:
37
+ // [{name: 'a', value: 1}, {name: 'b', value: 2}]
38
+ $.ajaxTransport('iframe', function (options) {
39
+ if (options.async) {
40
+ var form,
41
+ iframe,
42
+ addParamChar;
43
+ return {
44
+ send: function (_, completeCallback) {
45
+ form = $('<form style="display:none;"></form>');
46
+ form.attr('accept-charset', options.formAcceptCharset);
47
+ addParamChar = /\?/.test(options.url) ? '&' : '?';
48
+ // XDomainRequest only supports GET and POST:
49
+ if (options.type === 'DELETE') {
50
+ options.url = options.url + addParamChar + '_method=DELETE';
51
+ options.type = 'POST';
52
+ } else if (options.type === 'PUT') {
53
+ options.url = options.url + addParamChar + '_method=PUT';
54
+ options.type = 'POST';
55
+ } else if (options.type === 'PATCH') {
56
+ options.url = options.url + addParamChar + '_method=PATCH';
57
+ options.type = 'POST';
58
+ }
59
+ // javascript:false as initial iframe src
60
+ // prevents warning popups on HTTPS in IE6.
61
+ // IE versions below IE8 cannot set the name property of
62
+ // elements that have already been added to the DOM,
63
+ // so we set the name along with the iframe HTML markup:
64
+ counter += 1;
65
+ iframe = $(
66
+ '<iframe src="javascript:false;" name="iframe-transport-' +
67
+ counter + '"></iframe>'
68
+ ).bind('load', function () {
69
+ var fileInputClones,
70
+ paramNames = $.isArray(options.paramName) ?
71
+ options.paramName : [options.paramName];
72
+ iframe
73
+ .unbind('load')
74
+ .bind('load', function () {
75
+ var response;
76
+ // Wrap in a try/catch block to catch exceptions thrown
77
+ // when trying to access cross-domain iframe contents:
78
+ try {
79
+ response = iframe.contents();
80
+ // Google Chrome and Firefox do not throw an
81
+ // exception when calling iframe.contents() on
82
+ // cross-domain requests, so we unify the response:
83
+ if (!response.length || !response[0].firstChild) {
84
+ throw new Error();
85
+ }
86
+ } catch (e) {
87
+ response = undefined;
88
+ }
89
+ // The complete callback returns the
90
+ // iframe content document as response object:
91
+ completeCallback(
92
+ 200,
93
+ 'success',
94
+ {'iframe': response}
95
+ );
96
+ // Fix for IE endless progress bar activity bug
97
+ // (happens on form submits to iframe targets):
98
+ $('<iframe src="javascript:false;"></iframe>')
99
+ .appendTo(form);
100
+ window.setTimeout(function () {
101
+ // Removing the form in a setTimeout call
102
+ // allows Chrome's developer tools to display
103
+ // the response result
104
+ form.remove();
105
+ }, 0);
106
+ });
107
+ form
108
+ .prop('target', iframe.prop('name'))
109
+ .prop('action', options.url)
110
+ .prop('method', options.type);
111
+ if (options.formData) {
112
+ $.each(options.formData, function (index, field) {
113
+ $('<input type="hidden"/>')
114
+ .prop('name', field.name)
115
+ .val(field.value)
116
+ .appendTo(form);
117
+ });
118
+ }
119
+ if (options.fileInput && options.fileInput.length &&
120
+ options.type === 'POST') {
121
+ fileInputClones = options.fileInput.clone();
122
+ // Insert a clone for each file input field:
123
+ options.fileInput.after(function (index) {
124
+ return fileInputClones[index];
125
+ });
126
+ if (options.paramName) {
127
+ options.fileInput.each(function (index) {
128
+ $(this).prop(
129
+ 'name',
130
+ paramNames[index] || options.paramName
131
+ );
132
+ });
133
+ }
134
+ // Appending the file input fields to the hidden form
135
+ // removes them from their original location:
136
+ form
137
+ .append(options.fileInput)
138
+ .prop('enctype', 'multipart/form-data')
139
+ // enctype must be set as encoding for IE:
140
+ .prop('encoding', 'multipart/form-data');
141
+ }
142
+ form.submit();
143
+ // Insert the file input fields at their original location
144
+ // by replacing the clones with the originals:
145
+ if (fileInputClones && fileInputClones.length) {
146
+ options.fileInput.each(function (index, input) {
147
+ var clone = $(fileInputClones[index]);
148
+ $(input).prop('name', clone.prop('name'));
149
+ clone.replaceWith(input);
150
+ });
151
+ }
152
+ });
153
+ form.append(iframe).appendTo(document.body);
154
+ },
155
+ abort: function () {
156
+ if (iframe) {
157
+ // javascript:false as iframe src aborts the request
158
+ // and prevents warning popups on HTTPS in IE6.
159
+ // concat is used to avoid the "Script URL" JSLint error:
160
+ iframe
161
+ .unbind('load')
162
+ .prop('src', 'javascript'.concat(':false;'));
163
+ }
164
+ if (form) {
165
+ form.remove();
166
+ }
167
+ }
168
+ };
169
+ }
170
+ });
171
+
172
+ // The iframe transport returns the iframe content document as response.
173
+ // The following adds converters from iframe to text, json, html, xml
174
+ // and script.
175
+ // Please note that the Content-Type for JSON responses has to be text/plain
176
+ // or text/html, if the browser doesn't include application/json in the
177
+ // Accept header, else IE will show a download dialog.
178
+ // The Content-Type for XML responses on the other hand has to be always
179
+ // application/xml or text/xml, so IE properly parses the XML response.
180
+ // See also
181
+ // https://github.com/blueimp/jQuery-File-Upload/wiki/Setup#content-type-negotiation
182
+ $.ajaxSetup({
183
+ converters: {
184
+ 'iframe text': function (iframe) {
185
+ return iframe && $(iframe[0].body).text();
186
+ },
187
+ 'iframe json': function (iframe) {
188
+ return iframe && $.parseJSON($(iframe[0].body).text());
189
+ },
190
+ 'iframe html': function (iframe) {
191
+ return iframe && $(iframe[0].body).html();
192
+ },
193
+ 'iframe xml': function (iframe) {
194
+ var xmlDoc = iframe && iframe[0];
195
+ return xmlDoc && $.isXMLDoc(xmlDoc) ? xmlDoc :
196
+ $.parseXML((xmlDoc.XMLDocument && xmlDoc.XMLDocument.xml) ||
197
+ $(xmlDoc.body).html());
198
+ },
199
+ 'iframe script': function (iframe) {
200
+ return iframe && $.globalEval($(iframe[0].body).text());
201
+ }
202
+ }
203
+ });
204
+
205
+ }));
@@ -0,0 +1,3 @@
1
+ /*
2
+ *= require jquery.fileupload-ui
3
+ */
@@ -0,0 +1,27 @@
1
+ @charset "UTF-8";
2
+ /*
3
+ * jQuery File Upload UI Plugin NoScript CSS 1.0
4
+ * https://github.com/blueimp/jQuery-File-Upload
5
+ *
6
+ * Copyright 2012, 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 input {
14
+ position: static;
15
+ opacity: 1;
16
+ filter: none;
17
+ transform: none;
18
+ font-size: inherit;
19
+ direction: inherit;
20
+ }
21
+
22
+ .fileinput-button span,
23
+ .fileinput-button i,
24
+ .fileupload-buttonbar .delete,
25
+ .fileupload-buttonbar .toggle {
26
+ display: none;
27
+ }
@@ -0,0 +1,67 @@
1
+ @charset "UTF-8";
2
+ /*
3
+ * jQuery File Upload UI Plugin CSS 8.1
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
+ }
17
+ .fileinput-button input {
18
+ position: absolute;
19
+ top: 0;
20
+ right: 0;
21
+ margin: 0;
22
+ opacity: 0;
23
+ filter: alpha(opacity=0);
24
+ transform: translate(-300px, 0) scale(4);
25
+ font-size: 23px;
26
+ direction: ltr;
27
+ cursor: pointer;
28
+ }
29
+ .fileupload-buttonbar .btn,
30
+ .fileupload-buttonbar .toggle {
31
+ margin-bottom: 5px;
32
+ }
33
+ .progress-animated .bar {
34
+ background: url(<%= image_path("progressbar.gif") %>) !important;
35
+ filter: none;
36
+ }
37
+ .fileupload-loading {
38
+ float: right;
39
+ width: 32px;
40
+ height: 32px;
41
+ background: url(<%= image_path("loading.gif") %>) center no-repeat;
42
+ background-size: contain;
43
+ display: none;
44
+ }
45
+ .fileupload-processing .fileupload-loading {
46
+ display: block;
47
+ }
48
+ .files audio,
49
+ .files video {
50
+ max-width: 300px;
51
+ }
52
+
53
+ @media (max-width: 767px) {
54
+ .fileupload-buttonbar .toggle,
55
+ .files .toggle,
56
+ .files .btn span {
57
+ display: none;
58
+ }
59
+ .files .name {
60
+ width: 80px;
61
+ word-wrap: break-word;
62
+ }
63
+ .files audio,
64
+ .files video {
65
+ max-width: 80px;
66
+ }
67
+ }
metadata ADDED
@@ -0,0 +1,159 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: blueimp-file-upload-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 8.5.0
5
+ platform: ruby
6
+ authors:
7
+ - Sebastian Tschan
8
+ - Mike Virata-Stone
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-07-11 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: railties
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - '>='
19
+ - !ruby/object:Gem::Version
20
+ version: '3.0'
21
+ - - <
22
+ - !ruby/object:Gem::Version
23
+ version: '5.0'
24
+ type: :runtime
25
+ prerelease: false
26
+ version_requirements: !ruby/object:Gem::Requirement
27
+ requirements:
28
+ - - '>='
29
+ - !ruby/object:Gem::Version
30
+ version: '3.0'
31
+ - - <
32
+ - !ruby/object:Gem::Version
33
+ version: '5.0'
34
+ - !ruby/object:Gem::Dependency
35
+ name: blueimp-load-image-rails
36
+ requirement: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ type: :runtime
42
+ prerelease: false
43
+ version_requirements: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ - !ruby/object:Gem::Dependency
49
+ name: blueimp-templates-rails
50
+ requirement: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :runtime
56
+ prerelease: false
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: blueimp-canvas-to-blob-rails
64
+ requirement: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ type: :runtime
70
+ prerelease: false
71
+ version_requirements: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ - !ruby/object:Gem::Dependency
77
+ name: jquery-rails
78
+ requirement: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ type: :runtime
84
+ prerelease: false
85
+ version_requirements: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ - !ruby/object:Gem::Dependency
91
+ name: jquery-ui-rails
92
+ requirement: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ type: :runtime
98
+ prerelease: false
99
+ version_requirements: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ description: This gem wraps the blueimp jQuery File Upload plugin as a Rails asset
105
+ gem. The plugin is by Sebastian Tschan, and the gem is packaged by Mike Virata-Stone.
106
+ email:
107
+ - mail@blueimp.net
108
+ - mike@virata-stone.com
109
+ executables: []
110
+ extensions: []
111
+ extra_rdoc_files: []
112
+ files:
113
+ - lib/blueimp-file-upload-rails.rb
114
+ - lib/blueimp-file-upload-rails/version.rb
115
+ - vendor/assets/images/loading.gif
116
+ - vendor/assets/images/progressbar.gif
117
+ - vendor/assets/javascripts/blueimp-file-upload-basic-plus-ui.js
118
+ - vendor/assets/javascripts/cors/jquery.postmessage-transport.js
119
+ - vendor/assets/javascripts/cors/jquery.xdr-transport.js
120
+ - vendor/assets/javascripts/jquery.fileupload-angular.js
121
+ - vendor/assets/javascripts/jquery.fileupload-audio.js
122
+ - vendor/assets/javascripts/jquery.fileupload-image.js
123
+ - vendor/assets/javascripts/jquery.fileupload-process.js
124
+ - vendor/assets/javascripts/jquery.fileupload-ui.js
125
+ - vendor/assets/javascripts/jquery.fileupload-validate.js
126
+ - vendor/assets/javascripts/jquery.fileupload-video.js
127
+ - vendor/assets/javascripts/jquery.fileupload.js
128
+ - vendor/assets/javascripts/jquery.iframe-transport.js
129
+ - vendor/assets/stylesheets/blueimp-file-upload.css
130
+ - vendor/assets/stylesheets/jquery.fileupload-ui-noscript.css
131
+ - vendor/assets/stylesheets/jquery.fileupload-ui.css.erb
132
+ - app/models/blueimp/file_upload/file.rb
133
+ - app/views/blueimp/_file_upload.html.erb
134
+ - app/views/blueimp/_file_upload_templates.html.erb
135
+ homepage: https://github.com/blueimp/jQuery-File-Upload
136
+ licenses:
137
+ - MIT
138
+ metadata: {}
139
+ post_install_message:
140
+ rdoc_options: []
141
+ require_paths:
142
+ - lib
143
+ required_ruby_version: !ruby/object:Gem::Requirement
144
+ requirements:
145
+ - - '>='
146
+ - !ruby/object:Gem::Version
147
+ version: '0'
148
+ required_rubygems_version: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - '>='
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ requirements: []
154
+ rubyforge_project:
155
+ rubygems_version: 2.0.3
156
+ signing_key:
157
+ specification_version: 4
158
+ summary: Rails asset gem for blueimp jQuery File Upload.
159
+ test_files: []