glebtv-rails-uploader 0.1.3 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +17 -10
  3. data/{vendor → app}/assets/images/uploader/but_del_tag2.png +0 -0
  4. data/{vendor → app}/assets/images/uploader/ico_attach.png +0 -0
  5. data/{vendor → app}/assets/images/uploader/preloader.gif +0 -0
  6. data/{vendor → app}/assets/images/uploader/progressBarFillBg.png +0 -0
  7. data/app/assets/javascripts/uploader/application.js +2 -2
  8. data/app/assets/javascripts/uploader/canvas-to-blob.js +95 -0
  9. data/app/assets/javascripts/uploader/jquery.fileupload-angular.js +348 -0
  10. data/app/assets/javascripts/uploader/jquery.fileupload-process.js +158 -0
  11. data/app/assets/javascripts/uploader/jquery.fileupload-resize.js +212 -0
  12. data/{vendor → app}/assets/javascripts/uploader/jquery.fileupload-ui.js +265 -269
  13. data/app/assets/javascripts/uploader/jquery.fileupload-validate.js +116 -0
  14. data/{vendor → app}/assets/javascripts/uploader/jquery.fileupload.js +655 -258
  15. data/{vendor → app}/assets/javascripts/uploader/jquery.iframe-transport.js +29 -9
  16. data/app/assets/javascripts/uploader/jquery.ui.widget.js +530 -0
  17. data/app/assets/javascripts/uploader/load-image.js +381 -0
  18. data/{vendor → app}/assets/javascripts/uploader/locales/en.js +0 -0
  19. data/{vendor → app}/assets/javascripts/uploader/locales/ru.js +0 -0
  20. data/{vendor → app}/assets/javascripts/uploader/locales/uk.js +0 -0
  21. data/app/assets/javascripts/uploader/rails_admin.js +26 -24
  22. data/app/assets/javascripts/uploader/tmpl.js +86 -0
  23. data/{vendor → app}/assets/stylesheets/uploader/default.css +0 -0
  24. data/{vendor → app}/assets/stylesheets/uploader/jquery.fileupload-ui.css +0 -0
  25. data/app/controllers/uploader/attachments_controller.rb +13 -10
  26. data/app/views/rails_admin/main/_form_rails_uploader.haml +9 -9
  27. data/app/views/uploader/default/_container.html.erb +1 -2
  28. data/app/views/uploader/default/_download.html.erb +1 -1
  29. data/lib/uploader/asset.rb +2 -2
  30. data/lib/uploader/engine.rb +4 -4
  31. data/lib/uploader/fileuploads.rb +18 -18
  32. data/lib/uploader/helpers/field_tag.rb +16 -17
  33. data/lib/uploader/helpers/form_builder.rb +1 -1
  34. data/lib/uploader/helpers/form_tag_helper.rb +1 -1
  35. data/lib/uploader/hooks/formtastic.rb +1 -2
  36. data/lib/uploader/rails_admin/field.rb +27 -27
  37. data/lib/uploader/version.rb +1 -1
  38. metadata +115 -131
  39. data/vendor/assets/javascripts/uploader/jquery.fileupload-ip.js +0 -160
  40. data/vendor/assets/javascripts/uploader/jquery.ui.widget.js +0 -282
  41. data/vendor/assets/javascripts/uploader/load-image.min.js +0 -1
  42. data/vendor/assets/javascripts/uploader/tmpl.min.js +0 -1
@@ -1,282 +0,0 @@
1
- /*
2
- * jQuery UI Widget 1.8.18+amd
3
- * https://github.com/blueimp/jQuery-File-Upload
4
- *
5
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
6
- * Dual licensed under the MIT or GPL Version 2 licenses.
7
- * http://jquery.org/license
8
- *
9
- * http://docs.jquery.com/UI/Widget
10
- */
11
-
12
- (function (factory) {
13
- if (typeof define === "function" && define.amd) {
14
- // Register as an anonymous AMD module:
15
- define(["jquery"], factory);
16
- } else {
17
- // Browser globals:
18
- factory(jQuery);
19
- }
20
- }(function( $, undefined ) {
21
-
22
- // jQuery 1.4+
23
- if ( $.cleanData ) {
24
- var _cleanData = $.cleanData;
25
- $.cleanData = function( elems ) {
26
- for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
27
- try {
28
- $( elem ).triggerHandler( "remove" );
29
- // http://bugs.jquery.com/ticket/8235
30
- } catch( e ) {}
31
- }
32
- _cleanData( elems );
33
- };
34
- } else {
35
- var _remove = $.fn.remove;
36
- $.fn.remove = function( selector, keepData ) {
37
- return this.each(function() {
38
- if ( !keepData ) {
39
- if ( !selector || $.filter( selector, [ this ] ).length ) {
40
- $( "*", this ).add( [ this ] ).each(function() {
41
- try {
42
- $( this ).triggerHandler( "remove" );
43
- // http://bugs.jquery.com/ticket/8235
44
- } catch( e ) {}
45
- });
46
- }
47
- }
48
- return _remove.call( $(this), selector, keepData );
49
- });
50
- };
51
- }
52
-
53
- $.widget = function( name, base, prototype ) {
54
- var namespace = name.split( "." )[ 0 ],
55
- fullName;
56
- name = name.split( "." )[ 1 ];
57
- fullName = namespace + "-" + name;
58
-
59
- if ( !prototype ) {
60
- prototype = base;
61
- base = $.Widget;
62
- }
63
-
64
- // create selector for plugin
65
- $.expr[ ":" ][ fullName ] = function( elem ) {
66
- return !!$.data( elem, name );
67
- };
68
-
69
- $[ namespace ] = $[ namespace ] || {};
70
- $[ namespace ][ name ] = function( options, element ) {
71
- // allow instantiation without initializing for simple inheritance
72
- if ( arguments.length ) {
73
- this._createWidget( options, element );
74
- }
75
- };
76
-
77
- var basePrototype = new base();
78
- // we need to make the options hash a property directly on the new instance
79
- // otherwise we'll modify the options hash on the prototype that we're
80
- // inheriting from
81
- // $.each( basePrototype, function( key, val ) {
82
- // if ( $.isPlainObject(val) ) {
83
- // basePrototype[ key ] = $.extend( {}, val );
84
- // }
85
- // });
86
- basePrototype.options = $.extend( true, {}, basePrototype.options );
87
- $[ namespace ][ name ].prototype = $.extend( true, basePrototype, {
88
- namespace: namespace,
89
- widgetName: name,
90
- widgetEventPrefix: $[ namespace ][ name ].prototype.widgetEventPrefix || name,
91
- widgetBaseClass: fullName
92
- }, prototype );
93
-
94
- $.widget.bridge( name, $[ namespace ][ name ] );
95
- };
96
-
97
- $.widget.bridge = function( name, object ) {
98
- $.fn[ name ] = function( options ) {
99
- var isMethodCall = typeof options === "string",
100
- args = Array.prototype.slice.call( arguments, 1 ),
101
- returnValue = this;
102
-
103
- // allow multiple hashes to be passed on init
104
- options = !isMethodCall && args.length ?
105
- $.extend.apply( null, [ true, options ].concat(args) ) :
106
- options;
107
-
108
- // prevent calls to internal methods
109
- if ( isMethodCall && options.charAt( 0 ) === "_" ) {
110
- return returnValue;
111
- }
112
-
113
- if ( isMethodCall ) {
114
- this.each(function() {
115
- var instance = $.data( this, name ),
116
- methodValue = instance && $.isFunction( instance[options] ) ?
117
- instance[ options ].apply( instance, args ) :
118
- instance;
119
- // TODO: add this back in 1.9 and use $.error() (see #5972)
120
- // if ( !instance ) {
121
- // throw "cannot call methods on " + name + " prior to initialization; " +
122
- // "attempted to call method '" + options + "'";
123
- // }
124
- // if ( !$.isFunction( instance[options] ) ) {
125
- // throw "no such method '" + options + "' for " + name + " widget instance";
126
- // }
127
- // var methodValue = instance[ options ].apply( instance, args );
128
- if ( methodValue !== instance && methodValue !== undefined ) {
129
- returnValue = methodValue;
130
- return false;
131
- }
132
- });
133
- } else {
134
- this.each(function() {
135
- var instance = $.data( this, name );
136
- if ( instance ) {
137
- instance.option( options || {} )._init();
138
- } else {
139
- $.data( this, name, new object( options, this ) );
140
- }
141
- });
142
- }
143
-
144
- return returnValue;
145
- };
146
- };
147
-
148
- $.Widget = function( options, element ) {
149
- // allow instantiation without initializing for simple inheritance
150
- if ( arguments.length ) {
151
- this._createWidget( options, element );
152
- }
153
- };
154
-
155
- $.Widget.prototype = {
156
- widgetName: "widget",
157
- widgetEventPrefix: "",
158
- options: {
159
- disabled: false
160
- },
161
- _createWidget: function( options, element ) {
162
- // $.widget.bridge stores the plugin instance, but we do it anyway
163
- // so that it's stored even before the _create function runs
164
- $.data( element, this.widgetName, this );
165
- this.element = $( element );
166
- this.options = $.extend( true, {},
167
- this.options,
168
- this._getCreateOptions(),
169
- options );
170
-
171
- var self = this;
172
- this.element.bind( "remove." + this.widgetName, function() {
173
- self.destroy();
174
- });
175
-
176
- this._create();
177
- this._trigger( "create" );
178
- this._init();
179
- },
180
- _getCreateOptions: function() {
181
- return $.metadata && $.metadata.get( this.element[0] )[ this.widgetName ];
182
- },
183
- _create: function() {},
184
- _init: function() {},
185
-
186
- destroy: function() {
187
- this.element
188
- .unbind( "." + this.widgetName )
189
- .removeData( this.widgetName );
190
- this.widget()
191
- .unbind( "." + this.widgetName )
192
- .removeAttr( "aria-disabled" )
193
- .removeClass(
194
- this.widgetBaseClass + "-disabled " +
195
- "ui-state-disabled" );
196
- },
197
-
198
- widget: function() {
199
- return this.element;
200
- },
201
-
202
- option: function( key, value ) {
203
- var options = key;
204
-
205
- if ( arguments.length === 0 ) {
206
- // don't return a reference to the internal hash
207
- return $.extend( {}, this.options );
208
- }
209
-
210
- if (typeof key === "string" ) {
211
- if ( value === undefined ) {
212
- return this.options[ key ];
213
- }
214
- options = {};
215
- options[ key ] = value;
216
- }
217
-
218
- this._setOptions( options );
219
-
220
- return this;
221
- },
222
- _setOptions: function( options ) {
223
- var self = this;
224
- $.each( options, function( key, value ) {
225
- self._setOption( key, value );
226
- });
227
-
228
- return this;
229
- },
230
- _setOption: function( key, value ) {
231
- this.options[ key ] = value;
232
-
233
- if ( key === "disabled" ) {
234
- this.widget()
235
- [ value ? "addClass" : "removeClass"](
236
- this.widgetBaseClass + "-disabled" + " " +
237
- "ui-state-disabled" )
238
- .attr( "aria-disabled", value );
239
- }
240
-
241
- return this;
242
- },
243
-
244
- enable: function() {
245
- return this._setOption( "disabled", false );
246
- },
247
- disable: function() {
248
- return this._setOption( "disabled", true );
249
- },
250
-
251
- _trigger: function( type, event, data ) {
252
- var prop, orig,
253
- callback = this.options[ type ];
254
-
255
- data = data || {};
256
- event = $.Event( event );
257
- event.type = ( type === this.widgetEventPrefix ?
258
- type :
259
- this.widgetEventPrefix + type ).toLowerCase();
260
- // the original event may come from any element
261
- // so we need to reset the target on the new event
262
- event.target = this.element[ 0 ];
263
-
264
- // copy original event properties over to the new event
265
- orig = event.originalEvent;
266
- if ( orig ) {
267
- for ( prop in orig ) {
268
- if ( !( prop in event ) ) {
269
- event[ prop ] = orig[ prop ];
270
- }
271
- }
272
- }
273
-
274
- this.element.trigger( event, data );
275
-
276
- return !( $.isFunction(callback) &&
277
- callback.call( this.element[0], event, data ) === false ||
278
- event.isDefaultPrevented() );
279
- }
280
- };
281
-
282
- }));
@@ -1 +0,0 @@
1
- (function(a){"use strict";var b=function(a,c,d){var e=document.createElement("img"),f,g;return e.onerror=c,e.onload=function(){g&&b.revokeObjectURL(g),c(b.scale(e,d))},window.Blob&&a instanceof Blob||window.File&&a instanceof File?f=g=b.createObjectURL(a):f=a,f?(e.src=f,e):b.readFile(a,function(a){e.src=a})},c=window.createObjectURL&&window||window.URL&&URL||window.webkitURL&&webkitURL;b.scale=function(a,b){b=b||{};var c=document.createElement("canvas"),d=Math.max((b.minWidth||a.width)/a.width,(b.minHeight||a.height)/a.height);return d>1&&(a.width=parseInt(a.width*d,10),a.height=parseInt(a.height*d,10)),d=Math.min((b.maxWidth||a.width)/a.width,(b.maxHeight||a.height)/a.height),d<1&&(a.width=parseInt(a.width*d,10),a.height=parseInt(a.height*d,10)),!b.canvas||!c.getContext?a:(c.width=a.width,c.height=a.height,c.getContext("2d").drawImage(a,0,0,a.width,a.height),c)},b.createObjectURL=function(a){return c?c.createObjectURL(a):!1},b.revokeObjectURL=function(a){return c?c.revokeObjectURL(a):!1},b.readFile=function(a,b){if(window.FileReader&&FileReader.prototype.readAsDataURL){var c=new FileReader;return c.onload=function(a){b(a.target.result)},c.readAsDataURL(a),c}return!1},typeof define!="undefined"&&define.amd?define(function(){return b}):a.loadImage=b})(this);
@@ -1 +0,0 @@
1
- (function(a){"use strict";var b=function(a,c){var d=/[^\w\-\.:]/.test(a)?new Function(b.arg+",tmpl","var _e=tmpl.encode"+b.helper+",_s='"+a.replace(b.regexp,b.func)+"';return _s;"):b.cache[a]=b.cache[a]||b(b.load(a));return c?d(c,b):function(a){return d(a,b)}};b.cache={},b.load=function(a){return document.getElementById(a).innerHTML},b.regexp=/([\s'\\])(?![^%]*%\})|(?:\{%(=|#)([\s\S]+?)%\})|(\{%)|(%\})/g,b.func=function(a,b,c,d,e,f){if(b)return{"\n":"\\n","\r":"\\r","\t":"\\t"," ":" "}[a]||"\\"+a;if(c)return c==="="?"'+_e("+d+")+'":"'+("+d+"||'')+'";if(e)return"';";if(f)return"_s+='"},b.encReg=/[<>&"'\x00]/g,b.encMap={"<":"&lt;",">":"&gt;","&":"&amp;",'"':"&quot;","'":"&#39;"},b.encode=function(a){return String(a||"").replace(b.encReg,function(a){return b.encMap[a]||""})},b.arg="o",b.helper=",print=function(s,e){_s+=e&&(s||'')||_e(s);},include=function(s,d){_s+=tmpl(s,d);}",typeof define=="function"&&define.amd?define(function(){return b}):a.tmpl=b})(this);